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 logging | 5 import logging |
6 | 6 |
7 import pylib.android_commands | 7 import pylib.android_commands |
8 import pylib.device.device_utils | 8 import pylib.device.device_utils |
9 | 9 |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 self._cmdline_file, cmd_line) | 107 self._cmdline_file, cmd_line) |
108 file_contents = self._device.old_interface.GetProtectedFileContents( | 108 file_contents = self._device.old_interface.GetProtectedFileContents( |
109 self._cmdline_file) | 109 self._cmdline_file) |
110 else: | 110 else: |
111 self._device.old_interface.SetFileContents(self._cmdline_file, cmd_line) | 111 self._device.old_interface.SetFileContents(self._cmdline_file, cmd_line) |
112 file_contents = self._device.old_interface.GetFileContents( | 112 file_contents = self._device.old_interface.GetFileContents( |
113 self._cmdline_file) | 113 self._cmdline_file) |
114 assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( | 114 assert len(file_contents) == 1 and file_contents[0] == cmd_line, ( |
115 'Failed to set the command line file at %s' % self._cmdline_file) | 115 'Failed to set the command line file at %s' % self._cmdline_file) |
116 else: | 116 else: |
117 self._device.RunShellCommand('rm ' + self._cmdline_file, root=use_root) | 117 self._device.RunShellCommand('rm ' + self._cmdline_file, |
| 118 as_root=use_root) |
118 assert ( | 119 assert ( |
119 not self._device.old_interface.FileExistsOnDevice( | 120 not self._device.old_interface.FileExistsOnDevice( |
120 self._cmdline_file)), ( | 121 self._cmdline_file)), ( |
121 'Failed to remove the command line file at %s' % self._cmdline_file) | 122 'Failed to remove the command line file at %s' % self._cmdline_file) |
122 | 123 |
123 @staticmethod | 124 @staticmethod |
124 def _TokenizeFlags(line): | 125 def _TokenizeFlags(line): |
125 """Changes the string containing the command line into a list of flags. | 126 """Changes the string containing the command line into a list of flags. |
126 | 127 |
127 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: | 128 Follows similar logic to CommandLine.java::tokenizeQuotedArguments: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 162 |
162 # Tack on the last flag. | 163 # Tack on the last flag. |
163 if not current_flag: | 164 if not current_flag: |
164 if within_quotations: | 165 if within_quotations: |
165 logging.warn('Unterminated quoted argument: ' + line) | 166 logging.warn('Unterminated quoted argument: ' + line) |
166 else: | 167 else: |
167 tokenized_flags.append(current_flag) | 168 tokenized_flags.append(current_flag) |
168 | 169 |
169 # Return everything but the program name. | 170 # Return everything but the program name. |
170 return tokenized_flags[1:] | 171 return tokenized_flags[1:] |
OLD | NEW |