Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 atexit | 5 import atexit |
| 6 import datetime | 6 import datetime |
| 7 import email.utils | 7 import email.utils |
| 8 import hashlib | 8 import hashlib |
| 9 import itertools | 9 import itertools |
| 10 import json | 10 import json |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 324 Returns arguments that should be appended to shell argument list.""" | 324 Returns arguments that should be appended to shell argument list.""" |
| 325 if 'cannot run as root' in subprocess.check_output( | 325 if 'cannot run as root' in subprocess.check_output( |
| 326 self._CreateADBCommand(['root'])): | 326 self._CreateADBCommand(['root'])): |
| 327 raise Exception("Unable to run adb as root.") | 327 raise Exception("Unable to run adb as root.") |
| 328 subprocess.check_call( | 328 subprocess.check_call( |
| 329 self._CreateADBCommand(['install', '-r', self.shell_apk_path, '-i', | 329 self._CreateADBCommand(['install', '-r', self.shell_apk_path, '-i', |
| 330 self.target_package])) | 330 self.target_package])) |
| 331 atexit.register(self.StopShell) | 331 atexit.register(self.StopShell) |
| 332 | 332 |
| 333 extra_shell_args = [] | 333 extra_shell_args = [] |
| 334 if origin: | 334 origin_url = origin if origin else self._StartHttpServerForDirectory( |
|
sky
2015/05/12 19:39:53
I added this code because mandoline doesn't specif
msw
2015/05/12 20:53:07
OK, now it respects origin=None and starts a serve
| |
| 335 origin_url = origin if origin else self._StartHttpServerForDirectory( | 335 self.local_dir, DEFAULT_BASE_PORT if fixed_port else 0) |
| 336 self.local_dir, DEFAULT_BASE_PORT if fixed_port else 0) | 336 extra_shell_args.append("--origin=" + origin_url) |
| 337 extra_shell_args.append("--origin=" + origin_url) | |
| 338 | 337 |
| 339 return extra_shell_args | 338 return extra_shell_args |
| 340 | 339 |
| 341 def StartShell(self, | 340 def StartShell(self, |
| 342 arguments, | 341 arguments, |
| 343 stdout=None, | 342 stdout=None, |
| 344 on_application_stop=None, | 343 on_application_stop=None, |
| 345 fixed_port=True): | 344 fixed_port=True): |
| 346 """ | 345 """ |
| 347 Starts the mojo shell, passing it the given arguments. | 346 Starts the mojo shell, passing it the given arguments. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 400 |
| 402 Returns the process responsible for reading the logs. | 401 Returns the process responsible for reading the logs. |
| 403 """ | 402 """ |
| 404 logcat = subprocess.Popen(self._CreateADBCommand([ | 403 logcat = subprocess.Popen(self._CreateADBCommand([ |
| 405 'logcat', | 404 'logcat', |
| 406 '-s', | 405 '-s', |
| 407 ' '.join(LOGCAT_TAGS)]), | 406 ' '.join(LOGCAT_TAGS)]), |
| 408 stdout=sys.stdout) | 407 stdout=sys.stdout) |
| 409 atexit.register(_ExitIfNeeded, logcat) | 408 atexit.register(_ExitIfNeeded, logcat) |
| 410 return logcat | 409 return logcat |
| OLD | NEW |