| 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'))
|
|
|
|
|
|
|