Index: build/android/pylib/flag_changer.py |
diff --git a/build/android/pylib/flag_changer.py b/build/android/pylib/flag_changer.py |
index 6eb9f0b3c675f93feb2a827fc1aa31f5a8e1fb48..6c4883a76dc3a97fb5b9991b6cbf8b793e51f654 100644 |
--- a/build/android/pylib/flag_changer.py |
+++ b/build/android/pylib/flag_changer.py |
@@ -5,12 +5,8 @@ |
import constants |
import logging |
import traceback |
-import warnings |
-# Location where chrome reads command line flags from |
-CHROME_COMMAND_FILE = '/data/local/chrome-command-line' |
- |
class FlagChanger(object): |
"""Changes the flags Chrome runs with. |
@@ -21,11 +17,19 @@ class FlagChanger(object): |
once the tests have completed. |
""" |
- def __init__(self, android_cmd): |
- self._android_cmd = android_cmd |
+ def __init__(self, adb, |
+ cmdline_file=constants.PACKAGE_INFO['chrome'].cmdline_file): |
+ """Initializes the FlagChanger and records the original arguments. |
+ |
+ Args: |
+ adb: An instance of AndroidCommands. |
+ cmdline_file: Path to the command line file on the device. |
+ """ |
+ self._adb = adb |
+ self._cmdline_file = cmdline_file |
# Save the original flags. |
- self._orig_line = self._android_cmd.GetFileContents(CHROME_COMMAND_FILE) |
+ self._orig_line = self._adb.GetFileContents(self._cmdline_file) |
if self._orig_line: |
self._orig_line = self._orig_line[0].strip() |
@@ -90,11 +94,12 @@ class FlagChanger(object): |
logging.info('Current flags: %s', self._current_flags) |
if self._current_flags: |
- self._android_cmd.SetProtectedFileContents(CHROME_COMMAND_FILE, |
- 'chrome ' + |
- ' '.join(self._current_flags)) |
+ # The first command line argument doesn't matter as we are not actually |
+ # launching the chrome executable using this command line. |
+ self._adb.SetProtectedFileContents(self._cmdline_file, |
+ ' '.join(['_'] + self._current_flags)) |
else: |
- self._android_cmd.RunShellCommand('su -c rm ' + CHROME_COMMAND_FILE) |
+ self._adb.RunShellCommand('su -c rm ' + self._cmdline_file) |
def _TokenizeFlags(self, line): |
"""Changes the string containing the command line into a list of flags. |
@@ -137,7 +142,7 @@ class FlagChanger(object): |
# Tack on the last flag. |
if not current_flag: |
if within_quotations: |
- warnings.warn("Unterminated quoted string: " + current_flag) |
+ logging.warn('Unterminated quoted argument: ' + line) |
else: |
tokenized_flags.append(current_flag) |