OLD | NEW |
1 # Copyright (c) 2012 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 import constants | 5 import constants |
6 import logging | 6 import logging |
7 import traceback | 7 import traceback |
8 | 8 |
9 | 9 |
10 class FlagChanger(object): | 10 class FlagChanger(object): |
11 """Changes the flags Chrome runs with. | 11 """Changes the flags Chrome runs with. |
12 | 12 |
13 There are two different use cases for this file: | 13 There are two different use cases for this file: |
14 * Flags are permanently set by calling Set(). | 14 * Flags are permanently set by calling Set(). |
15 * Flags can be temporarily set for a particular set of unit tests. These | 15 * Flags can be temporarily set for a particular set of unit tests. These |
16 tests should call Restore() to revert the flags to their original state | 16 tests should call Restore() to revert the flags to their original state |
17 once the tests have completed. | 17 once the tests have completed. |
18 """ | 18 """ |
19 | 19 |
20 def __init__(self, adb, | 20 def __init__(self, adb, cmdline_file): |
21 cmdline_file=constants.PACKAGE_INFO['chrome'].cmdline_file): | |
22 """Initializes the FlagChanger and records the original arguments. | 21 """Initializes the FlagChanger and records the original arguments. |
23 | 22 |
24 Args: | 23 Args: |
25 adb: An instance of AndroidCommands. | 24 adb: An instance of AndroidCommands. |
26 cmdline_file: Path to the command line file on the device. | 25 cmdline_file: Path to the command line file on the device. |
27 """ | 26 """ |
28 self._adb = adb | 27 self._adb = adb |
29 self._cmdline_file = cmdline_file | 28 self._cmdline_file = cmdline_file |
30 | 29 |
31 # Save the original flags. | 30 # Save the original flags. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 153 |
155 # Tack on the last flag. | 154 # Tack on the last flag. |
156 if not current_flag: | 155 if not current_flag: |
157 if within_quotations: | 156 if within_quotations: |
158 logging.warn('Unterminated quoted argument: ' + line) | 157 logging.warn('Unterminated quoted argument: ' + line) |
159 else: | 158 else: |
160 tokenized_flags.append(current_flag) | 159 tokenized_flags.append(current_flag) |
161 | 160 |
162 # Return everything but the program name. | 161 # Return everything but the program name. |
163 return tokenized_flags[1:] | 162 return tokenized_flags[1:] |
OLD | NEW |