Support flutter run --wasm and flutter drive --wasm. (#146231)
This adds support for adding the `--wasm` flag to `flutter run` and `flutter drive` * Emits errors if you attempt to use the skwasm renderer without the `--wasm` flag * Emits errors if you try to use `--wasm` when not using a web device * Uses the skwasm renderer by default if you pass `--wasm` and no `--web-renderer`
This commit is contained in:
12
dev/integration_tests/non_nullable/web/flutter_bootstrap.js
Normal file
12
dev/integration_tests/non_nullable/web/flutter_bootstrap.js
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
{{flutter_js}}
|
||||
{{flutter_build_config}}
|
||||
_flutter.loader.load({
|
||||
config: {
|
||||
// Use the local CanvasKit bundle instead of the CDN to reduce test flakiness.
|
||||
canvasKitBaseUrl: "/canvaskit/",
|
||||
},
|
||||
});
|
||||
@@ -22,16 +22,6 @@ found in the LICENSE file. -->
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<!-- This script installs service_worker.js to provide PWA functionality to
|
||||
application. For more information, see:
|
||||
https://developers.google.com/web/fundamentals/primers/service-workers -->
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function () {
|
||||
navigator.serviceWorker.register('flutter_service_worker.js');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="main.dart.js" type="application/javascript"></script>
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
{{flutter_js}}
|
||||
{{flutter_build_config}}
|
||||
_flutter.loader.load({
|
||||
config: {
|
||||
// Use the local CanvasKit bundle instead of the CDN to reduce test flakiness.
|
||||
canvasKitBaseUrl: "/canvaskit/",
|
||||
},
|
||||
});
|
||||
@@ -7,6 +7,6 @@ found in the LICENSE file. -->
|
||||
<title>Hello, World</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="main.dart.js"></script>
|
||||
<script src="flutter_bootstrap.js" async></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -12,5 +12,7 @@ void main() {
|
||||
testWidgets('isCanvasKit returns true in CanvasKit mode', (WidgetTester tester) async {
|
||||
await tester.pumpAndSettle();
|
||||
expect(isCanvasKit, true);
|
||||
expect(isSkwasm, false);
|
||||
expect(isSkiaWeb, true);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -8,8 +8,10 @@ import 'package:integration_test/integration_test.dart';
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
testWidgets('isCanvasKit returns false in HTML mode', (WidgetTester tester) async {
|
||||
testWidgets('capabilities are set properly in HTML mode', (WidgetTester tester) async {
|
||||
await tester.pumpAndSettle();
|
||||
expect(isCanvasKit, false);
|
||||
expect(isSkwasm, false);
|
||||
expect(isSkiaWeb, false);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:integration_test/integration_test.dart';
|
||||
|
||||
void main() {
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
testWidgets('capabilities are set properly in Skwasm mode', (WidgetTester tester) async {
|
||||
await tester.pumpAndSettle();
|
||||
expect(isCanvasKit, false);
|
||||
expect(isSkwasm, true);
|
||||
expect(isSkiaWeb, true);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:integration_test/integration_test_driver.dart' as test;
|
||||
|
||||
Future<void> main() async => test.integrationDriver();
|
||||
Reference in New Issue
Block a user