mirror of
https://github.com/flutter/packages.git
synced 2025-08-24 11:39:26 +08:00
[video_player] Endorse macOS (#5021)
Endorses the macOS implementation of `video_player`, updating the constraint of the existing `video_player_avfoundation` dependency to ensure macOS support is present. Adds macOS support to the example, and adds macOS discussion to the README. This is the first macOS plugin with multiple integration test files, which turned up a bug in `flutter test`, so this also includes a repo tooling change to work around that bug for now by running each integration test file separately on macOS (as we already have to do with `flutter drive` on web). Fixes https://github.com/flutter/flutter/issues/41688
This commit is contained in:
@ -224,7 +224,8 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
chromedriver.kill();
|
||||
}
|
||||
} else {
|
||||
if (!await _runTests(example, deviceFlags: deviceFlags)) {
|
||||
if (!await _runTests(example,
|
||||
deviceFlags: deviceFlags, testFiles: testTargets)) {
|
||||
errors.add('Integration tests failed.');
|
||||
}
|
||||
}
|
||||
@ -395,19 +396,34 @@ class DriveExamplesCommand extends PackageLoopingCommand {
|
||||
Future<bool> _runTests(
|
||||
RepositoryPackage example, {
|
||||
required List<String> deviceFlags,
|
||||
required List<File> testFiles,
|
||||
}) async {
|
||||
final String enableExperiment = getStringArg(kEnableExperiment);
|
||||
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
'test',
|
||||
...deviceFlags,
|
||||
if (enableExperiment.isNotEmpty)
|
||||
'--enable-experiment=$enableExperiment',
|
||||
'integration_test',
|
||||
],
|
||||
workingDir: example.directory);
|
||||
return exitCode == 0;
|
||||
// Workaround for https://github.com/flutter/flutter/issues/135673
|
||||
// Once that is fixed on stable, this logic can be removed and the command
|
||||
// can always just be run with "integration_test".
|
||||
final bool needsMultipleInvocations =
|
||||
testFiles.length > 1 && getBoolArg(platformMacOS);
|
||||
final Iterable<String> individualRunTargets = needsMultipleInvocations
|
||||
? testFiles
|
||||
.map((File f) => getRelativePosixPath(f, from: example.directory))
|
||||
: <String>['integration_test'];
|
||||
|
||||
bool passed = true;
|
||||
for (final String target in individualRunTargets) {
|
||||
final int exitCode = await processRunner.runAndStream(
|
||||
flutterCommand,
|
||||
<String>[
|
||||
'test',
|
||||
...deviceFlags,
|
||||
if (enableExperiment.isNotEmpty)
|
||||
'--enable-experiment=$enableExperiment',
|
||||
target,
|
||||
],
|
||||
workingDir: example.directory);
|
||||
passed = passed && (exitCode == 0);
|
||||
}
|
||||
return passed;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user