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

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

Issue 11876021: Support startup performance tests on Galaxy S3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support startup performance tests on Galaxy S3 - code review fixes Created 7 years, 11 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 | « build/android/pylib/device_stats_monitor.py ('k') | build/android/pylib/perf_tests_helper.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 constants 5 import constants
6 import traceback 6 import traceback
7 import warnings 7 import warnings
8 8
9 9
10 # Location where chrome reads command line flags from 10 # Location where chrome reads command line flags from
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 def Restore(self): 82 def Restore(self):
83 """Restores the flags to their original state.""" 83 """Restores the flags to their original state."""
84 self._current_flags = self._TokenizeFlags(self._orig_line) 84 self._current_flags = self._TokenizeFlags(self._orig_line)
85 self._UpdateCommandLineFile() 85 self._UpdateCommandLineFile()
86 86
87 def _UpdateCommandLineFile(self): 87 def _UpdateCommandLineFile(self):
88 """Writes out the command line to the file, or removes it if empty.""" 88 """Writes out the command line to the file, or removes it if empty."""
89 print "Current flags: ", self._current_flags 89 print "Current flags: ", self._current_flags
90 90
91 if self._current_flags: 91 if self._current_flags:
92 self._android_cmd.SetFileContents(CHROME_COMMAND_FILE, 92 self._android_cmd.SetProtectedFileContents(CHROME_COMMAND_FILE,
frankf 2013/01/17 18:45:39 alignment.
93 'chrome ' + 93 'chrome ' +
94 ' '.join(self._current_flags)) 94 ' '.join(self._current_flags))
95 else: 95 else:
96 self._android_cmd.RunShellCommand('rm ' + CHROME_COMMAND_FILE) 96 self._android_cmd.RunShellCommand('su -c rm ' + CHROME_COMMAND_FILE)
97 97
98 def _TokenizeFlags(self, line): 98 def _TokenizeFlags(self, line):
99 """Changes the string containing the command line into a list of flags. 99 """Changes the string containing the command line into a list of flags.
100 100
101 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: 101 Follows similar logic to CommandLine.java::tokenizeQuotedArguments:
102 * Flags are split using whitespace, unless the whitespace is within a 102 * Flags are split using whitespace, unless the whitespace is within a
103 pair of quotation marks. 103 pair of quotation marks.
104 * Unlike the Java version, we keep the quotation marks around switch 104 * Unlike the Java version, we keep the quotation marks around switch
105 values since we need them to re-create the file when new flags are 105 values since we need them to re-create the file when new flags are
106 appended. 106 appended.
(...skipping 28 matching lines...) Expand all
135 135
136 # Tack on the last flag. 136 # Tack on the last flag.
137 if not current_flag: 137 if not current_flag:
138 if within_quotations: 138 if within_quotations:
139 warnings.warn("Unterminated quoted string: " + current_flag) 139 warnings.warn("Unterminated quoted string: " + current_flag)
140 else: 140 else:
141 tokenized_flags.append(current_flag) 141 tokenized_flags.append(current_flag)
142 142
143 # Return everything but the program name. 143 # Return everything but the program name.
144 return tokenized_flags[1:] 144 return tokenized_flags[1:]
OLDNEW
« no previous file with comments | « build/android/pylib/device_stats_monitor.py ('k') | build/android/pylib/perf_tests_helper.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698