mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] support starting in canvaskit with FLUTTER_WEB_USE_SKIA=true (#60708)
This commit is contained in:
parent
2f43aeaf54
commit
ae9ac9f211
@ -660,6 +660,9 @@ class WebDevFS implements DevFS {
|
|||||||
expressionCompiler,
|
expressionCompiler,
|
||||||
testMode: testMode,
|
testMode: testMode,
|
||||||
);
|
);
|
||||||
|
if (buildInfo.dartDefines.contains('FLUTTER_WEB_USE_SKIA=true')) {
|
||||||
|
webAssetServer.canvasKitRendering = true;
|
||||||
|
}
|
||||||
if (hostname == 'any') {
|
if (hostname == 'any') {
|
||||||
_baseUri = Uri.http('localhost:$port', '');
|
_baseUri = Uri.http('localhost:$port', '');
|
||||||
} else {
|
} else {
|
||||||
|
@ -486,7 +486,9 @@ void main() {
|
|||||||
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js'), 'BELLOW');
|
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js'), 'BELLOW');
|
||||||
|
|
||||||
// Toggle CanvasKit
|
// Toggle CanvasKit
|
||||||
|
expect(webDevFS.webAssetServer.canvasKitRendering, false);
|
||||||
webDevFS.webAssetServer.canvasKitRendering = true;
|
webDevFS.webAssetServer.canvasKitRendering = true;
|
||||||
|
|
||||||
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js'), 'OL');
|
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js'), 'OL');
|
||||||
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js.map'), 'CHUM');
|
expect(await webDevFS.webAssetServer.dartSourceContents('dart_sdk.js.map'), 'CHUM');
|
||||||
|
|
||||||
@ -650,6 +652,55 @@ void main() {
|
|||||||
expect(uri, Uri.http('localhost:0', ''));
|
expect(uri, Uri.http('localhost:0', ''));
|
||||||
await webDevFS.destroy();
|
await webDevFS.destroy();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
test('Can start web server with canvaskit enabled', () => testbed.run(() async {
|
||||||
|
globals.fs.file('.packages').writeAsStringSync('\n');
|
||||||
|
final File outputFile = globals.fs.file(globals.fs.path.join('lib', 'main.dart'))
|
||||||
|
..createSync(recursive: true);
|
||||||
|
outputFile.parent.childFile('a.sources').writeAsStringSync('');
|
||||||
|
outputFile.parent.childFile('a.json').writeAsStringSync('{}');
|
||||||
|
outputFile.parent.childFile('a.map').writeAsStringSync('{}');
|
||||||
|
outputFile.parent.childFile('.packages').writeAsStringSync('\n');
|
||||||
|
|
||||||
|
final ResidentCompiler residentCompiler = MockResidentCompiler();
|
||||||
|
when(residentCompiler.recompile(
|
||||||
|
any,
|
||||||
|
any,
|
||||||
|
outputPath: anyNamed('outputPath'),
|
||||||
|
packageConfig: anyNamed('packageConfig'),
|
||||||
|
)).thenAnswer((Invocation invocation) async {
|
||||||
|
return const CompilerOutput('a', 0, <Uri>[]);
|
||||||
|
});
|
||||||
|
|
||||||
|
final WebDevFS webDevFS = WebDevFS(
|
||||||
|
hostname: 'localhost',
|
||||||
|
port: 0,
|
||||||
|
packagesFilePath: '.packages',
|
||||||
|
urlTunneller: null,
|
||||||
|
useSseForDebugProxy: true,
|
||||||
|
buildInfo: const BuildInfo(
|
||||||
|
BuildMode.debug,
|
||||||
|
'',
|
||||||
|
treeShakeIcons: false,
|
||||||
|
dartDefines: <String>[
|
||||||
|
'FLUTTER_WEB_USE_SKIA=true',
|
||||||
|
]
|
||||||
|
),
|
||||||
|
enableDwds: false,
|
||||||
|
entrypoint: Uri.base,
|
||||||
|
testMode: true,
|
||||||
|
expressionCompiler: null,
|
||||||
|
chromiumLauncher: null,
|
||||||
|
);
|
||||||
|
webDevFS.requireJS.createSync(recursive: true);
|
||||||
|
webDevFS.stackTraceMapper.createSync(recursive: true);
|
||||||
|
|
||||||
|
await webDevFS.create();
|
||||||
|
|
||||||
|
expect(webDevFS.webAssetServer.canvasKitRendering, true);
|
||||||
|
|
||||||
|
await webDevFS.destroy();
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockHttpServer extends Mock implements HttpServer {}
|
class MockHttpServer extends Mock implements HttpServer {}
|
||||||
|
Loading…
Reference in New Issue
Block a user