Skip to content

Commit d6c4875

Browse files
committed
rename to runInTestbed()
1 parent bfb6c55 commit d6c4875

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

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

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ void main() {
9393
});
9494

9595
@isTest
96-
void runTestbed(
96+
void runInTestbed(
9797
String description,
9898
FutureOr<void> Function() body, {
9999
Map<Type, Generator>? overrides,
100100
}) {
101101
test(description, () => testbed.run(body, overrides: overrides));
102102
}
103103

104-
runTestbed('.log() reports warnings', () {
104+
runInTestbed('.log() reports warnings', () {
105105
const String unresolvedUriMessage = 'Unresolved uri:';
106106
const String otherMessage = 'Something bad happened';
107107

@@ -115,7 +115,7 @@ void main() {
115115
expect(logger.warningText, contains(otherMessage));
116116
});
117117

118-
runTestbed('Handles against malformed manifest', () async {
118+
runInTestbed('Handles against malformed manifest', () async {
119119
final File source = globals.fs.file('source')
120120
..writeAsStringSync('main() {}');
121121
final File sourcemap = globals.fs.file('sourcemap')
@@ -151,7 +151,7 @@ void main() {
151151
);
152152
});
153153

154-
runTestbed('serves JavaScript files from memory cache', () async {
154+
runInTestbed('serves JavaScript files from memory cache', () async {
155155
final File source = globals.fs.file('source')
156156
..writeAsStringSync('main() {}');
157157
final File sourcemap = globals.fs.file('sourcemap')
@@ -180,7 +180,7 @@ void main() {
180180
expect((await response.read().toList()).first, source.readAsBytesSync());
181181
}, overrides: <Type, Generator>{Platform: () => linux});
182182

183-
runTestbed('serves metadata files from memory cache', () async {
183+
runInTestbed('serves metadata files from memory cache', () async {
184184
const String metadataContents = '{"name":"foo"}';
185185
final File source = globals.fs.file('source')
186186
..writeAsStringSync('main() {}');
@@ -206,7 +206,7 @@ void main() {
206206
}, overrides: <Type, Generator>{Platform: () => linux});
207207

208208
// Ensures that no requests are made outside of served directory.
209-
runTestbed('Removes leading slashes for valid requests', () async {
209+
runInTestbed('Removes leading slashes for valid requests', () async {
210210
globals.fs.file('foo.png').createSync();
211211
globals.fs.currentDirectory = globals.fs.directory('project_directory')
212212
..createSync();
@@ -227,7 +227,7 @@ void main() {
227227
expect((await response.read().toList()).first, source.readAsBytesSync());
228228
});
229229

230-
runTestbed('takes base path into account when serving', () async {
230+
runInTestbed('takes base path into account when serving', () async {
231231
webAssetServer.basePath = 'base/path';
232232

233233
globals.fs.file('foo.png').createSync();
@@ -250,7 +250,7 @@ void main() {
250250
expect((await response.read().toList()).first, source.readAsBytesSync());
251251
});
252252

253-
runTestbed('serves index.html at the base path', () async {
253+
runInTestbed('serves index.html at the base path', () async {
254254
webAssetServer.basePath = 'base/path';
255255

256256
const String htmlContent = '<html><head></head><body id="test"></body></html>';
@@ -274,7 +274,7 @@ void main() {
274274
expect(await response.readAsString(), htmlContent);
275275
});
276276

277-
runTestbed('serves index.html at / if href attribute is $kBaseHrefPlaceholder', () async {
277+
runInTestbed('serves index.html at / if href attribute is $kBaseHrefPlaceholder', () async {
278278
const String htmlContent = '<html><head><base href ="$kBaseHrefPlaceholder"></head><body id="test"></body></html>';
279279
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
280280
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -295,7 +295,7 @@ void main() {
295295
expect(await response.readAsString(), htmlContent.replaceAll(kBaseHrefPlaceholder, '/'));
296296
});
297297

298-
runTestbed('does not serve outside the base path', () async {
298+
runInTestbed('does not serve outside the base path', () async {
299299
webAssetServer.basePath = 'base/path';
300300

301301
const String htmlContent = '<html><head></head><body id="test"></body></html>';
@@ -309,7 +309,7 @@ void main() {
309309
expect(response.statusCode, HttpStatus.notFound);
310310
});
311311

312-
runTestbed('parses base path from index.html', () async {
312+
runInTestbed('parses base path from index.html', () async {
313313
const String htmlContent = '<html><head><base href="/foo/bar/"></head><body id="test"></body></html>';
314314
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
315315
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -329,7 +329,7 @@ void main() {
329329
expect(webAssetServer.basePath, 'foo/bar');
330330
});
331331

332-
runTestbed('handles lack of base path in index.html', () async {
332+
runInTestbed('handles lack of base path in index.html', () async {
333333
const String htmlContent = '<html><head></head><body id="test"></body></html>';
334334
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
335335
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -350,7 +350,7 @@ void main() {
350350
expect(webAssetServer.basePath, '');
351351
});
352352

353-
runTestbed('throws if base path is relative', () async {
353+
runInTestbed('throws if base path is relative', () async {
354354
const String htmlContent = '<html><head><base href="foo/bar/"></head><body id="test"></body></html>';
355355
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
356356
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -371,7 +371,7 @@ void main() {
371371
);
372372
});
373373

374-
runTestbed('throws if base path does not end with slash', () async {
374+
runInTestbed('throws if base path does not end with slash', () async {
375375
const String htmlContent = '<html><head><base href="/foo/bar"></head><body id="test"></body></html>';
376376
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
377377
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -392,7 +392,7 @@ void main() {
392392
);
393393
});
394394

395-
runTestbed('serves JavaScript files from memory cache not from manifest', () async {
395+
runInTestbed('serves JavaScript files from memory cache not from manifest', () async {
396396
webAssetServer.writeFile('foo.js', 'main() {}');
397397

398398
final Response response = await webAssetServer.handleRequest(
@@ -408,7 +408,7 @@ void main() {
408408
expect((await response.read().toList()).first, utf8.encode('main() {}'));
409409
});
410410

411-
runTestbed('Returns notModified when the ifNoneMatch header matches the etag', () async {
411+
runInTestbed('Returns notModified when the ifNoneMatch header matches the etag', () async {
412412
webAssetServer.writeFile('foo.js', 'main() {}');
413413

414414
final Response response = await webAssetServer.handleRequest(
@@ -425,7 +425,7 @@ void main() {
425425
expect(await cachedResponse.read().toList(), isEmpty);
426426
});
427427

428-
runTestbed('serves index.html when path is unknown', () async {
428+
runInTestbed('serves index.html when path is unknown', () async {
429429
const String htmlContent = '<html><head></head><body id="test"></body></html>';
430430
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
431431
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -445,7 +445,7 @@ void main() {
445445
expect(await response.readAsString(), htmlContent);
446446
});
447447

448-
runTestbed('does not serve outside the base path', () async {
448+
runInTestbed('does not serve outside the base path', () async {
449449
webAssetServer.basePath = 'base/path';
450450

451451
const String htmlContent ='<html><head></head><body id="test"></body></html>';
@@ -459,7 +459,7 @@ void main() {
459459
expect(response.statusCode, HttpStatus.notFound);
460460
});
461461

462-
runTestbed('does not serve index.html when path is inside assets or packages', () async {
462+
runInTestbed('does not serve index.html when path is inside assets or packages', () async {
463463
const String htmlContent = '<html><head></head><body id="test"></body></html>';
464464
final Directory webDir = globals.fs.currentDirectory.childDirectory('web')..createSync();
465465
webDir.childFile('index.html').writeAsStringSync(htmlContent);
@@ -487,7 +487,7 @@ void main() {
487487
expect(response.statusCode, HttpStatus.notFound);
488488
});
489489

490-
runTestbed('serves default index.html', () async {
490+
runInTestbed('serves default index.html', () async {
491491
final String flutterJsPath = globals.fs.path.join(
492492
globals.artifacts!.getHostArtifact(HostArtifact.flutterJsDirectory).path,
493493
'flutter.js',
@@ -507,7 +507,7 @@ void main() {
507507
);
508508
});
509509

510-
runTestbed('handles web server paths without .lib extension', () async {
510+
runInTestbed('handles web server paths without .lib extension', () async {
511511
final File source = globals.fs.file('source')
512512
..writeAsStringSync('main() {}');
513513
final File sourcemap = globals.fs.file('sourcemap')
@@ -531,7 +531,7 @@ void main() {
531531
expect(response.statusCode, HttpStatus.ok);
532532
});
533533

534-
runTestbed('serves JavaScript files from memory cache on Windows', () async {
534+
runInTestbed('serves JavaScript files from memory cache on Windows', () async {
535535
final File source = globals.fs.file('source')
536536
..writeAsStringSync('main() {}');
537537
final File sourcemap = globals.fs.file('sourcemap')
@@ -560,7 +560,7 @@ void main() {
560560
expect((await response.read().toList()).first, source.readAsBytesSync());
561561
}, overrides: <Type, Generator>{Platform: () => windows});
562562

563-
runTestbed('serves asset files from filesystem with url-encoded paths', () async {
563+
runInTestbed('serves asset files from filesystem with url-encoded paths', () async {
564564
final String path = globals.fs.path.join(
565565
'build',
566566
'flutter_assets',
@@ -582,7 +582,7 @@ void main() {
582582
expect((await response.read().toList()).first, source.readAsBytesSync());
583583
});
584584

585-
runTestbed('serves files from web directory', () async {
585+
runInTestbed('serves files from web directory', () async {
586586
final File source = globals.fs.file(globals.fs.path.join('web', 'foo.png'))
587587
..createSync(recursive: true)
588588
..writeAsBytesSync(kTransparentImage);
@@ -599,7 +599,7 @@ void main() {
599599
expect((await response.read().toList()).first, source.readAsBytesSync());
600600
});
601601

602-
runTestbed('serves asset files from filesystem with known mime type on Windows', () async {
602+
runInTestbed('serves asset files from filesystem with known mime type on Windows', () async {
603603
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo.png');
604604
final File source = globals.fs.file(path)
605605
..createSync(recursive: true)
@@ -617,7 +617,7 @@ void main() {
617617
expect((await response.read().toList()).first, source.readAsBytesSync());
618618
}, overrides: <Type, Generator>{Platform: () => windows});
619619

620-
runTestbed('serves Dart files from filesystem on Linux/macOS', () async {
620+
runInTestbed('serves Dart files from filesystem on Linux/macOS', () async {
621621
final File source = globals.fs.file('foo.dart').absolute
622622
..createSync(recursive: true)
623623
..writeAsStringSync('void main() {}');
@@ -633,7 +633,7 @@ void main() {
633633
expect((await response.read().toList()).first, source.readAsBytesSync());
634634
}, overrides: <Type, Generator>{Platform: () => linux});
635635

636-
runTestbed('serves asset files from filesystem with known mime type', () async {
636+
runInTestbed('serves asset files from filesystem with known mime type', () async {
637637
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo.png');
638638
final File source = globals.fs.file(path)
639639
..createSync(recursive: true)
@@ -650,7 +650,7 @@ void main() {
650650
expect((await response.read().toList()).first, source.readAsBytesSync());
651651
});
652652

653-
runTestbed('serves asset files from filesystem with known mime type and empty content', () async {
653+
runInTestbed('serves asset files from filesystem with known mime type and empty content', () async {
654654
final String path = globals.fs.path.join('web', 'foo.js');
655655
final File source = globals.fs.file(path)
656656
..createSync(recursive: true);
@@ -666,7 +666,7 @@ void main() {
666666
expect((await response.read().toList()).first, source.readAsBytesSync());
667667
});
668668

669-
runTestbed('serves asset files from filesystem with unknown mime type', () async {
669+
runInTestbed('serves asset files from filesystem with unknown mime type', () async {
670670
final String path = globals.fs.path.join('build', 'flutter_assets', 'foo');
671671
final File source = globals.fs.file(path)
672672
..createSync(recursive: true)
@@ -683,7 +683,7 @@ void main() {
683683
expect((await response.read().toList()).first, source.readAsBytesSync());
684684
});
685685

686-
runTestbed('serves valid etag header for asset files with non-ascii characters', () async {
686+
runInTestbed('serves valid etag header for asset files with non-ascii characters', () async {
687687
final String path = globals.fs.path.join('build', 'flutter_assets', 'fooπ');
688688
globals.fs.file(path)
689689
..createSync(recursive: true)
@@ -697,7 +697,7 @@ void main() {
697697
expect(etag.runes, everyElement(predicate((int char) => char < 255)));
698698
});
699699

700-
runTestbed('serves /packages/<package>/<path> files as if they were package:<package>/<path> uris', () async {
700+
runInTestbed('serves /packages/<package>/<path> files as if they were package:<package>/<path> uris', () async {
701701
final String path = globals.fs.path.fromUri(
702702
packages.resolve(Uri.parse('package:flutter_tools/foo.dart')),
703703
);
@@ -716,12 +716,12 @@ void main() {
716716
expect((await response.read().toList()).first, source.readAsBytesSync());
717717
});
718718

719-
runTestbed('calling dispose closes the HTTP server', () async {
719+
runInTestbed('calling dispose closes the HTTP server', () async {
720720
await webAssetServer.dispose();
721721
expect(httpServer.closed, true);
722722
});
723723

724-
runTestbed('Can start web server with specified DDC module system assets', () async {
724+
runInTestbed('Can start web server with specified DDC module system assets', () async {
725725
final String path = globals.fs.path.join('lib', 'main.dart');
726726
final File outputFile = globals.fs.file(path)
727727
..createSync(recursive: true);
@@ -845,7 +845,7 @@ void main() {
845845
await webDevFS.destroy();
846846
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
847847

848-
runTestbed('Can start web server with specified assets in sound null safety mode', () async {
848+
runInTestbed('Can start web server with specified assets in sound null safety mode', () async {
849849
final String path = globals.fs.path.join('lib', 'main.dart');
850850
final File outputFile = globals.fs.file(path)
851851
..createSync(recursive: true);
@@ -967,7 +967,7 @@ void main() {
967967
await webDevFS.destroy();
968968
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
969969

970-
runTestbed('.connect() will never call vmServiceFactory twice', () async {
970+
runInTestbed('.connect() will never call vmServiceFactory twice', () async {
971971
await FakeAsync().run<Future<void>>((FakeAsync time) {
972972
final String path = globals.fs.path.join('lib', 'main.dart');
973973
final File outputFile = globals.fs.file(path)
@@ -1047,7 +1047,7 @@ void main() {
10471047
});
10481048
}, overrides: <Type, Generator>{Artifacts: Artifacts.test});
10491049

1050-
runTestbed('Can start web server with hostname any', () async {
1050+
runInTestbed('Can start web server with hostname any', () async {
10511051
final String path = globals.fs.path.join('lib', 'main.dart');
10521052
final File outputFile = globals.fs.file(path)
10531053
..createSync(recursive: true);
@@ -1091,7 +1091,7 @@ void main() {
10911091
await webDevFS.destroy();
10921092
});
10931093

1094-
runTestbed('Can start web server with canvaskit enabled', () async {
1094+
runInTestbed('Can start web server with canvaskit enabled', () async {
10951095
final String path = globals.fs.path.join('lib', 'main.dart');
10961096
final File outputFile = globals.fs.file(path)
10971097
..createSync(recursive: true);
@@ -1141,7 +1141,7 @@ void main() {
11411141
await webDevFS.destroy();
11421142
});
11431143

1144-
runTestbed('Can start web server with auto detect enabled', () async {
1144+
runInTestbed('Can start web server with auto detect enabled', () async {
11451145
final String path = globals.fs.path.join('lib', 'main.dart');
11461146
final File outputFile = globals.fs.file(path)
11471147
..createSync(recursive: true);
@@ -1191,7 +1191,7 @@ void main() {
11911191
await webDevFS.destroy();
11921192
});
11931193

1194-
runTestbed('Can start web server with tls connection', () async {
1194+
runInTestbed('Can start web server with tls connection', () async {
11951195
final String dataPath = globals.fs.path.join(
11961196
getFlutterRoot(),
11971197
'packages',
@@ -1316,21 +1316,21 @@ void main() {
13161316
await webAssetServer.dispose();
13171317
});
13181318

1319-
runTestbed('WebAssetServer responds to POST requests with 404 not found', () async {
1319+
runInTestbed('WebAssetServer responds to POST requests with 404 not found', () async {
13201320
final Response response = await webAssetServer.handleRequest(
13211321
Request('POST', Uri.parse('http://foobar/something')),
13221322
);
13231323
expect(response.statusCode, 404);
13241324
});
13251325

1326-
runTestbed('ReleaseAssetServer responds to POST requests with 404 not found', () async {
1326+
runInTestbed('ReleaseAssetServer responds to POST requests with 404 not found', () async {
13271327
final Response response = await releaseAssetServer.handle(
13281328
Request('POST', Uri.parse('http://foobar/something')),
13291329
);
13301330
expect(response.statusCode, 404);
13311331
});
13321332

1333-
runTestbed('WebAssetServer strips leading base href off of asset requests', () async {
1333+
runInTestbed('WebAssetServer strips leading base href off of asset requests', () async {
13341334
const String htmlContent = '<html><head><base href="/foo/"></head><body id="test"></body></html>';
13351335
globals.fs.currentDirectory.childDirectory('web').childFile('index.html')
13361336
..createSync(recursive: true)
@@ -1358,7 +1358,7 @@ void main() {
13581358
);
13591359
});
13601360

1361-
runTestbed('DevFS URI includes any specified base path.', () async {
1361+
runInTestbed('DevFS URI includes any specified base path.', () async {
13621362
final String path = globals.fs.path.join('lib', 'main.dart');
13631363
final File outputFile = globals.fs.file(path)
13641364
..createSync(recursive: true);

0 commit comments

Comments
 (0)