Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: devil/devil/android/device_utils_test.py

Issue 1585243002: [devil] Add as_root option to DeviceUtils.PathExists. (Closed) Base URL: git@github.com:catapult-project/catapult.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « devil/devil/android/device_utils.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3b440b7ef123d4329911d815f4b287d7caffaca7..afe2562524f665cb9696d0c8b6806538785ff6eb 100755
--- a/devil/devil/android/device_utils_test.py
+++ b/devil/devil/android/device_utils_test.py
@@ -1502,32 +1502,45 @@ class DeviceUtilsPushChangedFilesZippedTest(DeviceUtilsTest):
class DeviceUtilsPathExistsTest(DeviceUtilsTest):
- def testPathExists_usingTest_pathExists(self):
+ def testPathExists_pathExists(self):
with self.assertCall(
self.call.device.RunShellCommand(
- "test -e '/path/file exists';echo $?",
- check_return=True, timeout=None, retries=None), ['0']):
+ "test -e '/path/file exists'",
+ as_root=False, check_return=True, timeout=None, retries=None),
+ []):
self.assertTrue(self.device.PathExists('/path/file exists'))
- def testPathExists_usingTest_multiplePathExists(self):
+ def testPathExists_multiplePathExists(self):
with self.assertCall(
self.call.device.RunShellCommand(
- "test -e '/path 1' -a -e /path2;echo $?",
- check_return=True, timeout=None, retries=None), ['0']):
+ "test -e '/path 1' -a -e /path2",
+ as_root=False, check_return=True, timeout=None, retries=None),
+ []):
self.assertTrue(self.device.PathExists(('/path 1', '/path2')))
- def testPathExists_usingTest_pathDoesntExist(self):
+ def testPathExists_pathDoesntExist(self):
with self.assertCall(
self.call.device.RunShellCommand(
- "test -e /path/file.not.exists;echo $?",
- check_return=True, timeout=None, retries=None), ['1']):
+ "test -e /path/file.not.exists",
+ as_root=False, check_return=True, timeout=None, retries=None),
+ self.ShellError()):
self.assertFalse(self.device.PathExists('/path/file.not.exists'))
- def testFileExists_usingTest_pathDoesntExist(self):
+ def testPathExists_asRoot(self):
+ with self.assertCall(
+ self.call.device.RunShellCommand(
+ "test -e /root/path/exists",
+ as_root=True, check_return=True, timeout=None, retries=None),
+ self.ShellError()):
+ self.assertFalse(
+ self.device.PathExists('/root/path/exists', as_root=True))
+
+ def testFileExists_pathDoesntExist(self):
with self.assertCall(
self.call.device.RunShellCommand(
- "test -e /path/file.not.exists;echo $?",
- check_return=True, timeout=None, retries=None), ['1']):
+ "test -e /path/file.not.exists",
+ as_root=False, check_return=True, timeout=None, retries=None),
+ self.ShellError()):
self.assertFalse(self.device.FileExists('/path/file.not.exists'))
« no previous file with comments | « devil/devil/android/device_utils.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698