| Index: devil/devil/android/device_utils_test.py
|
| diff --git a/devil/devil/android/device_utils_test.py b/devil/devil/android/device_utils_test.py
|
| index 8114136c35f8dca5a00691ace28b2e7bbdcc60ca..893fc77f73bea70abc31776e5c507db1ff3096cc 100755
|
| --- a/devil/devil/android/device_utils_test.py
|
| +++ b/devil/devil/android/device_utils_test.py
|
| @@ -624,6 +624,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
| def testInstall_noPriorInstall(self):
|
| with self.patch_call(self.call.device.build_version_sdk, return_value=23):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| self.call.adb.Install('/fake/test/app.apk', reinstall=False,
|
| allow_downgrade=False),
|
| @@ -633,6 +634,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
| def testInstall_permissionsPreM(self):
|
| with self.patch_call(self.call.device.build_version_sdk, return_value=20):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| (self.call.adb.Install('/fake/test/app.apk', reinstall=False,
|
| allow_downgrade=False))):
|
| @@ -641,6 +643,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
| def testInstall_findPermissions(self):
|
| with self.patch_call(self.call.device.build_version_sdk, return_value=23):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| (self.call.adb.Install('/fake/test/app.apk', reinstall=False,
|
| allow_downgrade=False)),
|
| @@ -649,6 +652,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
|
|
| def testInstall_passPermissions(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| (self.call.adb.Install('/fake/test/app.apk', reinstall=False,
|
| allow_downgrade=False)),
|
| @@ -658,6 +662,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
|
|
| def testInstall_differentPriorInstall(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['/fake/data/app/test.package.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -671,6 +676,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
|
|
| def testInstall_differentPriorInstall_reinstall(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['/fake/data/app/test.package.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -683,6 +689,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
|
|
| def testInstall_identicalPriorInstall_reinstall(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['/fake/data/app/test.package.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -692,8 +699,15 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
| self.device.Install(DeviceUtilsInstallTest.mock_apk,
|
| reinstall=True, retries=0, permissions=[])
|
|
|
| + def testInstall_missingApk(self):
|
| + with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), False)):
|
| + with self.assertRaises(device_errors.CommandFailedError):
|
| + self.device.Install(DeviceUtilsInstallTest.mock_apk, retries=0)
|
| +
|
| def testInstall_fails(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| (self.call.adb.Install('/fake/test/app.apk', reinstall=False,
|
| allow_downgrade=False),
|
| @@ -703,6 +717,7 @@ class DeviceUtilsInstallTest(DeviceUtilsTest):
|
|
|
| def testInstall_downgrade(self):
|
| with self.assertCalls(
|
| + (mock.call.os.path.exists('/fake/test/app.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['/fake/data/app/test.package.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -726,6 +741,8 @@ class DeviceUtilsInstallSplitApkTest(DeviceUtilsTest):
|
| ['split1.apk', 'split2.apk', 'split3.apk'],
|
| allow_cached_props=False),
|
| ['split2.apk']),
|
| + (mock.call.os.path.exists('base.apk'), True),
|
| + (mock.call.os.path.exists('split2.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'), []),
|
| (self.call.adb.InstallMultiple(
|
| ['base.apk', 'split2.apk'], partial=None, reinstall=False,
|
| @@ -741,6 +758,8 @@ class DeviceUtilsInstallSplitApkTest(DeviceUtilsTest):
|
| ['split1.apk', 'split2.apk', 'split3.apk'],
|
| allow_cached_props=False),
|
| ['split2.apk']),
|
| + (mock.call.os.path.exists('base.apk'), True),
|
| + (mock.call.os.path.exists('split2.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['base-on-device.apk', 'split2-on-device.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -761,6 +780,8 @@ class DeviceUtilsInstallSplitApkTest(DeviceUtilsTest):
|
| ['split1.apk', 'split2.apk', 'split3.apk'],
|
| allow_cached_props=False),
|
| ['split2.apk']),
|
| + (mock.call.os.path.exists('base.apk'), True),
|
| + (mock.call.os.path.exists('split2.apk'), True),
|
| (self.call.device._GetApplicationPathsInternal('test.package'),
|
| ['base-on-device.apk', 'split2-on-device.apk']),
|
| (self.call.device._ComputeStaleApks('test.package',
|
| @@ -774,6 +795,21 @@ class DeviceUtilsInstallSplitApkTest(DeviceUtilsTest):
|
| reinstall=True, permissions=[], retries=0,
|
| allow_downgrade=True)
|
|
|
| + def testInstallSplitApk_missingSplit(self):
|
| + with self.assertCalls(
|
| + (self.call.device._CheckSdkLevel(21)),
|
| + (mock.call.devil.android.sdk.split_select.SelectSplits(
|
| + self.device, 'base.apk',
|
| + ['split1.apk', 'split2.apk', 'split3.apk'],
|
| + allow_cached_props=False),
|
| + ['split2.apk']),
|
| + (mock.call.os.path.exists('base.apk'), True),
|
| + (mock.call.os.path.exists('split2.apk'), False)):
|
| + with self.assertRaises(device_errors.CommandFailedError):
|
| + self.device.InstallSplitApk(DeviceUtilsInstallSplitApkTest.mock_apk,
|
| + ['split1.apk', 'split2.apk', 'split3.apk'], permissions=[],
|
| + retries=0)
|
| +
|
|
|
| class DeviceUtilsUninstallTest(DeviceUtilsTest):
|
|
|
|
|