Index: build/android/devil/android/device_utils_test.py |
diff --git a/build/android/devil/android/device_utils_test.py b/build/android/devil/android/device_utils_test.py |
index 471ef21edc2b2f7ad2a7b443ca37ebf30a931c7b..6276ff2b138613a55a9f15e34615d90d393bebff 100755 |
--- a/build/android/devil/android/device_utils_test.py |
+++ b/build/android/devil/android/device_utils_test.py |
@@ -2064,7 +2064,7 @@ class DeviceUtilsGrantPermissionsTest(DeviceUtilsTest): |
self.device.GrantPermissions('package', ['p1']) |
def testGrantPermissions_one(self): |
- permissions_cmd = 'pm grant package p1;' |
+ permissions_cmd = 'pm grant package p1' |
with self.patch_call(self.call.device.build_version_sdk, |
return_value=23): |
with self.assertCalls( |
@@ -2072,13 +2072,30 @@ class DeviceUtilsGrantPermissionsTest(DeviceUtilsTest): |
self.device.GrantPermissions('package', ['p1']) |
def testGrantPermissions_multiple(self): |
- permissions_cmd = 'pm grant package p1;pm grant package p2;' |
+ permissions_cmd = 'pm grant package p1;pm grant package p2' |
with self.patch_call(self.call.device.build_version_sdk, |
return_value=23): |
with self.assertCalls( |
(self.call.device.RunShellCommand(permissions_cmd), [])): |
self.device.GrantPermissions('package', ['p1', 'p2']) |
+ def testGrantPermissions_WriteExtrnalStorage(self): |
+ permissions_cmd = ( |
+ 'pm grant package android.permission.WRITE_EXTERNAL_STORAGE;' |
+ 'pm grant package android.permission.READ_EXTERNAL_STORAGE') |
+ with self.patch_call(self.call.device.build_version_sdk, |
+ return_value=23): |
+ with self.assertCalls( |
+ (self.call.device.RunShellCommand(permissions_cmd), [])): |
+ self.device.GrantPermissions( |
+ 'package', ['android.permission.WRITE_EXTERNAL_STORAGE']) |
+ |
+ def testGrantPermissions_BlackList(self): |
+ with self.patch_call( |
+ self.call.device.build_version_sdk, return_value=23): |
+ self.device.GrantPermissions( |
+ 'package', ['android.permission.ACCESS_MOCK_LOCATION']) |
+ |
if __name__ == '__main__': |
logging.getLogger().setLevel(logging.DEBUG) |