OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """ | 6 """ |
7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). | 7 Unit tests for the contents of device_utils.py (mostly DeviceUtils). |
8 """ | 8 """ |
9 | 9 |
10 # pylint: disable=C0321 | 10 # pylint: disable=C0321 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 self.call.adb.Reboot(), | 450 self.call.adb.Reboot(), |
451 (self.call.device.IsOnline(), True), | 451 (self.call.device.IsOnline(), True), |
452 (self.call.device.IsOnline(), False)): | 452 (self.call.device.IsOnline(), False)): |
453 self.device.Reboot(block=False) | 453 self.device.Reboot(block=False) |
454 | 454 |
455 def testReboot_blocking(self): | 455 def testReboot_blocking(self): |
456 with self.assertCalls( | 456 with self.assertCalls( |
457 self.call.adb.Reboot(), | 457 self.call.adb.Reboot(), |
458 (self.call.device.IsOnline(), True), | 458 (self.call.device.IsOnline(), True), |
459 (self.call.device.IsOnline(), False), | 459 (self.call.device.IsOnline(), False), |
460 self.call.device.WaitUntilFullyBooted()): | 460 self.call.device.WaitUntilFullyBooted(wifi=False)): |
461 self.device.Reboot(block=True) | 461 self.device.Reboot(block=True) |
462 | 462 |
| 463 def testReboot_blockUntilWifi(self): |
| 464 with self.assertCalls( |
| 465 self.call.adb.Reboot(), |
| 466 (self.call.device.IsOnline(), True), |
| 467 (self.call.device.IsOnline(), False), |
| 468 self.call.device.WaitUntilFullyBooted(wifi=True)): |
| 469 self.device.Reboot(block=True, wifi=True) |
| 470 |
463 | 471 |
464 class DeviceUtilsInstallTest(DeviceUtilsNewImplTest): | 472 class DeviceUtilsInstallTest(DeviceUtilsNewImplTest): |
465 | 473 |
466 def testInstall_noPriorInstall(self): | 474 def testInstall_noPriorInstall(self): |
467 with self.assertCalls( | 475 with self.assertCalls( |
468 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 476 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
469 'this.is.a.test.package'), | 477 'this.is.a.test.package'), |
470 (self.call.device.GetApplicationPath('this.is.a.test.package'), None), | 478 (self.call.device.GetApplicationPath('this.is.a.test.package'), None), |
471 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): | 479 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): |
472 self.device.Install('/fake/test/app.apk', retries=0) | 480 self.device.Install('/fake/test/app.apk', retries=0) |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 self.assertTrue( | 1492 self.assertTrue( |
1485 isinstance(device, device_utils.DeviceUtils) | 1493 isinstance(device, device_utils.DeviceUtils) |
1486 and serial == str(device), | 1494 and serial == str(device), |
1487 'Expected a DeviceUtils object with serial %s' % serial) | 1495 'Expected a DeviceUtils object with serial %s' % serial) |
1488 | 1496 |
1489 | 1497 |
1490 if __name__ == '__main__': | 1498 if __name__ == '__main__': |
1491 logging.getLogger().setLevel(logging.DEBUG) | 1499 logging.getLogger().setLevel(logging.DEBUG) |
1492 unittest.main(verbosity=2) | 1500 unittest.main(verbosity=2) |
1493 | 1501 |
OLD | NEW |