OLD | NEW |
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 # Location where chrome reads command line flags from | 6 # Location where chrome reads command line flags from |
7 CHROME_COMMAND_FILE = '/data/local/chrome-command-line' | 7 CHROME_COMMAND_FILE = '/data/local/tmp/chrome-command-line' |
8 | 8 |
9 | 9 |
10 class FlagChanger(object): | 10 class FlagChanger(object): |
11 """Temporarily changes the flags Chrome runs with.""" | 11 """Temporarily changes the flags Chrome runs with.""" |
12 | 12 |
13 def __init__(self, android_cmd): | 13 def __init__(self, android_cmd): |
14 self._android_cmd = android_cmd | 14 self._android_cmd = android_cmd |
15 self._old_flags = None | 15 self._old_flags = None |
16 | 16 |
17 def Set(self, flags, append=False): | 17 def Set(self, flags, append=False): |
(...skipping 22 matching lines...) Expand all Loading... |
40 'chrome ' + ' '.join(flags)) | 40 'chrome ' + ' '.join(flags)) |
41 | 41 |
42 def Restore(self): | 42 def Restore(self): |
43 """Restores the flags to their original state.""" | 43 """Restores the flags to their original state.""" |
44 if self._old_flags == None: | 44 if self._old_flags == None: |
45 return # Set() was never called. | 45 return # Set() was never called. |
46 elif self._old_flags: | 46 elif self._old_flags: |
47 self._android_cmd.SetFileContents(CHROME_COMMAND_FILE, self._old_flags) | 47 self._android_cmd.SetFileContents(CHROME_COMMAND_FILE, self._old_flags) |
48 else: | 48 else: |
49 self._android_cmd.RunShellCommand('rm ' + CHROME_COMMAND_FILE) | 49 self._android_cmd.RunShellCommand('rm ' + CHROME_COMMAND_FILE) |
OLD | NEW |