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

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: 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
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 # Can't use SetFileContents since that uses push, which doesn't work
93 'chrome ' + 93 # on user type builds for protected files.
94 ' '.join(self._current_flags)) 94 self._android_cmd.RunShellCommand(
bulach 2013/01/14 17:26:50 nit: the escaping makes it hard to read :) how abo
aberent 2013/01/14 20:19:10 It didn't work anyway, once I retested it, so that
95 'su -c echo \"' + 'chrome ' + ' '.join(self._current_flags) +
96 ' > ' + CHROME_COMMAND_FILE + '\"')
95 else: 97 else:
96 self._android_cmd.RunShellCommand('rm ' + CHROME_COMMAND_FILE) 98 self._android_cmd.RunShellCommand('su -c rm ' + CHROME_COMMAND_FILE)
97 99
98 def _TokenizeFlags(self, line): 100 def _TokenizeFlags(self, line):
99 """Changes the string containing the command line into a list of flags. 101 """Changes the string containing the command line into a list of flags.
100 102
101 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: 103 Follows similar logic to CommandLine.java::tokenizeQuotedArguments:
102 * Flags are split using whitespace, unless the whitespace is within a 104 * Flags are split using whitespace, unless the whitespace is within a
103 pair of quotation marks. 105 pair of quotation marks.
104 * Unlike the Java version, we keep the quotation marks around switch 106 * 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 107 values since we need them to re-create the file when new flags are
106 appended. 108 appended.
(...skipping 28 matching lines...) Expand all
135 137
136 # Tack on the last flag. 138 # Tack on the last flag.
137 if not current_flag: 139 if not current_flag:
138 if within_quotations: 140 if within_quotations:
139 warnings.warn("Unterminated quoted string: " + current_flag) 141 warnings.warn("Unterminated quoted string: " + current_flag)
140 else: 142 else:
141 tokenized_flags.append(current_flag) 143 tokenized_flags.append(current_flag)
142 144
143 # Return everything but the program name. 145 # Return everything but the program name.
144 return tokenized_flags[1:] 146 return tokenized_flags[1:]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698