@@ -112,7 +112,7 @@ void main() {
112
112
);
113
113
final CommandRunner <void > runner = createTestCommandRunner (buildCommand);
114
114
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' ]);
116
116
117
117
final Directory buildDir = fileSystem.directory (fileSystem.path.join ('build' , 'web' ));
118
118
@@ -164,6 +164,7 @@ void main() {
164
164
'build' ,
165
165
'web' ,
166
166
'--no-pub' ,
167
+ '--no-web-resources-cdn' ,
167
168
'--output=$newBuildDir '
168
169
]);
169
170
@@ -251,6 +252,38 @@ void main() {
251
252
ProcessManager : () => FakeProcessManager .any (),
252
253
BuildSystem : () => TestBuildSystem .all (BuildResult (success: true )),
253
254
});
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
+ });
254
287
}
255
288
256
289
void setupFileSystemForEndToEndTest (FileSystem fileSystem) {
0 commit comments