[devicelab] reboot attached devices after 30 test runs (#69447)

This commit is contained in:
Jonah Williams
2020-11-03 10:10:55 -08:00
committed by GitHub
parent 059cd3185c
commit 406ca0bc59
2 changed files with 77 additions and 43 deletions

View File

@@ -131,6 +131,9 @@ abstract class Device {
/// Assumes the device doesn't have a secure unlock pattern.
Future<void> unlock();
/// Attempt to reboot the phone.
Future<void> reboot();
/// Emulate a tap on the touch screen.
Future<void> tap(int x, int y);
@@ -575,6 +578,11 @@ class AndroidDevice extends Device {
String toString() {
return '$deviceId $deviceInfo';
}
@override
Future<void> reboot() {
return adb(<String>['reboot']);
}
}
class IosDeviceDiscovery implements DeviceDiscovery {
@@ -740,6 +748,11 @@ class IosDevice extends Device {
@override
Future<void> stop(String packageName) async {}
@override
Future<void> reboot() {
return Process.run('idevicesyslog', <String>['reboot', '-u', deviceId]);
}
}
/// Fuchsia device.
@@ -783,6 +796,11 @@ class FuchsiaDevice extends Device {
Stream<String> get logcat {
throw UnimplementedError();
}
@override
Future<void> reboot() async {
// Unsupported.
}
}
/// Path to the `adb` executable.
@@ -846,6 +864,11 @@ class FakeDevice extends Device {
@override
Future<void> stop(String packageName) async {}
@override
Future<void> reboot() async {
// Unsupported.
}
}
class FakeDeviceDiscovery implements DeviceDiscovery {