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

Side by Side Diff: mojo/devtools/common/devtoolslib/shell_arguments.py

Issue 1250423007: Process --map-origin and --map-url flags regardless of the platform. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 """Functions that configure the shell before it is run manipulating its argument 5 """Functions that configure the shell before it is run manipulating its argument
6 list. 6 list.
7 """ 7 """
8 8
9 import os.path 9 import os.path
10 import sys 10 import sys
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 '"<url>=<url-or-local-path>"') 57 '"<url>=<url-or-local-path>"')
58 if _is_web_url(parts[1]): 58 if _is_web_url(parts[1]):
59 # The destination is a web url, do nothing. 59 # The destination is a web url, do nothing.
60 return mapping 60 return mapping
61 61
62 src = parts[0] 62 src = parts[0]
63 dest = host_destination_functon(shell, parts[1], port) 63 dest = host_destination_functon(shell, parts[1], port)
64 return src + '=' + dest 64 return src + '=' + dest
65 65
66 66
67 def _apply_appings(shell, original_arguments, map_urls, map_origins): 67 def _apply_mappings(shell, original_arguments, map_urls, map_origins):
68 """Applies mappings for specified urls and origins. For each local path 68 """Applies mappings for specified urls and origins. For each local path
69 specified as destination a local server will be spawned and the mapping will 69 specified as destination a local server will be spawned and the mapping will
70 be rewritten accordingly. 70 be rewritten accordingly.
71 71
72 Args: 72 Args:
73 shell: The shell that is being configured. 73 shell: The shell that is being configured.
74 original_arguments: Current list of shell arguments. 74 original_arguments: Current list of shell arguments.
75 map_urls: List of url mappings, each in the form of 75 map_urls: List of url mappings, each in the form of
76 <url>=<url-or-local-path>. 76 <url>=<url-or-local-path>.
77 map_origins: List of origin mappings, each in the form of 77 map_origins: List of origin mappings, each in the form of
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 verbose_pipe = sys.stdout if config_args.verbose else None 248 verbose_pipe = sys.stdout if config_args.verbose else None
249 249
250 shell = AndroidShell(config_args.adb_path, config_args.target_device, 250 shell = AndroidShell(config_args.adb_path, config_args.target_device,
251 logcat_tags=config_args.logcat_tags, 251 logcat_tags=config_args.logcat_tags,
252 verbose_pipe=verbose_pipe) 252 verbose_pipe=verbose_pipe)
253 device_status, error = shell.CheckDevice() 253 device_status, error = shell.CheckDevice()
254 if not device_status: 254 if not device_status:
255 raise ShellConfigurationException('Device check failed: ' + error) 255 raise ShellConfigurationException('Device check failed: ' + error)
256 if config_args.shell_path: 256 if config_args.shell_path:
257 shell.InstallApk(config_args.shell_path) 257 shell.InstallApk(config_args.shell_path)
258
259 shell_args = _apply_appings(shell, shell_args, config_args.map_url,
260 config_args.map_origin)
261 else: 258 else:
262 if not config_args.shell_path: 259 if not config_args.shell_path:
263 raise ShellConfigurationException('Can not run without a shell binary. ' 260 raise ShellConfigurationException('Can not run without a shell binary. '
264 'Please pass --shell-path.') 261 'Please pass --shell-path.')
265 shell = LinuxShell(config_args.shell_path) 262 shell = LinuxShell(config_args.shell_path)
266 if config_args.use_osmesa: 263 if config_args.use_osmesa:
267 shell_args.append('--args-for=mojo:native_viewport_service --use-osmesa') 264 shell_args.append('--args-for=mojo:native_viewport_service --use-osmesa')
268 265
266 shell_args = _apply_mappings(shell, shell_args, config_args.map_url,
267 config_args.map_origin)
268
269 if config_args.origin: 269 if config_args.origin:
270 if _is_web_url(config_args.origin): 270 if _is_web_url(config_args.origin):
271 shell_args.append('--origin=' + config_args.origin) 271 shell_args.append('--origin=' + config_args.origin)
272 else: 272 else:
273 shell_args.extend(configure_local_origin(shell, config_args.origin, 273 shell_args.extend(configure_local_origin(shell, config_args.origin,
274 fixed_port=True)) 274 fixed_port=True))
275 275
276 return shell, shell_args 276 return shell, shell_args
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698