| 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 self.call.adb.Shell('echo $EXTERNAL_STORAGE'), '/fake/storage/path\n'): | 297 self.call.adb.Shell('echo $EXTERNAL_STORAGE'), '/fake/storage/path\n'): |
| 298 self.assertEquals('/fake/storage/path', | 298 self.assertEquals('/fake/storage/path', |
| 299 self.device.GetExternalStoragePath()) | 299 self.device.GetExternalStoragePath()) |
| 300 | 300 |
| 301 def testGetExternalStoragePath_fails(self): | 301 def testGetExternalStoragePath_fails(self): |
| 302 with self.assertCall(self.call.adb.Shell('echo $EXTERNAL_STORAGE'), '\n'): | 302 with self.assertCall(self.call.adb.Shell('echo $EXTERNAL_STORAGE'), '\n'): |
| 303 with self.assertRaises(device_errors.CommandFailedError): | 303 with self.assertRaises(device_errors.CommandFailedError): |
| 304 self.device.GetExternalStoragePath() | 304 self.device.GetExternalStoragePath() |
| 305 | 305 |
| 306 | 306 |
| 307 class DeviceUtilsGetApplicationPathTest(DeviceUtilsTest): | 307 class DeviceUtilsGetApplicationPathsTest(DeviceUtilsTest): |
| 308 | 308 |
| 309 def testGetApplicationPath_exists(self): | 309 def testGetApplicationPaths_exists(self): |
| 310 with self.assertCalls( | 310 with self.assertCalls( |
| 311 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), | 311 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), |
| 312 (self.call.adb.Shell('pm path android'), | 312 (self.call.adb.Shell('pm path android'), |
| 313 'package:/path/to/android.apk\n')): | 313 'package:/path/to/android.apk\n')): |
| 314 self.assertEquals('/path/to/android.apk', | 314 self.assertEquals(['/path/to/android.apk'], |
| 315 self.device.GetApplicationPath('android')) | 315 self.device.GetApplicationPaths('android')) |
| 316 | 316 |
| 317 def testGetApplicationPath_notExists(self): | 317 def testGetApplicationPaths_notExists(self): |
| 318 with self.assertCalls( | 318 with self.assertCalls( |
| 319 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), | 319 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), |
| 320 (self.call.adb.Shell('pm path not.installed.app'), '')): | 320 (self.call.adb.Shell('pm path not.installed.app'), '')): |
| 321 self.assertEquals(None, | 321 self.assertEquals(None, |
| 322 self.device.GetApplicationPath('not.installed.app')) | 322 self.device.GetApplicationPaths('not.installed.app')) |
| 323 | 323 |
| 324 def testGetApplicationPath_fails(self): | 324 def testGetApplicationPaths_fails(self): |
| 325 with self.assertCalls( | 325 with self.assertCalls( |
| 326 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), | 326 (self.call.adb.Shell('getprop ro.build.version.sdk'), '19\n'), |
| 327 (self.call.adb.Shell('pm path android'), | 327 (self.call.adb.Shell('pm path android'), |
| 328 self.CommandError('ERROR. Is package manager running?\n'))): | 328 self.CommandError('ERROR. Is package manager running?\n'))): |
| 329 with self.assertRaises(device_errors.CommandFailedError): | 329 with self.assertRaises(device_errors.CommandFailedError): |
| 330 self.device.GetApplicationPath('android') | 330 self.device.GetApplicationPaths('android') |
| 331 | 331 |
| 332 | 332 |
| 333 @mock.patch('time.sleep', mock.Mock()) | 333 @mock.patch('time.sleep', mock.Mock()) |
| 334 class DeviceUtilsWaitUntilFullyBootedTest(DeviceUtilsTest): | 334 class DeviceUtilsWaitUntilFullyBootedTest(DeviceUtilsTest): |
| 335 | 335 |
| 336 def testWaitUntilFullyBooted_succeedsNoWifi(self): | 336 def testWaitUntilFullyBooted_succeedsNoWifi(self): |
| 337 with self.assertCalls( | 337 with self.assertCalls( |
| 338 self.call.adb.WaitForDevice(), | 338 self.call.adb.WaitForDevice(), |
| 339 # sd_card_ready | 339 # sd_card_ready |
| 340 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), | 340 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), |
| 341 (self.call.adb.Shell('test -d /fake/storage/path'), ''), | 341 (self.call.adb.Shell('test -d /fake/storage/path'), ''), |
| 342 # pm_ready | 342 # pm_ready |
| 343 (self.call.device.GetApplicationPath('android'), | 343 (self.call.device.GetApplicationPaths('android'), |
| 344 'package:/some/fake/path'), | 344 ['package:/some/fake/path']), |
| 345 # boot_completed | 345 # boot_completed |
| 346 (self.call.device.GetProp('sys.boot_completed'), '1')): | 346 (self.call.device.GetProp('sys.boot_completed'), '1')): |
| 347 self.device.WaitUntilFullyBooted(wifi=False) | 347 self.device.WaitUntilFullyBooted(wifi=False) |
| 348 | 348 |
| 349 def testWaitUntilFullyBooted_succeedsWithWifi(self): | 349 def testWaitUntilFullyBooted_succeedsWithWifi(self): |
| 350 with self.assertCalls( | 350 with self.assertCalls( |
| 351 self.call.adb.WaitForDevice(), | 351 self.call.adb.WaitForDevice(), |
| 352 # sd_card_ready | 352 # sd_card_ready |
| 353 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), | 353 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), |
| 354 (self.call.adb.Shell('test -d /fake/storage/path'), ''), | 354 (self.call.adb.Shell('test -d /fake/storage/path'), ''), |
| 355 # pm_ready | 355 # pm_ready |
| 356 (self.call.device.GetApplicationPath('android'), | 356 (self.call.device.GetApplicationPaths('android'), |
| 357 'package:/some/fake/path'), | 357 ['package:/some/fake/path']), |
| 358 # boot_completed | 358 # boot_completed |
| 359 (self.call.device.GetProp('sys.boot_completed'), '1'), | 359 (self.call.device.GetProp('sys.boot_completed'), '1'), |
| 360 # wifi_enabled | 360 # wifi_enabled |
| 361 (self.call.adb.Shell('dumpsys wifi'), | 361 (self.call.adb.Shell('dumpsys wifi'), |
| 362 'stuff\nWi-Fi is enabled\nmore stuff\n')): | 362 'stuff\nWi-Fi is enabled\nmore stuff\n')): |
| 363 self.device.WaitUntilFullyBooted(wifi=True) | 363 self.device.WaitUntilFullyBooted(wifi=True) |
| 364 | 364 |
| 365 def testWaitUntilFullyBooted_sdCardReadyFails_noPath(self): | 365 def testWaitUntilFullyBooted_sdCardReadyFails_noPath(self): |
| 366 with self.assertCalls( | 366 with self.assertCalls( |
| 367 self.call.adb.WaitForDevice(), | 367 self.call.adb.WaitForDevice(), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 386 with self.assertRaises(device_errors.CommandTimeoutError): | 386 with self.assertRaises(device_errors.CommandTimeoutError): |
| 387 self.device.WaitUntilFullyBooted(wifi=False) | 387 self.device.WaitUntilFullyBooted(wifi=False) |
| 388 | 388 |
| 389 def testWaitUntilFullyBooted_devicePmFails(self): | 389 def testWaitUntilFullyBooted_devicePmFails(self): |
| 390 with self.assertCalls( | 390 with self.assertCalls( |
| 391 self.call.adb.WaitForDevice(), | 391 self.call.adb.WaitForDevice(), |
| 392 # sd_card_ready | 392 # sd_card_ready |
| 393 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), | 393 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), |
| 394 (self.call.adb.Shell('test -d /fake/storage/path'), ''), | 394 (self.call.adb.Shell('test -d /fake/storage/path'), ''), |
| 395 # pm_ready | 395 # pm_ready |
| 396 (self.call.device.GetApplicationPath('android'), self.CommandError()), | 396 (self.call.device.GetApplicationPaths('android'), self.CommandError()), |
| 397 # pm_ready | 397 # pm_ready |
| 398 (self.call.device.GetApplicationPath('android'), self.CommandError()), | 398 (self.call.device.GetApplicationPaths('android'), self.CommandError()), |
| 399 # pm_ready | 399 # pm_ready |
| 400 (self.call.device.GetApplicationPath('android'), self.TimeoutError())): | 400 (self.call.device.GetApplicationPaths('android'), self.TimeoutError())): |
| 401 with self.assertRaises(device_errors.CommandTimeoutError): | 401 with self.assertRaises(device_errors.CommandTimeoutError): |
| 402 self.device.WaitUntilFullyBooted(wifi=False) | 402 self.device.WaitUntilFullyBooted(wifi=False) |
| 403 | 403 |
| 404 def testWaitUntilFullyBooted_bootFails(self): | 404 def testWaitUntilFullyBooted_bootFails(self): |
| 405 with self.assertCalls( | 405 with self.assertCalls( |
| 406 self.call.adb.WaitForDevice(), | 406 self.call.adb.WaitForDevice(), |
| 407 # sd_card_ready | 407 # sd_card_ready |
| 408 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), | 408 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), |
| 409 (self.call.adb.Shell('test -d /fake/storage/path'), ''), | 409 (self.call.adb.Shell('test -d /fake/storage/path'), ''), |
| 410 # pm_ready | 410 # pm_ready |
| 411 (self.call.device.GetApplicationPath('android'), | 411 (self.call.device.GetApplicationPaths('android'), |
| 412 'package:/some/fake/path'), | 412 ['package:/some/fake/path']), |
| 413 # boot_completed | 413 # boot_completed |
| 414 (self.call.device.GetProp('sys.boot_completed'), '0'), | 414 (self.call.device.GetProp('sys.boot_completed'), '0'), |
| 415 # boot_completed | 415 # boot_completed |
| 416 (self.call.device.GetProp('sys.boot_completed'), '0'), | 416 (self.call.device.GetProp('sys.boot_completed'), '0'), |
| 417 # boot_completed | 417 # boot_completed |
| 418 (self.call.device.GetProp('sys.boot_completed'), self.TimeoutError())): | 418 (self.call.device.GetProp('sys.boot_completed'), self.TimeoutError())): |
| 419 with self.assertRaises(device_errors.CommandTimeoutError): | 419 with self.assertRaises(device_errors.CommandTimeoutError): |
| 420 self.device.WaitUntilFullyBooted(wifi=False) | 420 self.device.WaitUntilFullyBooted(wifi=False) |
| 421 | 421 |
| 422 def testWaitUntilFullyBooted_wifiFails(self): | 422 def testWaitUntilFullyBooted_wifiFails(self): |
| 423 with self.assertCalls( | 423 with self.assertCalls( |
| 424 self.call.adb.WaitForDevice(), | 424 self.call.adb.WaitForDevice(), |
| 425 # sd_card_ready | 425 # sd_card_ready |
| 426 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), | 426 (self.call.device.GetExternalStoragePath(), '/fake/storage/path'), |
| 427 (self.call.adb.Shell('test -d /fake/storage/path'), ''), | 427 (self.call.adb.Shell('test -d /fake/storage/path'), ''), |
| 428 # pm_ready | 428 # pm_ready |
| 429 (self.call.device.GetApplicationPath('android'), | 429 (self.call.device.GetApplicationPaths('android'), |
| 430 'package:/some/fake/path'), | 430 ['package:/some/fake/path']), |
| 431 # boot_completed | 431 # boot_completed |
| 432 (self.call.device.GetProp('sys.boot_completed'), '1'), | 432 (self.call.device.GetProp('sys.boot_completed'), '1'), |
| 433 # wifi_enabled | 433 # wifi_enabled |
| 434 (self.call.adb.Shell('dumpsys wifi'), 'stuff\nmore stuff\n'), | 434 (self.call.adb.Shell('dumpsys wifi'), 'stuff\nmore stuff\n'), |
| 435 # wifi_enabled | 435 # wifi_enabled |
| 436 (self.call.adb.Shell('dumpsys wifi'), 'stuff\nmore stuff\n'), | 436 (self.call.adb.Shell('dumpsys wifi'), 'stuff\nmore stuff\n'), |
| 437 # wifi_enabled | 437 # wifi_enabled |
| 438 (self.call.adb.Shell('dumpsys wifi'), self.TimeoutError())): | 438 (self.call.adb.Shell('dumpsys wifi'), self.TimeoutError())): |
| 439 with self.assertRaises(device_errors.CommandTimeoutError): | 439 with self.assertRaises(device_errors.CommandTimeoutError): |
| 440 self.device.WaitUntilFullyBooted(wifi=True) | 440 self.device.WaitUntilFullyBooted(wifi=True) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 466 self.call.device.WaitUntilFullyBooted(wifi=True)): | 466 self.call.device.WaitUntilFullyBooted(wifi=True)): |
| 467 self.device.Reboot(block=True, wifi=True) | 467 self.device.Reboot(block=True, wifi=True) |
| 468 | 468 |
| 469 | 469 |
| 470 class DeviceUtilsInstallTest(DeviceUtilsTest): | 470 class DeviceUtilsInstallTest(DeviceUtilsTest): |
| 471 | 471 |
| 472 def testInstall_noPriorInstall(self): | 472 def testInstall_noPriorInstall(self): |
| 473 with self.assertCalls( | 473 with self.assertCalls( |
| 474 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 474 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
| 475 'this.is.a.test.package'), | 475 'this.is.a.test.package'), |
| 476 (self.call.device.GetApplicationPath('this.is.a.test.package'), None), | 476 (self.call.device.GetApplicationPaths('this.is.a.test.package'), []), |
| 477 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): | 477 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): |
| 478 self.device.Install('/fake/test/app.apk', retries=0) | 478 self.device.Install('/fake/test/app.apk', retries=0) |
| 479 | 479 |
| 480 def testInstall_differentPriorInstall(self): | 480 def testInstall_differentPriorInstall(self): |
| 481 with self.assertCalls( | 481 with self.assertCalls( |
| 482 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 482 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
| 483 'this.is.a.test.package'), | 483 'this.is.a.test.package'), |
| 484 (self.call.device.GetApplicationPath('this.is.a.test.package'), | 484 (self.call.device.GetApplicationPaths('this.is.a.test.package'), |
| 485 '/fake/data/app/this.is.a.test.package.apk'), | 485 ['/fake/data/app/this.is.a.test.package.apk']), |
| 486 (self.call.device._GetChangedFilesImpl( | 486 (self.call.device._GetChangedFilesImpl( |
| 487 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), | 487 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), |
| 488 [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]), | 488 [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]), |
| 489 self.call.adb.Uninstall('this.is.a.test.package'), | 489 self.call.adb.Uninstall('this.is.a.test.package'), |
| 490 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): | 490 self.call.adb.Install('/fake/test/app.apk', reinstall=False)): |
| 491 self.device.Install('/fake/test/app.apk', retries=0) | 491 self.device.Install('/fake/test/app.apk', retries=0) |
| 492 | 492 |
| 493 def testInstall_differentPriorInstall_reinstall(self): | 493 def testInstall_differentPriorInstall_reinstall(self): |
| 494 with self.assertCalls( | 494 with self.assertCalls( |
| 495 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 495 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
| 496 'this.is.a.test.package'), | 496 'this.is.a.test.package'), |
| 497 (self.call.device.GetApplicationPath('this.is.a.test.package'), | 497 (self.call.device.GetApplicationPaths('this.is.a.test.package'), |
| 498 '/fake/data/app/this.is.a.test.package.apk'), | 498 ['/fake/data/app/this.is.a.test.package.apk']), |
| 499 (self.call.device._GetChangedFilesImpl( | 499 (self.call.device._GetChangedFilesImpl( |
| 500 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), | 500 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), |
| 501 [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]), | 501 [('/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk')]), |
| 502 self.call.adb.Install('/fake/test/app.apk', reinstall=True)): | 502 self.call.adb.Install('/fake/test/app.apk', reinstall=True)): |
| 503 self.device.Install('/fake/test/app.apk', reinstall=True, retries=0) | 503 self.device.Install('/fake/test/app.apk', reinstall=True, retries=0) |
| 504 | 504 |
| 505 def testInstall_identicalPriorInstall(self): | 505 def testInstall_identicalPriorInstall(self): |
| 506 with self.assertCalls( | 506 with self.assertCalls( |
| 507 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 507 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
| 508 'this.is.a.test.package'), | 508 'this.is.a.test.package'), |
| 509 (self.call.device.GetApplicationPath('this.is.a.test.package'), | 509 (self.call.device.GetApplicationPaths('this.is.a.test.package'), |
| 510 '/fake/data/app/this.is.a.test.package.apk'), | 510 ['/fake/data/app/this.is.a.test.package.apk']), |
| 511 (self.call.device._GetChangedFilesImpl( | 511 (self.call.device._GetChangedFilesImpl( |
| 512 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), | 512 '/fake/test/app.apk', '/fake/data/app/this.is.a.test.package.apk'), |
| 513 [])): | 513 [])): |
| 514 self.device.Install('/fake/test/app.apk', retries=0) | 514 self.device.Install('/fake/test/app.apk', retries=0) |
| 515 | 515 |
| 516 def testInstall_fails(self): | 516 def testInstall_fails(self): |
| 517 with self.assertCalls( | 517 with self.assertCalls( |
| 518 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), | 518 (mock.call.pylib.utils.apk_helper.GetPackageName('/fake/test/app.apk'), |
| 519 'this.is.a.test.package'), | 519 'this.is.a.test.package'), |
| 520 (self.call.device.GetApplicationPath('this.is.a.test.package'), None), | 520 (self.call.device.GetApplicationPaths('this.is.a.test.package'), []), |
| 521 (self.call.adb.Install('/fake/test/app.apk', reinstall=False), | 521 (self.call.adb.Install('/fake/test/app.apk', reinstall=False), |
| 522 self.CommandError('Failure\r\n'))): | 522 self.CommandError('Failure\r\n'))): |
| 523 with self.assertRaises(device_errors.CommandFailedError): | 523 with self.assertRaises(device_errors.CommandFailedError): |
| 524 self.device.Install('/fake/test/app.apk', retries=0) | 524 self.device.Install('/fake/test/app.apk', retries=0) |
| 525 | 525 |
| 526 | 526 |
| 527 class DeviceUtilsRunShellCommandTest(DeviceUtilsTest): | 527 class DeviceUtilsRunShellCommandTest(DeviceUtilsTest): |
| 528 | 528 |
| 529 def setUp(self): | 529 def setUp(self): |
| 530 super(DeviceUtilsRunShellCommandTest, self).setUp() | 530 super(DeviceUtilsRunShellCommandTest, self).setUp() |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 self.call.adb.Shell('am force-stop this.is.a.test.package'), | 1026 self.call.adb.Shell('am force-stop this.is.a.test.package'), |
| 1027 ''): | 1027 ''): |
| 1028 self.device.ForceStop('this.is.a.test.package') | 1028 self.device.ForceStop('this.is.a.test.package') |
| 1029 | 1029 |
| 1030 | 1030 |
| 1031 class DeviceUtilsClearApplicationStateTest(DeviceUtilsTest): | 1031 class DeviceUtilsClearApplicationStateTest(DeviceUtilsTest): |
| 1032 | 1032 |
| 1033 def testClearApplicationState_packageDoesntExist(self): | 1033 def testClearApplicationState_packageDoesntExist(self): |
| 1034 with self.assertCalls( | 1034 with self.assertCalls( |
| 1035 (self.call.adb.Shell('getprop ro.build.version.sdk'), '17\n'), | 1035 (self.call.adb.Shell('getprop ro.build.version.sdk'), '17\n'), |
| 1036 (self.call.device.GetApplicationPath('this.package.does.not.exist'), | 1036 (self.call.device.GetApplicationPaths('this.package.does.not.exist'), |
| 1037 None)): | 1037 [])): |
| 1038 self.device.ClearApplicationState('this.package.does.not.exist') | 1038 self.device.ClearApplicationState('this.package.does.not.exist') |
| 1039 | 1039 |
| 1040 def testClearApplicationState_packageDoesntExistOnAndroidJBMR2OrAbove(self): | 1040 def testClearApplicationState_packageDoesntExistOnAndroidJBMR2OrAbove(self): |
| 1041 with self.assertCalls( | 1041 with self.assertCalls( |
| 1042 (self.call.adb.Shell('getprop ro.build.version.sdk'), '18\n'), | 1042 (self.call.adb.Shell('getprop ro.build.version.sdk'), '18\n'), |
| 1043 (self.call.adb.Shell('pm clear this.package.does.not.exist'), | 1043 (self.call.adb.Shell('pm clear this.package.does.not.exist'), |
| 1044 'Failed\r\n')): | 1044 'Failed\r\n')): |
| 1045 self.device.ClearApplicationState('this.package.does.not.exist') | 1045 self.device.ClearApplicationState('this.package.does.not.exist') |
| 1046 | 1046 |
| 1047 def testClearApplicationState_packageExists(self): | 1047 def testClearApplicationState_packageExists(self): |
| 1048 with self.assertCalls( | 1048 with self.assertCalls( |
| 1049 (self.call.adb.Shell('getprop ro.build.version.sdk'), '17\n'), | 1049 (self.call.adb.Shell('getprop ro.build.version.sdk'), '17\n'), |
| 1050 (self.call.device.GetApplicationPath('this.package.exists'), | 1050 (self.call.device.GetApplicationPaths('this.package.exists'), |
| 1051 '/data/app/this.package.exists.apk'), | 1051 ['/data/app/this.package.exists.apk']), |
| 1052 (self.call.adb.Shell('pm clear this.package.exists'), | 1052 (self.call.adb.Shell('pm clear this.package.exists'), |
| 1053 'Success\r\n')): | 1053 'Success\r\n')): |
| 1054 self.device.ClearApplicationState('this.package.exists') | 1054 self.device.ClearApplicationState('this.package.exists') |
| 1055 | 1055 |
| 1056 def testClearApplicationState_packageExistsOnAndroidJBMR2OrAbove(self): | 1056 def testClearApplicationState_packageExistsOnAndroidJBMR2OrAbove(self): |
| 1057 with self.assertCalls( | 1057 with self.assertCalls( |
| 1058 (self.call.adb.Shell('getprop ro.build.version.sdk'), '18\n'), | 1058 (self.call.adb.Shell('getprop ro.build.version.sdk'), '18\n'), |
| 1059 (self.call.adb.Shell('pm clear this.package.exists'), | 1059 (self.call.adb.Shell('pm clear this.package.exists'), |
| 1060 'Success\r\n')): | 1060 'Success\r\n')): |
| 1061 self.device.ClearApplicationState('this.package.exists') | 1061 self.device.ClearApplicationState('this.package.exists') |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 devices = device_utils.DeviceUtils.HealthyDevices() | 1673 devices = device_utils.DeviceUtils.HealthyDevices() |
| 1674 self.assertEquals(1, len(devices)) | 1674 self.assertEquals(1, len(devices)) |
| 1675 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) | 1675 self.assertTrue(isinstance(devices[0], device_utils.DeviceUtils)) |
| 1676 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) | 1676 self.assertEquals('0123456789abcdef', devices[0].adb.GetDeviceSerial()) |
| 1677 | 1677 |
| 1678 | 1678 |
| 1679 if __name__ == '__main__': | 1679 if __name__ == '__main__': |
| 1680 logging.getLogger().setLevel(logging.DEBUG) | 1680 logging.getLogger().setLevel(logging.DEBUG) |
| 1681 unittest.main(verbosity=2) | 1681 unittest.main(verbosity=2) |
| 1682 | 1682 |
| OLD | NEW |