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

Side by Side Diff: build/android/pylib/flag_changer.py

Issue 1261763004: Remove handling code for android_command in pylib. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove 2 more TODO comments Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 logging 5 import logging
6 6
7 import pylib.android_commands
8 import pylib.device.device_utils 7 import pylib.device.device_utils
9 8
10 from pylib.device import device_errors 9 from pylib.device import device_errors
11 10
12 11
13 class FlagChanger(object): 12 class FlagChanger(object):
14 """Changes the flags Chrome runs with. 13 """Changes the flags Chrome runs with.
15 14
16 There are two different use cases for this file: 15 There are two different use cases for this file:
17 * Flags are permanently set by calling Set(). 16 * Flags are permanently set by calling Set().
18 * Flags can be temporarily set for a particular set of unit tests. These 17 * Flags can be temporarily set for a particular set of unit tests. These
19 tests should call Restore() to revert the flags to their original state 18 tests should call Restore() to revert the flags to their original state
20 once the tests have completed. 19 once the tests have completed.
21 """ 20 """
22 21
23 def __init__(self, device, cmdline_file): 22 def __init__(self, device, cmdline_file):
24 """Initializes the FlagChanger and records the original arguments. 23 """Initializes the FlagChanger and records the original arguments.
25 24
26 Args: 25 Args:
27 device: A DeviceUtils instance. 26 device: A DeviceUtils instance.
28 cmdline_file: Path to the command line file on the device. 27 cmdline_file: Path to the command line file on the device.
29 """ 28 """
30 # TODO(jbudorick) Remove once telemetry switches over.
31 assert not isinstance(device, pylib.android_commands.AndroidCommands)
32 self._device = device 29 self._device = device
33 self._cmdline_file = cmdline_file 30 self._cmdline_file = cmdline_file
34 31
35 # Save the original flags. 32 # Save the original flags.
36 try: 33 try:
37 self._orig_line = self._device.ReadFile(self._cmdline_file).strip() 34 self._orig_line = self._device.ReadFile(self._cmdline_file).strip()
38 except device_errors.CommandFailedError: 35 except device_errors.CommandFailedError:
39 self._orig_line = '' 36 self._orig_line = ''
40 37
41 # Parse out the flags into a list to facilitate adding and removing flags. 38 # Parse out the flags into a list to facilitate adding and removing flags.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 153
157 # Tack on the last flag. 154 # Tack on the last flag.
158 if not current_flag: 155 if not current_flag:
159 if within_quotations: 156 if within_quotations:
160 logging.warn('Unterminated quoted argument: ' + line) 157 logging.warn('Unterminated quoted argument: ' + line)
161 else: 158 else:
162 tokenized_flags.append(current_flag) 159 tokenized_flags.append(current_flag)
163 160
164 # Return everything but the program name. 161 # Return everything but the program name.
165 return tokenized_flags[1:] 162 return tokenized_flags[1:]
OLDNEW
« no previous file with comments | « no previous file | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698