@@ -98,8 +98,6 @@ void main() {
98
98
test (description, () => testbed.run (body, overrides: overrides));
99
99
}
100
100
101
- /* Guard Rail 1 */
102
-
103
101
runTestbed ('.log() reports warnings' , () {
104
102
const String unresolvedUriMessage = 'Unresolved uri:' ;
105
103
const String otherMessage = 'Something bad happened' ;
@@ -114,8 +112,6 @@ void main() {
114
112
expect (logger.warningText, contains (otherMessage));
115
113
});
116
114
117
- /* Guard Rail 2 */
118
-
119
115
runTestbed ('Handles against malformed manifest' , () async {
120
116
final File source = globals.fs.file ('source' )
121
117
..writeAsStringSync ('main() {}' );
@@ -152,8 +148,6 @@ void main() {
152
148
);
153
149
});
154
150
155
- /* Guard Rail 3 */
156
-
157
151
runTestbed ('serves JavaScript files from in memory cache' , () async {
158
152
final File source = globals.fs.file ('source' )
159
153
..writeAsStringSync ('main() {}' );
@@ -183,8 +177,6 @@ void main() {
183
177
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
184
178
}, overrides: < Type , Generator > {Platform : () => linux});
185
179
186
- /* Guard Rail 4 */
187
-
188
180
runTestbed ('serves metadata files from in memory cache' , () async {
189
181
const String metadataContents = '{"name":"foo"}' ;
190
182
final File source = globals.fs.file ('source' )
@@ -210,8 +202,6 @@ void main() {
210
202
expect (single, equals (metadataContents));
211
203
}, overrides: < Type , Generator > {Platform : () => linux});
212
204
213
- /* Guard Rail 5 */
214
-
215
205
// Ensures that no requests are made outside of served directory.
216
206
runTestbed ('Removes leading slashes for valid requests' , () async {
217
207
globals.fs.file ('foo.png' ).createSync ();
@@ -234,8 +224,6 @@ void main() {
234
224
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
235
225
});
236
226
237
- /* Guard Rail 6 */
238
-
239
227
runTestbed ('takes base path into account when serving' , () async {
240
228
webAssetServer.basePath = 'base/path' ;
241
229
@@ -259,8 +247,6 @@ void main() {
259
247
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
260
248
});
261
249
262
- /* Guard Rail 7 */
263
-
264
250
runTestbed ('serves index.html at the base path' , () async {
265
251
webAssetServer.basePath = 'base/path' ;
266
252
@@ -285,8 +271,6 @@ void main() {
285
271
expect (await response.readAsString (), htmlContent);
286
272
});
287
273
288
- /* Guard Rail 8 */
289
-
290
274
runTestbed ('serves index.html at / if href attribute is $kBaseHrefPlaceholder ' , () async {
291
275
const String htmlContent = '<html><head><base href ="$kBaseHrefPlaceholder "></head><body id="test"></body></html>' ;
292
276
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -308,8 +292,6 @@ void main() {
308
292
expect (await response.readAsString (), htmlContent.replaceAll (kBaseHrefPlaceholder, '/' ));
309
293
});
310
294
311
- /* Guard Rail 9 */
312
-
313
295
runTestbed ('does not serve outside the base path' , () async {
314
296
webAssetServer.basePath = 'base/path' ;
315
297
@@ -324,8 +306,6 @@ void main() {
324
306
expect (response.statusCode, HttpStatus .notFound);
325
307
});
326
308
327
- /* Guard Rail 10 */
328
-
329
309
runTestbed ('parses base path from index.html' , () async {
330
310
const String htmlContent = '<html><head><base href="/foo/bar/"></head><body id="test"></body></html>' ;
331
311
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -346,8 +326,6 @@ void main() {
346
326
expect (webAssetServer.basePath, 'foo/bar' );
347
327
});
348
328
349
- /* Guard Rail 11 */
350
-
351
329
runTestbed ('handles lack of base path in index.html' , () async {
352
330
const String htmlContent = '<html><head></head><body id="test"></body></html>' ;
353
331
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -369,8 +347,6 @@ void main() {
369
347
expect (webAssetServer.basePath, '' );
370
348
});
371
349
372
- /* Guard Rail 12 */
373
-
374
350
runTestbed ('throws if base path is relative' , () async {
375
351
const String htmlContent = '<html><head><base href="foo/bar/"></head><body id="test"></body></html>' ;
376
352
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -392,8 +368,6 @@ void main() {
392
368
);
393
369
});
394
370
395
- /* Guard Rail 13 */
396
-
397
371
runTestbed ('throws if base path does not end with slash' , () async {
398
372
const String htmlContent = '<html><head><base href="/foo/bar"></head><body id="test"></body></html>' ;
399
373
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -415,8 +389,6 @@ void main() {
415
389
);
416
390
});
417
391
418
- /* Guard Rail 14 */
419
-
420
392
runTestbed ('serves JavaScript files from in memory cache not from manifest' , () async {
421
393
webAssetServer.writeFile ('foo.js' , 'main() {}' );
422
394
@@ -433,8 +405,6 @@ void main() {
433
405
expect ((await response.read ().toList ()).first, utf8.encode ('main() {}' ));
434
406
});
435
407
436
- /* Guard Rail 15 */
437
-
438
408
runTestbed ('Returns notModified when the ifNoneMatch header matches the etag' , () async {
439
409
webAssetServer.writeFile ('foo.js' , 'main() {}' );
440
410
@@ -452,8 +422,6 @@ void main() {
452
422
expect (await cachedResponse.read ().toList (), isEmpty);
453
423
});
454
424
455
- /* Guard Rail 16 */
456
-
457
425
runTestbed ('serves index.html when path is unknown' , () async {
458
426
const String htmlContent = '<html><head></head><body id="test"></body></html>' ;
459
427
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -474,8 +442,6 @@ void main() {
474
442
expect (await response.readAsString (), htmlContent);
475
443
});
476
444
477
- /* Guard Rail 17 */
478
-
479
445
runTestbed ('does not serve outside the base path' , () async {
480
446
webAssetServer.basePath = 'base/path' ;
481
447
@@ -490,8 +456,6 @@ void main() {
490
456
expect (response.statusCode, HttpStatus .notFound);
491
457
});
492
458
493
- /* Guard Rail 18 */
494
-
495
459
runTestbed ('does not serve index.html when path is inside assets or packages' , () async {
496
460
const String htmlContent = '<html><head></head><body id="test"></body></html>' ;
497
461
final Directory webDir = globals.fs.currentDirectory.childDirectory ('web' )..createSync ();
@@ -520,8 +484,6 @@ void main() {
520
484
expect (response.statusCode, HttpStatus .notFound);
521
485
});
522
486
523
- /* Guard Rail 19 */
524
-
525
487
runTestbed ('serves default index.html' , () async {
526
488
final String flutterJsPath = globals.fs.path.join (
527
489
globals.artifacts! .getHostArtifact (HostArtifact .flutterJsDirectory).path,
@@ -542,8 +504,6 @@ void main() {
542
504
);
543
505
});
544
506
545
- /* Guard Rail 20 */
546
-
547
507
runTestbed ('handles web server paths without .lib extension' , () async {
548
508
final File source = globals.fs.file ('source' )
549
509
..writeAsStringSync ('main() {}' );
@@ -568,8 +528,6 @@ void main() {
568
528
expect (response.statusCode, HttpStatus .ok);
569
529
});
570
530
571
- /* Guard Rail 21 */
572
-
573
531
runTestbed ('serves JavaScript files from in memory cache on Windows' , () async {
574
532
final File source = globals.fs.file ('source' )
575
533
..writeAsStringSync ('main() {}' );
@@ -599,8 +557,6 @@ void main() {
599
557
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
600
558
}, overrides: < Type , Generator > {Platform : () => windows});
601
559
602
- /* Guard Rail 22 */
603
-
604
560
runTestbed ('serves asset files from in filesystem with url-encoded paths' , () async {
605
561
final String path = globals.fs.path.join (
606
562
'build' ,
@@ -623,8 +579,6 @@ void main() {
623
579
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
624
580
});
625
581
626
- /* Guard Rail 23 */
627
-
628
582
runTestbed ('serves files from web directory' , () async {
629
583
final File source = globals.fs.file (globals.fs.path.join ('web' , 'foo.png' ))
630
584
..createSync (recursive: true )
@@ -642,8 +596,6 @@ void main() {
642
596
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
643
597
});
644
598
645
- /* Guard Rail 24 */
646
-
647
599
runTestbed ('serves asset files from filesystem with known mime type on Windows' , () async {
648
600
final String path = globals.fs.path.join ('build' , 'flutter_assets' , 'foo.png' );
649
601
final File source = globals.fs.file (path)
@@ -662,8 +614,6 @@ void main() {
662
614
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
663
615
}, overrides: < Type , Generator > {Platform : () => windows});
664
616
665
- /* Guard Rail 25 */
666
-
667
617
runTestbed ('serves Dart files from in filesystem on Linux/macOS' , () async {
668
618
final File source = globals.fs.file ('foo.dart' ).absolute
669
619
..createSync (recursive: true )
@@ -680,8 +630,6 @@ void main() {
680
630
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
681
631
}, overrides: < Type , Generator > {Platform : () => linux});
682
632
683
- /* Guard Rail 26 */
684
-
685
633
runTestbed ('serves asset files from in filesystem with known mime type' , () async {
686
634
final String path = globals.fs.path.join ('build' , 'flutter_assets' , 'foo.png' );
687
635
final File source = globals.fs.file (path)
@@ -699,8 +647,6 @@ void main() {
699
647
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
700
648
});
701
649
702
- /* Guard Rail 27 */
703
-
704
650
runTestbed ('serves asset files from in filesystem with known mime type and empty content' , () async {
705
651
final String path = globals.fs.path.join ('web' , 'foo.js' );
706
652
final File source = globals.fs.file (path)
@@ -717,8 +663,6 @@ void main() {
717
663
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
718
664
});
719
665
720
- /* Guard Rail 28 */
721
-
722
666
runTestbed ('serves asset files from in filesystem with unknown mime type' , () async {
723
667
final String path = globals.fs.path.join ('build' , 'flutter_assets' , 'foo' );
724
668
final File source = globals.fs.file (path)
@@ -736,8 +680,6 @@ void main() {
736
680
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
737
681
});
738
682
739
- /* Guard Rail 29 */
740
-
741
683
runTestbed ('serves valid etag header for asset files with non-ascii characters' , () async {
742
684
final String path = globals.fs.path.join ('build' , 'flutter_assets' , 'fooπ' );
743
685
globals.fs.file (path)
@@ -752,8 +694,6 @@ void main() {
752
694
expect (etag.runes, everyElement (predicate ((int char) => char < 255 )));
753
695
});
754
696
755
- /* Guard Rail 30 */
756
-
757
697
runTestbed ('serves /packages/<package>/<path> files as if they were package:<package>/<path> uris' , () async {
758
698
final String path = globals.fs.path.fromUri (
759
699
packages.resolve (Uri .parse ('package:flutter_tools/foo.dart' )),
@@ -773,15 +713,11 @@ void main() {
773
713
expect ((await response.read ().toList ()).first, source.readAsBytesSync ());
774
714
});
775
715
776
- /* Guard Rail 31 */
777
-
778
716
runTestbed ('calling dispose closes the HTTP server' , () async {
779
717
await webAssetServer.dispose ();
780
718
expect (httpServer.closed, true );
781
719
});
782
720
783
- /* Guard Rail 32 */
784
-
785
721
runTestbed ('Can start web server with specified DDC module system assets' , () async {
786
722
final String path = globals.fs.path.join ('lib' , 'main.dart' );
787
723
final File outputFile = globals.fs.file (path)
@@ -906,8 +842,6 @@ void main() {
906
842
await webDevFS.destroy ();
907
843
}, overrides: < Type , Generator > {Artifacts : Artifacts .test});
908
844
909
- /* Guard Rail 33 */
910
-
911
845
runTestbed ('Can start web server with specified assets in sound null safety mode' , () async {
912
846
final String path = globals.fs.path.join ('lib' , 'main.dart' );
913
847
final File outputFile = globals.fs.file (path)
@@ -1030,8 +964,6 @@ void main() {
1030
964
await webDevFS.destroy ();
1031
965
}, overrides: < Type , Generator > {Artifacts : Artifacts .test});
1032
966
1033
- /* Guard Rail 34 */
1034
-
1035
967
runTestbed ('.connect() will never call vmServiceFactory twice' , () async {
1036
968
await FakeAsync ().run <Future <void >>((FakeAsync time) {
1037
969
final String path = globals.fs.path.join ('lib' , 'main.dart' );
@@ -1112,8 +1044,6 @@ void main() {
1112
1044
});
1113
1045
}, overrides: < Type , Generator > {Artifacts : Artifacts .test});
1114
1046
1115
- /* Guard Rail 35 */
1116
-
1117
1047
runTestbed ('Can start web server with hostname any' , () async {
1118
1048
final String path = globals.fs.path.join ('lib' , 'main.dart' );
1119
1049
final File outputFile = globals.fs.file (path)
@@ -1158,8 +1088,6 @@ void main() {
1158
1088
await webDevFS.destroy ();
1159
1089
});
1160
1090
1161
- /* Guard Rail 36 */
1162
-
1163
1091
runTestbed ('Can start web server with canvaskit enabled' , () async {
1164
1092
final String path = globals.fs.path.join ('lib' , 'main.dart' );
1165
1093
final File outputFile = globals.fs.file (path)
@@ -1210,8 +1138,6 @@ void main() {
1210
1138
await webDevFS.destroy ();
1211
1139
});
1212
1140
1213
- /* Guard Rail 37 */
1214
-
1215
1141
runTestbed ('Can start web server with auto detect enabled' , () async {
1216
1142
final String path = globals.fs.path.join ('lib' , 'main.dart' );
1217
1143
final File outputFile = globals.fs.file (path)
@@ -1262,8 +1188,6 @@ void main() {
1262
1188
await webDevFS.destroy ();
1263
1189
});
1264
1190
1265
- /* Guard Rail 38 */
1266
-
1267
1191
runTestbed ('Can start web server with tls connection' , () async {
1268
1192
final String dataPath = globals.fs.path.join (
1269
1193
getFlutterRoot (),
@@ -1315,8 +1239,6 @@ void main() {
1315
1239
await webDevFS.destroy ();
1316
1240
}, overrides: < Type , Generator > {Artifacts : Artifacts .test});
1317
1241
1318
- /* Guard Rail 39 */
1319
-
1320
1242
test ('allows frame embedding' , () async {
1321
1243
final WebAssetServer webAssetServer = await WebAssetServer .start (
1322
1244
null ,
@@ -1350,8 +1272,6 @@ void main() {
1350
1272
await webAssetServer.dispose ();
1351
1273
});
1352
1274
1353
- /* Guard Rail 40 */
1354
-
1355
1275
test ('passes on extra headers' , () async {
1356
1276
const String extraHeaderKey = 'hurray' ;
1357
1277
const String extraHeaderValue = 'flutter' ;
@@ -1393,26 +1313,20 @@ void main() {
1393
1313
await webAssetServer.dispose ();
1394
1314
});
1395
1315
1396
- /* Guard Rail 41 */
1397
-
1398
1316
runTestbed ('WebAssetServer responds to POST requests with 404 not found' , () async {
1399
1317
final Response response = await webAssetServer.handleRequest (
1400
1318
Request ('POST' , Uri .parse ('http://foobar/something' )),
1401
1319
);
1402
1320
expect (response.statusCode, 404 );
1403
1321
});
1404
1322
1405
- /* Guard Rail 42 */
1406
-
1407
1323
runTestbed ('ReleaseAssetServer responds to POST requests with 404 not found' , () async {
1408
1324
final Response response = await releaseAssetServer.handle (
1409
1325
Request ('POST' , Uri .parse ('http://foobar/something' )),
1410
1326
);
1411
1327
expect (response.statusCode, 404 );
1412
1328
});
1413
1329
1414
- /* Guard Rail 43 */
1415
-
1416
1330
runTestbed ('WebAssetServer strips leading base href off of asset requests' , () async {
1417
1331
const String htmlContent = '<html><head><base href="/foo/"></head><body id="test"></body></html>' ;
1418
1332
globals.fs.currentDirectory.childDirectory ('web' ).childFile ('index.html' )
@@ -1441,8 +1355,6 @@ void main() {
1441
1355
);
1442
1356
});
1443
1357
1444
- /* Guard Rail 44 */
1445
-
1446
1358
runTestbed ('DevFS URI includes any specified base path.' , () async {
1447
1359
final String path = globals.fs.path.join ('lib' , 'main.dart' );
1448
1360
final File outputFile = globals.fs.file (path)
0 commit comments