@@ -112,7 +112,7 @@ void main() {
112112 );
113113 final CommandRunner <void > runner = createTestCommandRunner (buildCommand);
114114 setupFileSystemForEndToEndTest (fileSystem);
115- await runner.run (< String > ['build' , 'web' , '--no-pub' , '--dart-define=foo=a' , '--dart2js-optimization=O3' ]);
115+ await runner.run (< String > ['build' , 'web' , '--no-pub' , '--no-web-resources-cdn' , '-- dart-define=foo=a' , '--dart2js-optimization=O3' ]);
116116
117117 final Directory buildDir = fileSystem.directory (fileSystem.path.join ('build' , 'web' ));
118118
@@ -164,6 +164,7 @@ void main() {
164164 'build' ,
165165 'web' ,
166166 '--no-pub' ,
167+ '--no-web-resources-cdn' ,
167168 '--output=$newBuildDir '
168169 ]);
169170
@@ -251,6 +252,38 @@ void main() {
251252 ProcessManager : () => FakeProcessManager .any (),
252253 BuildSystem : () => TestBuildSystem .all (BuildResult (success: true )),
253254 });
255+
256+ testUsingContext ('Defaults to gstatic CanvasKit artifacts' , () async {
257+ final TestWebBuildCommand buildCommand = TestWebBuildCommand (fileSystem: fileSystem);
258+ final CommandRunner <void > runner = createTestCommandRunner (buildCommand);
259+ setupFileSystemForEndToEndTest (fileSystem);
260+ await runner.run (< String > ['build' , 'web' , '--no-pub' , '--web-resources-cdn' ]);
261+ final BuildInfo buildInfo =
262+ await buildCommand.webCommand.getBuildInfo (forcedBuildMode: BuildMode .debug);
263+ expect (buildInfo.dartDefines, contains (startsWith ('FLUTTER_WEB_CANVASKIT_URL=https://www.gstatic.com/flutter-canvaskit/' )));
264+ }, overrides: < Type , Generator > {
265+ Platform : () => fakePlatform,
266+ FileSystem : () => fileSystem,
267+ FeatureFlags : () => TestFeatureFlags (isWebEnabled: true ),
268+ ProcessManager : () => FakeProcessManager .any (),
269+ BuildSystem : () => TestBuildSystem .all (BuildResult (success: true )),
270+ });
271+
272+ testUsingContext ('Does not override custom CanvasKit URL' , () async {
273+ final TestWebBuildCommand buildCommand = TestWebBuildCommand (fileSystem: fileSystem);
274+ final CommandRunner <void > runner = createTestCommandRunner (buildCommand);
275+ setupFileSystemForEndToEndTest (fileSystem);
276+ await runner.run (< String > ['build' , 'web' , '--no-pub' , '--web-resources-cdn' , '--dart-define=FLUTTER_WEB_CANVASKIT_URL=abcdefg' ]);
277+ final BuildInfo buildInfo =
278+ await buildCommand.webCommand.getBuildInfo (forcedBuildMode: BuildMode .debug);
279+ expect (buildInfo.dartDefines, contains ('FLUTTER_WEB_CANVASKIT_URL=abcdefg' ));
280+ }, overrides: < Type , Generator > {
281+ Platform : () => fakePlatform,
282+ FileSystem : () => fileSystem,
283+ FeatureFlags : () => TestFeatureFlags (isWebEnabled: true ),
284+ ProcessManager : () => FakeProcessManager .any (),
285+ BuildSystem : () => TestBuildSystem .all (BuildResult (success: true )),
286+ });
254287}
255288
256289void setupFileSystemForEndToEndTest (FileSystem fileSystem) {
0 commit comments