Skip to content

[tool] Only run unit tests in Chrome for inline web #4153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,12 +350,12 @@ void main() {

test('file with special characters', () async {
final VideoPlayerController controller =
VideoPlayerController.file(File('A #1 Hit?.avi'));
VideoPlayerController.file(File('A #1 Hit.avi'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It turns out ? is an illegal character in a Windows filename, so this test didn't work on Windows. The test still validates URL escaping without the ? so I just removed it rather than conditionalize by platform.

await controller.initialize();

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

Expand Down
8 changes: 0 additions & 8 deletions script/configs/windows_unit_tests_exceptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,12 @@
# Unit tests for plugins that support web currently run in
# Chrome, which isn't currently supported by web infrastructure.
# TODO(ditman): Fix this in the repo tooling.
- camera
- camera_web
- file_selector
- file_selector_web
- google_maps_flutter
- google_maps_flutter_web
- google_sign_in
- google_sign_in_web
- image_picker
- image_picker_for_web
- shared_preferences
- shared_preferences_web
- url_launcher
- url_launcher_web
- video_player
- video_player_web
- webview_flutter_web
4 changes: 3 additions & 1 deletion script/tool/lib/src/test_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ class TestCommand extends PackageLoopingCommand {
'--color',
if (experiment.isNotEmpty) '--enable-experiment=$experiment',
// TODO(ditman): Remove this once all plugins are migrated to 'drive'.
if (pluginSupportsPlatform(platformWeb, package)) '--platform=chrome',
if (pluginSupportsPlatform(platformWeb, package,
requiredMode: PlatformSupport.inline))
'--platform=chrome',
],
workingDir: package.directory,
);
Expand Down
23 changes: 22 additions & 1 deletion script/tool/test/test_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'mocks.dart';
import 'util.dart';

void main() {
group('$TestCommand', () {
group('TestCommand', () {
late FileSystem fileSystem;
late Platform mockPlatform;
late Directory packagesDir;
Expand Down Expand Up @@ -239,6 +239,27 @@ void main() {
);
});

test('Does not run on Chrome for web endorsements', () async {
final RepositoryPackage plugin = createFakePlugin(
'plugin',
packagesDir,
extraFiles: <String>['test/empty_test.dart'],
platformSupport: <String, PlatformDetails>{
platformWeb: const PlatformDetails(PlatformSupport.federated),
},
);

await runCapturingPrint(runner, <String>['test']);

expect(
processRunner.recordedCalls,
orderedEquals(<ProcessCall>[
ProcessCall(getFlutterCommand(mockPlatform),
const <String>['test', '--color'], plugin.path),
]),
);
});

test('enable-experiment flag', () async {
final RepositoryPackage plugin = createFakePlugin('a', packagesDir,
extraFiles: <String>['test/empty_test.dart']);
Expand Down