From 986fd1436314313b99c637ac7070244a76de4a66 Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Tue, 7 Jan 2025 10:11:29 -0800 Subject: [PATCH] Fold `_FlutterTestRunnerImpl` into `FlutterTestRunner`. (#161188) Closes https://github.com/flutter/flutter/issues/160461. This pattern is covered by `interface class { ... }` in modern Dart. See . --- .../flutter_tools/lib/src/test/runner.dart | 76 ++----------------- 1 file changed, 5 insertions(+), 71 deletions(-) diff --git a/packages/flutter_tools/lib/src/test/runner.dart b/packages/flutter_tools/lib/src/test/runner.dart index 9a4d0c86d8..49f9d5846c 100644 --- a/packages/flutter_tools/lib/src/test/runner.dart +++ b/packages/flutter_tools/lib/src/test/runner.dart @@ -26,78 +26,11 @@ import 'test_wrapper.dart'; import 'watcher.dart'; import 'web_test_compiler.dart'; -/// A class that abstracts launching the test process from the test runner. -abstract class FlutterTestRunner { - const factory FlutterTestRunner() = _FlutterTestRunnerImpl; +/// Launching the `flutter_tester` process from the test runner. +interface class FlutterTestRunner { + const FlutterTestRunner(); /// Runs tests using package:test and the Flutter engine. - Future runTests( - TestWrapper testWrapper, - List testFiles, { - required DebuggingOptions debuggingOptions, - List names = const [], - List plainNames = const [], - String? tags, - String? excludeTags, - bool enableVmService = false, - bool machine = false, - String? precompiledDillPath, - Map? precompiledDillFiles, - bool updateGoldens = false, - TestWatcher? watcher, - required int? concurrency, - String? testAssetDirectory, - FlutterProject? flutterProject, - String? icudtlPath, - Directory? coverageDirectory, - bool web = false, - String? randomSeed, - String? reporter, - String? fileReporter, - String? timeout, - bool failFast = false, - bool runSkipped = false, - int? shardIndex, - int? totalShards, - Device? integrationTestDevice, - String? integrationTestUserIdentifier, - TestTimeRecorder? testTimeRecorder, - TestCompilerNativeAssetsBuilder? nativeAssetsBuilder, - required BuildInfo buildInfo, - }); - - /// Runs tests using the experimental strategy of spawning each test in a - /// separate lightweight Engine. - Future runTestsBySpawningLightweightEngines( - List testFiles, { - required DebuggingOptions debuggingOptions, - List names = const [], - List plainNames = const [], - String? tags, - String? excludeTags, - bool machine = false, - bool updateGoldens = false, - required int? concurrency, - String? testAssetDirectory, - FlutterProject? flutterProject, - String? icudtlPath, - String? randomSeed, - String? reporter, - String? fileReporter, - String? timeout, - bool failFast = false, - bool runSkipped = false, - int? shardIndex, - int? totalShards, - TestTimeRecorder? testTimeRecorder, - TestCompilerNativeAssetsBuilder? nativeAssetsBuilder, - }); -} - -class _FlutterTestRunnerImpl implements FlutterTestRunner { - const _FlutterTestRunnerImpl(); - - @override Future runTests( TestWrapper testWrapper, List testFiles, { @@ -637,7 +570,8 @@ class SpawnPlugin extends PlatformPlugin { testTimeRecorder?.stop(TestTimePhases.Compile, testTimeRecorderStopwatch!); } - @override + /// Runs tests using the experimental strategy of spawning each test in a + /// separate lightweight Engine. Future runTestsBySpawningLightweightEngines( List testFiles, { required DebuggingOptions debuggingOptions,