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

Unified Diff: tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py

Issue 23726018: Telemetry: Write chrome command line file as root if it doesn't exist. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Recursively check for file permissions. Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
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 d0c45999a286f9c067628ad2c08464dec97307a6..199a7cf333de98cd31d0c6196aec343968cf70ba 100644
--- a/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
+++ b/tools/telemetry/telemetry/core/backends/chrome/android_browser_backend.py
@@ -196,8 +196,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():
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698