Expose enable-experiment in Flutter drive (#66311)

This commit is contained in:
Emmanuel Garcia
2020-09-23 10:38:02 -07:00
committed by GitHub
parent 1a9ea39ad7
commit fc1e764264
3 changed files with 102 additions and 5 deletions

View File

@@ -205,7 +205,7 @@ void main() {
return LaunchResult.succeeded();
});
testRunner = expectAsync2((List<String> testArgs, Map<String, String> environment) async {
expect(testArgs, <String>[testFile]);
expect(testArgs, <String>['--no-sound-null-safety', testFile]);
// VM_SERVICE_URL is not set by drive command arguments
expect(environment, <String, String>{
'VM_SERVICE_URL': 'null',
@@ -273,6 +273,90 @@ void main() {
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('enable experiment', () async {
final MockAndroidDevice mockDevice = MockAndroidDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
final String testApp = globals.fs.path.join(tempDir.path, 'test', 'e2e.dart');
final String testFile = globals.fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
appStarter = expectAsync2((DriveCommand command, Uri webUri) async {
return LaunchResult.succeeded();
});
testRunner = expectAsync2((List<String> testArgs, Map<String, String> environment) async {
expect(
testArgs,
<String>[
'--enable-experiment=experiment1,experiment2',
'--no-sound-null-safety',
testFile,
]
);
});
appStopper = expectAsync1((DriveCommand command) async {
return true;
});
final MemoryFileSystem memFs = fs;
await memFs.file(testApp).writeAsString('main() {}');
await memFs.file(testFile).writeAsString('main() {}');
final List<String> args = <String>[
'drive',
'--target=$testApp',
'--no-pub',
'--enable-experiment=experiment1',
'--enable-experiment=experiment2',
];
await createTestCommandRunner(command).run(args);
expect(testLogger.errorText, isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
});
testUsingContext('sound null safety', () async {
final MockAndroidDevice mockDevice = MockAndroidDevice();
applyDdsMocks(mockDevice);
testDeviceManager.addDevice(mockDevice);
final String testApp = globals.fs.path.join(tempDir.path, 'test', 'e2e.dart');
final String testFile = globals.fs.path.join(tempDir.path, 'test_driver', 'e2e_test.dart');
appStarter = expectAsync2((DriveCommand command, Uri webUri) async {
return LaunchResult.succeeded();
});
testRunner = expectAsync2((List<String> testArgs, Map<String, String> environment) async {
expect(
testArgs,
<String>[
'--sound-null-safety',
testFile,
]
);
});
appStopper = expectAsync1((DriveCommand command) async {
return true;
});
final MemoryFileSystem memFs = fs;
await memFs.file(testApp).writeAsString('main() {}');
await memFs.file(testFile).writeAsString('main() {}');
final List<String> args = <String>[
'drive',
'--target=$testApp',
'--no-pub',
'--sound-null-safety',
];
await createTestCommandRunner(command).run(args);
expect(testLogger.errorText, isEmpty);
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
});
group('findTargetDevice', () {
testUsingContext('uses specified device', () async {
testDeviceManager.specifiedDeviceId = '123';