Pass along web renderer into debugging options in the test command. (#143128)

We need to pass along the web renderer in the debugging options to make sure that the resident web runner sets up the targets correctly.
This commit is contained in:
Jackson Gardner 2024-02-07 17:21:07 -08:00 committed by GitHub
parent b586bd9188
commit 71c6cd0cb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import '../test/runner.dart';
import '../test/test_time_recorder.dart';
import '../test/test_wrapper.dart';
import '../test/watcher.dart';
import '../web/compile.dart';
/// The name of the directory where Integration Tests are placed.
///
@ -353,6 +354,10 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
);
}
final String? webRendererString = stringArg('web-renderer');
final WebRendererMode webRenderer = (webRendererString != null)
? WebRendererMode.values.byName(webRendererString)
: WebRendererMode.auto;
final DebuggingOptions debuggingOptions = DebuggingOptions.enabled(
buildInfo,
startPaused: startPaused,
@ -365,6 +370,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
usingCISystem: usingCISystem,
enableImpeller: ImpellerStatus.fromBool(argResults!['enable-impeller'] as bool?),
debugLogsDirectoryPath: debugLogsDirectoryPath,
webRenderer: webRenderer,
);
String? testAssetDirectory;

View file

@ -22,6 +22,7 @@ import 'package:flutter_tools/src/test/test_device.dart';
import 'package:flutter_tools/src/test/test_time_recorder.dart';
import 'package:flutter_tools/src/test/test_wrapper.dart';
import 'package:flutter_tools/src/test/watcher.dart';
import 'package:flutter_tools/src/web/compile.dart';
import 'package:stream_channel/stream_channel.dart';
import 'package:vm_service/vm_service.dart';
@ -1057,6 +1058,24 @@ dev_dependencies:
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('Passes web renderer into debugging options', () async {
final FakeFlutterTestRunner testRunner = FakeFlutterTestRunner(0);
final TestCommand testCommand = TestCommand(testRunner: testRunner);
final CommandRunner<void> commandRunner = createTestCommandRunner(testCommand);
await commandRunner.run(const <String>[
'test',
'--no-pub',
'--platform=chrome',
'--web-renderer=canvaskit',
]);
expect(testRunner.lastDebuggingOptionsValue.webRenderer, WebRendererMode.canvaskit);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
});
});
}