flutter/packages/flutter_tools/test/general.shard/android
Andrew Kolos 295a9a2031
provide command to FakeCommand::onRun (#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff.

## Context
1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename.
2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question.

## Issue
In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched.

Example:
```dart
FakeCommand(
  command: <Pattern>[
    artifacts.getArtifactPath(Artifact.engineDartBinary),
    'run',
    'vector_graphics_compiler',
    RegExp(r'--input=/.*\.temp'),
    RegExp(r'--output=/.*\.temp'),
  ],
  onRun: (List<String> command) {
    final outputPath = (() { 
      // code to parse `--output` from `command`
    })();
    testFileSystem.file(outputPath).createSync(recursive: true);
  },
)
```
2024-01-25 07:51:25 +00:00
..
adb_log_reader_test.dart Remove outdated ignores from tool (#140467) 2023-12-20 22:14:32 +00:00
android_device_discovery_test.dart Separate attached and wireless devices (#122615) 2023-03-15 16:35:05 +00:00
android_device_port_forwarder_test.dart add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
android_device_start_test.dart Add --trace-to-file option to flutter run (#135713) 2023-10-12 13:23:52 -04:00
android_device_test.dart Make AndroidApk nullable in stopApp. (#113353) 2022-10-13 17:03:57 +00:00
android_emulator_test.dart add missing trailing commas in list/set/map literals (#102585) 2022-04-27 09:15:35 +02:00
android_gradle_builder_test.dart provide command to FakeCommand::onRun (#142206) 2024-01-25 07:51:25 +00:00
android_install_test.dart [tool] Install the corresponding APK in flutter run (#113622) 2022-10-19 02:44:30 +00:00
android_project_migration_test.dart [Android] Support Android 34 (take 2) (#137967) 2023-11-09 22:40:15 +00:00
android_sdk_test.dart Native assets support for Android (#135148) 2023-12-07 16:29:11 +00:00
android_studio_test.dart Fixed few typos (#141543) 2024-01-16 21:40:08 +00:00
android_studio_validator_test.dart [tool] In flutter doctor -v, warn when Android Studio version could not be detected. (#126395) 2023-06-01 14:51:30 +00:00
android_workflow_test.dart In flutter doctor -v, when JRE is too out-of-date to run sdkmanager, print a helpful error message (#138762) 2023-11-21 23:16:08 +00:00
build_validation_test.dart Migrate more tool unit tests to null safety (#80002) 2021-04-08 15:18:52 -07:00
deferred_components_gen_snapshot_validator_test.dart Revert "Speed up first asset load by encoding asset manifest in binary rather than JSON (#113637)" (#116662) 2022-12-07 17:29:05 +00:00
deferred_components_prebuild_validator_test.dart Fix typos (#121171) 2023-02-23 19:43:21 +00:00
gradle_errors_test.dart Makes the flutter tool retry on a bad gateway network error from gradle (#140670) 2023-12-27 20:13:36 +00:00
gradle_find_bundle_test.dart [Android] Bump template & integration test Gradle version to 7.6.4 (#139276) 2023-12-07 18:31:20 +00:00
gradle_test.dart Stop recommending android sdk root (#136296) 2023-10-11 21:04:59 +00:00
gradle_utils_test.dart Fixed few typos (#141543) 2024-01-16 21:40:08 +00:00
java_test.dart have Java.version return null if java --version fails or cannot be run (#139614) 2023-12-06 23:13:17 +00:00
multidex_test.dart [flutter_tools] migrate more unit tests to null safety (#106153) 2022-06-17 21:34:27 -07:00
native_assets_test.dart Reapply "Native assets: roll deps" (#141748) (#141864) 2024-01-22 10:42:15 +00:00
template_test.dart Adding 'is' to list of kotlin reserved keywords (#116299) 2023-01-06 00:10:07 +00:00