Index: build/android/pylib/device/device_utils_test.py |
diff --git a/build/android/pylib/device/device_utils_test.py b/build/android/pylib/device/device_utils_test.py |
index 6071fd57a069ebc625ca304c62ca0becf37a4e37..3a6e62758722b865142734c6a597b6150ddb4f3f 100755 |
--- a/build/android/pylib/device/device_utils_test.py |
+++ b/build/android/pylib/device/device_utils_test.py |
@@ -597,6 +597,23 @@ class DeviceUtilsRunShellCommandTest(DeviceUtilsNewImplTest): |
(self.call.adb.Shell("su -c sh -c 'setprop service.adb.root 0'"), '')): |
self.device.RunShellCommand('setprop service.adb.root 0', as_root=True) |
+ def testRunShellCommand_withPie_ics(self): |
+ with self.assertCalls( |
+ (self.call.device.build_version_sdk(), |
jbudorick
2015/02/17 15:15:10
These calls to build_version_sdk() are why we need
perezju
2015/02/17 16:04:26
Acknowledged.
|
+ constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH), |
+ (self.call.device.GetDevicePieWrapper(), '/path/to/run_pie'), |
+ (self.call.adb.Shell('/path/to/run_pie md5sum /foo/bar'), |
+ '0123456789abcdef0123456789abcdef')): |
+ self.device.RunShellCommand('md5sum /foo/bar', with_pie=True) |
+ |
+ def testRunShellCommand_withPie_jb(self): |
+ with self.assertCalls( |
+ (self.call.device.build_version_sdk(), |
+ constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN), |
+ (self.call.adb.Shell('md5sum /foo/bar'), |
+ '0123456789abcdef0123456789abcdef')): |
+ self.device.RunShellCommand('md5sum /foo/bar', with_pie=True) |
+ |
def testRunShellCommand_manyLines(self): |
cmd = 'ls /some/path' |
with self.assertCall(self.call.adb.Shell(cmd), 'file1\nfile2\nfile3\n'): |
@@ -656,6 +673,26 @@ class DeviceUtilsRunShellCommandTest(DeviceUtilsNewImplTest): |
self.device.RunShellCommand(cmd, check_return=False)) |
+class DeviceUtilsGetDevicePieWrapper(DeviceUtilsNewImplTest): |
+ |
+ def testGetDevicePieWrapper_jb(self): |
+ with self.assertCall( |
+ self.call.device.build_version_sdk(), |
+ constants.ANDROID_SDK_VERSION_CODES.JELLY_BEAN): |
+ self.assertEqual('', self.device.GetDevicePieWrapper()) |
+ |
+ def testGetDevicePieWrapper_ics(self): |
+ with mock.patch('pylib.constants.GetOutDirectory', |
+ mock.Mock(return_value='/foo/bar')), ( |
+ mock.patch('os.path.exists', return_value=True)): |
perezju
2015/02/16 10:25:23
you could also place these in the list of assertCa
jbudorick
2015/02/17 15:15:10
Oh, nice. I like that better.
|
+ with self.assertCalls( |
+ (self.call.device.build_version_sdk(), |
+ constants.ANDROID_SDK_VERSION_CODES.ICE_CREAM_SANDWICH), |
+ (self.call.adb.Push(mock.ANY, mock.ANY), |
+ '')): |
+ self.assertNotEqual('', self.device.GetDevicePieWrapper()) |
+ |
+ |
@mock.patch('time.sleep', mock.Mock()) |
class DeviceUtilsKillAllTest(DeviceUtilsNewImplTest): |