[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:
stuartmorgan
2023-09-28 14:17:33 -07:00
committed by GitHub
parent 9f3005cc74
commit d0e9a0e1b3
32 changed files with 1469 additions and 31 deletions

View File

@ -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;
}
}