[flutter_tools] add --uninstall-first flag and pipe it through to ios-deploy (#102948)

This commit is contained in:
Christopher Fujino
2022-05-07 11:49:07 -07:00
committed by GitHub
parent 4bed76757d
commit 09686a04c9
7 changed files with 73 additions and 2 deletions

View File

@@ -369,6 +369,42 @@ void main() {
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
});
testUsingContext('forwards --uninstall-only to DebuggingOptions', () async {
final RunCommand command = RunCommand();
final FakeDevice mockDevice = FakeDevice(
sdkNameAndVersion: 'iOS 13',
)..startAppSuccess = false;
mockDeviceManager
..devices = <Device>[
mockDevice,
]
..targetDevices = <Device>[
mockDevice,
];
// Causes swift to be detected in the analytics.
fs.currentDirectory.childDirectory('ios').childFile('AppDelegate.swift').createSync(recursive: true);
await expectToolExitLater(createTestCommandRunner(command).run(<String>[
'run',
'--no-pub',
'--no-hot',
'--uninstall-first',
]), isNull);
final DebuggingOptions options = await command.createDebuggingOptions(false);
expect(options.uninstallFirst, isTrue);
}, overrides: <Type, Generator>{
Artifacts: () => artifacts,
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
DeviceManager: () => mockDeviceManager,
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
Usage: () => usage,
});
testUsingContext('passes device target platform to usage', () async {
final RunCommand command = RunCommand();
final FakeDevice mockDevice = FakeDevice(sdkNameAndVersion: 'iOS 13')
@@ -407,7 +443,7 @@ void main() {
Usage: () => usage,
});
group('--machine', () {
group('--machine', () {
testUsingContext('enables multidex by default', () async {
final DaemonCapturingRunCommand command = DaemonCapturingRunCommand();
final FakeDevice device = FakeDevice();

View File

@@ -53,6 +53,7 @@ void main () {
'/',
'--app_deltas',
'app-delta',
'--uninstall',
'--debug',
'--args',
<String>[
@@ -73,6 +74,7 @@ void main () {
appDeltaDirectory: appDeltaDirectory,
launchArguments: <String>['--enable-dart-profiling'],
interfaceType: IOSDeviceConnectionInterface.network,
uninstallFirst: true,
);
expect(iosDeployDebugger.logLines, emits('Did finish launching.'));