| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """Produces configured shell abstractions. | 5 """Produces configured shell abstractions. |
| 6 | 6 |
| 7 This module knows how to produce a configured shell abstraction based on | 7 This module knows how to produce a configured shell abstraction based on |
| 8 shell_config.ShellConfig. | 8 shell_config.ShellConfig. |
| 9 """ | 9 """ |
| 10 | 10 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 Throws: | 183 Throws: |
| 184 ShellConfigurationException if shell abstraction could not be configured. | 184 ShellConfigurationException if shell abstraction could not be configured. |
| 185 """ | 185 """ |
| 186 if shell_config.android: | 186 if shell_config.android: |
| 187 verbose_pipe = sys.stdout if shell_config.verbose else None | 187 verbose_pipe = sys.stdout if shell_config.verbose else None |
| 188 | 188 |
| 189 shell = AndroidShell(shell_config.adb_path, shell_config.target_device, | 189 shell = AndroidShell(shell_config.adb_path, shell_config.target_device, |
| 190 logcat_tags=shell_config.logcat_tags, | 190 logcat_tags=shell_config.logcat_tags, |
| 191 verbose_pipe=verbose_pipe) | 191 verbose_pipe=verbose_pipe) |
| 192 | 192 |
| 193 device_status, error = shell.check_device() | 193 device_status, error = shell.check_device( |
| 194 require_root=shell_config.require_root) |
| 194 if not device_status: | 195 if not device_status: |
| 195 raise ShellConfigurationException('Device check failed: ' + error) | 196 raise ShellConfigurationException('Device check failed: ' + error) |
| 196 if shell_config.shell_path: | 197 if shell_config.shell_path: |
| 197 shell.install_apk(shell_config.shell_path) | 198 shell.install_apk(shell_config.shell_path) |
| 198 else: | 199 else: |
| 199 if not shell_config.shell_path: | 200 if not shell_config.shell_path: |
| 200 raise ShellConfigurationException('Can not run without a shell binary. ' | 201 raise ShellConfigurationException('Can not run without a shell binary. ' |
| 201 'Please pass --shell-path.') | 202 'Please pass --shell-path.') |
| 202 shell = LinuxShell(shell_config.shell_path) | 203 shell = LinuxShell(shell_config.shell_path) |
| 203 if shell_config.use_osmesa: | 204 if shell_config.use_osmesa: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 217 for (mime_type, | 218 for (mime_type, |
| 218 content_handler_url) in shell_config.content_handlers.iteritems(): | 219 content_handler_url) in shell_config.content_handlers.iteritems(): |
| 219 shell_args = append_to_argument(shell_args, '--content-handlers=', | 220 shell_args = append_to_argument(shell_args, '--content-handlers=', |
| 220 '%s,%s' % (mime_type, | 221 '%s,%s' % (mime_type, |
| 221 content_handler_url)) | 222 content_handler_url)) |
| 222 | 223 |
| 223 for dev_server_config in shell_config.dev_servers: | 224 for dev_server_config in shell_config.dev_servers: |
| 224 shell_args = _configure_dev_server(shell, shell_args, dev_server_config) | 225 shell_args = _configure_dev_server(shell, shell_args, dev_server_config) |
| 225 | 226 |
| 226 return shell, shell_args | 227 return shell, shell_args |
| OLD | NEW |