Skip to content

Commit 588de85

Browse files
committed
remove guard rails
1 parent 41f9c93 commit 588de85

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

packages/flutter_tools/test/general.shard/web/devfs_web_ddc_modules_test.dart

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ void main() {
9898
test(description, () => testbed.run(body, overrides: overrides));
9999
}
100100

101-
/* Guard Rail 1 */
102-
103101
runTestbed('.log() reports warnings', () {
104102
const String unresolvedUriMessage = 'Unresolved uri:';
105103
const String otherMessage = 'Something bad happened';
@@ -114,8 +112,6 @@ void main() {
114112
expect(logger.warningText, contains(otherMessage));
115113
});
116114

117-
/* Guard Rail 2 */
118-
119115
runTestbed('Handles against malformed manifest', () async {
120116
final File source = globals.fs.file('source')
121117
..writeAsStringSync('main() {}');
@@ -152,8 +148,6 @@ void main() {
152148
);
153149
});
154150

155-
/* Guard Rail 3 */
156-
157151
runTestbed('serves JavaScript files from in memory cache', () async {
158152
final File source = globals.fs.file('source')
159153
..writeAsStringSync('main() {}');
@@ -183,8 +177,6 @@ void main() {
183177
expect((await response.read().toList()).first, source.readAsBytesSync());
184178
}, overrides: <Type, Generator>{Platform: () => linux});
185179

186-
/* Guard Rail 4 */
187-
188180
runTestbed('serves metadata files from in memory cache', () async {
189181
const String metadataContents = '{"name":"foo"}';
190182
final File source = globals.fs.file('source')
@@ -210,8 +202,6 @@ void main() {
210202
expect(single, equals(metadataContents));
211203
}, overrides: <Type, Generator>{Platform: () => linux});
212204

213-
/* Guard Rail 5 */
214-
215205
// Ensures that no requests are made outside of served directory.
216206
runTestbed('Removes leading slashes for valid requests', () async {
217207
globals.fs.file('foo.png').createSync();
@@ -234,8 +224,6 @@ void main() {
234224
expect((await response.read().toList()).first, source.readAsBytesSync());
235225
});
236226

237-
/* Guard Rail 6 */
238-
239227
runTestbed('takes base path into account when serving', () async {
240228
webAssetServer.basePath = 'base/path';
241229

@@ -259,8 +247,6 @@ void main() {
259247
expect((await response.read().toList()).first, source.readAsBytesSync());
260248
});
261249

262-
/* Guard Rail 7 */
263-
264250
runTestbed('serves index.html at the base path', () async {
265251
webAssetServer.basePath = 'base/path';
266252

@@ -285,8 +271,6 @@ void main() {
285271
expect(await response.readAsString(), htmlContent);
286272
});
287273

288-
/* Guard Rail 8 */
289-
290274
runTestbed('serves index.html at / if href attribute is $kBaseHrefPlaceholder', () async {
291275
const String htmlContent = '<html><head><base href ="$kBaseHrefPlaceholder"></head><body id="test"></body></html>';
292276
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -308,8 +292,6 @@ void main() {
308292
expect(await response.readAsString(), htmlContent.replaceAll(kBaseHrefPlaceholder, '/'));
309293
});
310294

311-
/* Guard Rail 9 */
312-
313295
runTestbed('does not serve outside the base path', () async {
314296
webAssetServer.basePath = 'base/path';
315297

@@ -324,8 +306,6 @@ void main() {
324306
expect(response.statusCode, HttpStatus.notFound);
325307
});
326308

327-
/* Guard Rail 10 */
328-
329309
runTestbed('parses base path from index.html', () async {
330310
const String htmlContent = '<html><head><base href="/foo/bar/"></head><body id="test"></body></html>';
331311
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -346,8 +326,6 @@ void main() {
346326
expect(webAssetServer.basePath, 'foo/bar');
347327
});
348328

349-
/* Guard Rail 11 */
350-
351329
runTestbed('handles lack of base path in index.html', () async {
352330
const String htmlContent = '<html><head></head><body id="test"></body></html>';
353331
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -369,8 +347,6 @@ void main() {
369347
expect(webAssetServer.basePath, '');
370348
});
371349

372-
/* Guard Rail 12 */
373-
374350
runTestbed('throws if base path is relative', () async {
375351
const String htmlContent = '<html><head><base href="foo/bar/"></head><body id="test"></body></html>';
376352
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -392,8 +368,6 @@ void main() {
392368
);
393369
});
394370

395-
/* Guard Rail 13 */
396-
397371
runTestbed('throws if base path does not end with slash', () async {
398372
const String htmlContent = '<html><head><base href="/foo/bar"></head><body id="test"></body></html>';
399373
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -415,8 +389,6 @@ void main() {
415389
);
416390
});
417391

418-
/* Guard Rail 14 */
419-
420392
runTestbed('serves JavaScript files from in memory cache not from manifest', () async {
421393
webAssetServer.writeFile('foo.js', 'main() {}');
422394

@@ -433,8 +405,6 @@ void main() {
433405
expect((await response.read().toList()).first, utf8.encode('main() {}'));
434406
});
435407

436-
/* Guard Rail 15 */
437-
438408
runTestbed('Returns notModified when the ifNoneMatch header matches the etag', () async {
439409
webAssetServer.writeFile('foo.js', 'main() {}');
440410

@@ -452,8 +422,6 @@ void main() {
452422
expect(await cachedResponse.read().toList(), isEmpty);
453423
});
454424

455-
/* Guard Rail 16 */
456-
457425
runTestbed('serves index.html when path is unknown', () async {
458426
const String htmlContent = '<html><head></head><body id="test"></body></html>';
459427
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -474,8 +442,6 @@ void main() {
474442
expect(await response.readAsString(), htmlContent);
475443
});
476444

477-
/* Guard Rail 17 */
478-
479445
runTestbed('does not serve outside the base path', () async {
480446
webAssetServer.basePath = 'base/path';
481447

@@ -490,8 +456,6 @@ void main() {
490456
expect(response.statusCode, HttpStatus.notFound);
491457
});
492458

493-
/* Guard Rail 18 */
494-
495459
runTestbed('does not serve index.html when path is inside assets or packages', () async {
496460
const String htmlContent = '<html><head></head><body id="test"></body></html>';
497461
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
@@ -520,8 +484,6 @@ void main() {
520484
expect(response.statusCode, HttpStatus.notFound);
521485
});
522486

523-
/* Guard Rail 19 */
524-
525487
runTestbed('serves default index.html', () async {
526488
final String flutterJsPath = globals.fs.path.join(
527489
globals.artifacts!.getHostArtifact(HostArtifact.flutterJsDirectory).path,
@@ -542,8 +504,6 @@ void main() {
542504
);
543505
});
544506

545-
/* Guard Rail 20 */
546-
547507
runTestbed('handles web server paths without .lib extension', () async {
548508
final File source = globals.fs.file('source')
549509
..writeAsStringSync('main() {}');
@@ -568,8 +528,6 @@ void main() {
568528
expect(response.statusCode, HttpStatus.ok);
569529
});
570530

571-
/* Guard Rail 21 */
572-
573531
runTestbed('serves JavaScript files from in memory cache on Windows', () async {
574532
final File source = globals.fs.file('source')
575533
..writeAsStringSync('main() {}');
@@ -599,8 +557,6 @@ void main() {
599557
expect((await response.read().toList()).first, source.readAsBytesSync());
600558
}, overrides: <Type, Generator>{Platform: () => windows});
601559

602-
/* Guard Rail 22 */
603-
604560
runTestbed('serves asset files from in filesystem with url-encoded paths', () async {
605561
final String path = globals.fs.path.join(
606562
'build',
@@ -623,8 +579,6 @@ void main() {
623579
expect((await response.read().toList()).first, source.readAsBytesSync());
624580
});
625581

626-
/* Guard Rail 23 */
627-
628582
runTestbed('serves files from web directory', () async {
629583
final File source = globals.fs.file(globals.fs.path.join('web', 'foo.png'))
630584
..createSync(recursive: true)
@@ -642,8 +596,6 @@ void main() {
642596
expect((await response.read().toList()).first, source.readAsBytesSync());
643597
});
644598

645-
/* Guard Rail 24 */
646-
647599
runTestbed('serves asset files from filesystem with known mime type on Windows', () async {
648600
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo.png');
649601
final File source = globals.fs.file(path)
@@ -662,8 +614,6 @@ void main() {
662614
expect((await response.read().toList()).first, source.readAsBytesSync());
663615
}, overrides: <Type, Generator>{Platform: () => windows});
664616

665-
/* Guard Rail 25 */
666-
667617
runTestbed('serves Dart files from in filesystem on Linux/macOS', () async {
668618
final File source = globals.fs.file('foo.dart').absolute
669619
..createSync(recursive: true)
@@ -680,8 +630,6 @@ void main() {
680630
expect((await response.read().toList()).first, source.readAsBytesSync());
681631
}, overrides: <Type, Generator>{Platform: () => linux});
682632

683-
/* Guard Rail 26 */
684-
685633
runTestbed('serves asset files from in filesystem with known mime type', () async {
686634
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo.png');
687635
final File source = globals.fs.file(path)
@@ -699,8 +647,6 @@ void main() {
699647
expect((await response.read().toList()).first, source.readAsBytesSync());
700648
});
701649

702-
/* Guard Rail 27 */
703-
704650
runTestbed('serves asset files from in filesystem with known mime type and empty content', () async {
705651
final String path = globals.fs.path.join('web', 'foo.js');
706652
final File source = globals.fs.file(path)
@@ -717,8 +663,6 @@ void main() {
717663
expect((await response.read().toList()).first, source.readAsBytesSync());
718664
});
719665

720-
/* Guard Rail 28 */
721-
722666
runTestbed('serves asset files from in filesystem with unknown mime type', () async {
723667
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo');
724668
final File source = globals.fs.file(path)
@@ -736,8 +680,6 @@ void main() {
736680
expect((await response.read().toList()).first, source.readAsBytesSync());
737681
});
738682

739-
/* Guard Rail 29 */
740-
741683
runTestbed('serves valid etag header for asset files with non-ascii characters', () async {
742684
final String path = globals.fs.path.join('build', 'flutter_assets', 'fooπ');
743685
globals.fs.file(path)
@@ -752,8 +694,6 @@ void main() {
752694
expect(etag.runes, everyElement(predicate((int char) => char < 255)));
753695
});
754696

755-
/* Guard Rail 30 */
756-
757697
runTestbed('serves /packages/<package>/<path> files as if they were package:<package>/<path> uris', () async {
758698
final String path = globals.fs.path.fromUri(
759699
packages.resolve(Uri.parse('package:flutter_tools/foo.dart')),
@@ -773,15 +713,11 @@ void main() {
773713
expect((await response.read().toList()).first, source.readAsBytesSync());
774714
});
775715

776-
/* Guard Rail 31 */
777-
778716
runTestbed('calling dispose closes the HTTP server', () async {
779717
await webAssetServer.dispose();
780718
expect(httpServer.closed, true);
781719
});
782720

783-
/* Guard Rail 32 */
784-
785721
runTestbed('Can start web server with specified DDC module system assets', () async {
786722
final String path = globals.fs.path.join('lib', 'main.dart');
787723
final File outputFile = globals.fs.file(path)
@@ -906,8 +842,6 @@ void main() {
906842
await webDevFS.destroy();
907843
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
908844

909-
/* Guard Rail 33 */
910-
911845
runTestbed('Can start web server with specified assets in sound null safety mode', () async {
912846
final String path = globals.fs.path.join('lib', 'main.dart');
913847
final File outputFile = globals.fs.file(path)
@@ -1030,8 +964,6 @@ void main() {
1030964
await webDevFS.destroy();
1031965
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
1032966

1033-
/* Guard Rail 34 */
1034-
1035967
runTestbed('.connect() will never call vmServiceFactory twice', () async {
1036968
await FakeAsync().run<Future<void>>((FakeAsync time) {
1037969
final String path = globals.fs.path.join('lib', 'main.dart');
@@ -1112,8 +1044,6 @@ void main() {
11121044
});
11131045
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
11141046

1115-
/* Guard Rail 35 */
1116-
11171047
runTestbed('Can start web server with hostname any', () async {
11181048
final String path = globals.fs.path.join('lib', 'main.dart');
11191049
final File outputFile = globals.fs.file(path)
@@ -1158,8 +1088,6 @@ void main() {
11581088
await webDevFS.destroy();
11591089
});
11601090

1161-
/* Guard Rail 36 */
1162-
11631091
runTestbed('Can start web server with canvaskit enabled', () async {
11641092
final String path = globals.fs.path.join('lib', 'main.dart');
11651093
final File outputFile = globals.fs.file(path)
@@ -1210,8 +1138,6 @@ void main() {
12101138
await webDevFS.destroy();
12111139
});
12121140

1213-
/* Guard Rail 37 */
1214-
12151141
runTestbed('Can start web server with auto detect enabled', () async {
12161142
final String path = globals.fs.path.join('lib', 'main.dart');
12171143
final File outputFile = globals.fs.file(path)
@@ -1262,8 +1188,6 @@ void main() {
12621188
await webDevFS.destroy();
12631189
});
12641190

1265-
/* Guard Rail 38 */
1266-
12671191
runTestbed('Can start web server with tls connection', () async {
12681192
final String dataPath = globals.fs.path.join(
12691193
getFlutterRoot(),
@@ -1315,8 +1239,6 @@ void main() {
13151239
await webDevFS.destroy();
13161240
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
13171241

1318-
/* Guard Rail 39 */
1319-
13201242
test('allows frame embedding', () async {
13211243
final WebAssetServer webAssetServer = await WebAssetServer.start(
13221244
null,
@@ -1350,8 +1272,6 @@ void main() {
13501272
await webAssetServer.dispose();
13511273
});
13521274

1353-
/* Guard Rail 40 */
1354-
13551275
test('passes on extra headers', () async {
13561276
const String extraHeaderKey = 'hurray';
13571277
const String extraHeaderValue = 'flutter';
@@ -1393,26 +1313,20 @@ void main() {
13931313
await webAssetServer.dispose();
13941314
});
13951315

1396-
/* Guard Rail 41 */
1397-
13981316
runTestbed('WebAssetServer responds to POST requests with 404 not found', () async {
13991317
final Response response = await webAssetServer.handleRequest(
14001318
Request('POST', Uri.parse('http://foobar/something')),
14011319
);
14021320
expect(response.statusCode, 404);
14031321
});
14041322

1405-
/* Guard Rail 42 */
1406-
14071323
runTestbed('ReleaseAssetServer responds to POST requests with 404 not found', () async {
14081324
final Response response = await releaseAssetServer.handle(
14091325
Request('POST', Uri.parse('http://foobar/something')),
14101326
);
14111327
expect(response.statusCode, 404);
14121328
});
14131329

1414-
/* Guard Rail 43 */
1415-
14161330
runTestbed('WebAssetServer strips leading base href off of asset requests', () async {
14171331
const String htmlContent = '<html><head><base href="/foo/"></head><body id="test"></body></html>';
14181332
globals.fs.currentDirectory.childDirectory('web').childFile('index.html')
@@ -1441,8 +1355,6 @@ void main() {
14411355
);
14421356
});
14431357

1444-
/* Guard Rail 44 */
1445-
14461358
runTestbed('DevFS URI includes any specified base path.', () async {
14471359
final String path = globals.fs.path.join('lib', 'main.dart');
14481360
final File outputFile = globals.fs.file(path)

0 commit comments

Comments
 (0)