Fold _FlutterTestRunnerImpl into FlutterTestRunner. (#161188)

Closes https://github.com/flutter/flutter/issues/160461.

This pattern is covered by `interface class { ... }` in modern Dart.

See <https://dart.dev/language/class-modifiers#interface>.
This commit is contained in:
Matan Lurey
2025-01-07 10:11:29 -08:00
committed by GitHub
parent f3d2204827
commit 986fd14363

View File

@@ -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<int> runTests(
TestWrapper testWrapper,
List<Uri> testFiles, {
required DebuggingOptions debuggingOptions,
List<String> names = const <String>[],
List<String> plainNames = const <String>[],
String? tags,
String? excludeTags,
bool enableVmService = false,
bool machine = false,
String? precompiledDillPath,
Map<String, String>? 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<int> runTestsBySpawningLightweightEngines(
List<Uri> testFiles, {
required DebuggingOptions debuggingOptions,
List<String> names = const <String>[],
List<String> plainNames = const <String>[],
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<int> runTests(
TestWrapper testWrapper,
List<Uri> 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<int> runTestsBySpawningLightweightEngines(
List<Uri> testFiles, {
required DebuggingOptions debuggingOptions,