summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authordominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 14:53:03 +0000
committerdominikg@chromium.org <dominikg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-05 14:53:03 +0000
commit3af9b8643f76614e47bf5d36b987c0ccb60b0ddc (patch)
tree462384cf02c94154510136f1d6e4025a0e9cab39 /tools
parenta1b0e0df73738ee874ca1ae0e8dd967e633334e1 (diff)
downloadchromium_src-3af9b8643f76614e47bf5d36b987c0ccb60b0ddc.zip
chromium_src-3af9b8643f76614e47bf5d36b987c0ccb60b0ddc.tar.gz
chromium_src-3af9b8643f76614e47bf5d36b987c0ccb60b0ddc.tar.bz2
Telemetry: Write chrome command line file as root if it doesn't exist.
On Android, Telemetry sets the chrome command line file before running any pages. If the file doesn't already exist, it tries to write it as a normal user, rather than root, which fails. This patch explicitly checks if the file exists. If it doesn't exist it writes the file as root. BUG=284468 Review URL: https://chromiumcodereview.appspot.com/23726018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221426 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r--tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py b/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
index 758adff..3f85d18 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
@@ -205,8 +205,16 @@ class AndroidBrowserBackend(chrome_browser_backend.ChromeBrowserBackend):
def _SetCommandLineFile(self, file_contents):
def IsProtectedFile(name):
- ls_output = self._adb.RunShellCommand('ls -l %s' % name)[0].split()
- return ls_output[1] == 'root'
+ if self._adb.Adb().FileExistsOnDevice(name):
+ ls_output = self._adb.RunShellCommand('ls -l %s' % name)[0]
+ return ls_output == 'opendir failed, Permission denied' or \
+ ls_output.split()[1] == 'root'
+ else:
+ parent_name = os.path.dirname(name)
+ if parent_name != '':
+ return IsProtectedFile(parent_name)
+ else:
+ return True
if IsProtectedFile(self._backend_settings.cmdline_file):
if not self._adb.Adb().CanAccessProtectedFileContents():