Skip to content

Commit e13b8c4

Browse files
[tool] Only run unit tests in Chrome for inline web (#4153)
Currently we are running Dart unit tests in Chrome for any plugin with web support, but it should only be necessary for plugins that have an inline web implementation, not for app-facing packages that endorse a web implementation.
1 parent 1057ab4 commit e13b8c4

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

packages/video_player/video_player/test/video_player_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,12 @@ void main() {
350350

351351
test('file with special characters', () async {
352352
final VideoPlayerController controller =
353-
VideoPlayerController.file(File('A #1 Hit?.avi'));
353+
VideoPlayerController.file(File('A #1 Hit.avi'));
354354
await controller.initialize();
355355

356356
final String uri = fakeVideoPlayerPlatform.dataSources[0].uri!;
357357
expect(uri.startsWith('file:///'), true, reason: 'Actual string: $uri');
358-
expect(uri.endsWith('/A%20%231%20Hit%3F.avi'), true,
358+
expect(uri.endsWith('/A%20%231%20Hit.avi'), true,
359359
reason: 'Actual string: $uri');
360360
}, skip: kIsWeb /* Web does not support file assets. */);
361361

script/configs/windows_unit_tests_exceptions.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,12 @@
1111
# Unit tests for plugins that support web currently run in
1212
# Chrome, which isn't currently supported by web infrastructure.
1313
# TODO(ditman): Fix this in the repo tooling.
14-
- camera
1514
- camera_web
16-
- file_selector
1715
- file_selector_web
18-
- google_maps_flutter
1916
- google_maps_flutter_web
20-
- google_sign_in
2117
- google_sign_in_web
22-
- image_picker
2318
- image_picker_for_web
24-
- shared_preferences
2519
- shared_preferences_web
26-
- url_launcher
2720
- url_launcher_web
28-
- video_player
2921
- video_player_web
3022
- webview_flutter_web

script/tool/lib/src/test_command.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class TestCommand extends PackageLoopingCommand {
6666
'--color',
6767
if (experiment.isNotEmpty) '--enable-experiment=$experiment',
6868
// TODO(ditman): Remove this once all plugins are migrated to 'drive'.
69-
if (pluginSupportsPlatform(platformWeb, package)) '--platform=chrome',
69+
if (pluginSupportsPlatform(platformWeb, package,
70+
requiredMode: PlatformSupport.inline))
71+
'--platform=chrome',
7072
],
7173
workingDir: package.directory,
7274
);

script/tool/test/test_command_test.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'mocks.dart';
1515
import 'util.dart';
1616

1717
void main() {
18-
group('$TestCommand', () {
18+
group('TestCommand', () {
1919
late FileSystem fileSystem;
2020
late Platform mockPlatform;
2121
late Directory packagesDir;
@@ -239,6 +239,27 @@ void main() {
239239
);
240240
});
241241

242+
test('Does not run on Chrome for web endorsements', () async {
243+
final RepositoryPackage plugin = createFakePlugin(
244+
'plugin',
245+
packagesDir,
246+
extraFiles: <String>['test/empty_test.dart'],
247+
platformSupport: <String, PlatformDetails>{
248+
platformWeb: const PlatformDetails(PlatformSupport.federated),
249+
},
250+
);
251+
252+
await runCapturingPrint(runner, <String>['test']);
253+
254+
expect(
255+
processRunner.recordedCalls,
256+
orderedEquals(<ProcessCall>[
257+
ProcessCall(getFlutterCommand(mockPlatform),
258+
const <String>['test', '--color'], plugin.path),
259+
]),
260+
);
261+
});
262+
242263
test('enable-experiment flag', () async {
243264
final RepositoryPackage plugin = createFakePlugin('a', packagesDir,
244265
extraFiles: <String>['test/empty_test.dart']);

0 commit comments

Comments
 (0)