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

Unified Diff: mojo/devtools/common/devtoolslib/shell_arguments.py

Issue 1162923004: Move the logic to set up a local origin for shell run to shell_arguments.py. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/tools/android_mojo_shell.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/devtools/common/devtoolslib/shell_arguments.py
diff --git a/mojo/devtools/common/devtoolslib/shell_arguments.py b/mojo/devtools/common/devtoolslib/shell_arguments.py
index b9954096abbca9c37bafd76b870b416b0a2c4e92..afb4fb5aafdc74c67e24c259cdfe798f6a2e9a2b 100644
--- a/mojo/devtools/common/devtoolslib/shell_arguments.py
+++ b/mojo/devtools/common/devtoolslib/shell_arguments.py
@@ -7,6 +7,8 @@ list."""
import urlparse
+_LOCAL_ORIGIN_PORT = 31337
+
_MAP_ORIGIN_PREFIX = '--map-origin='
# When spinning up servers for local origins, we want to use predictable ports
# so that caching works between subsequent runs with the same command line.
@@ -79,3 +81,16 @@ def ConfigureDebugger(shell):
"""
shell.ForwardHostPortToShell(_MOJO_DEBUGGER_PORT)
return ['mojo:debugger %d' % _MOJO_DEBUGGER_PORT]
+
+
+def ConfigureLocalOrigin(shell, local_dir, fixed_port=True):
+ """Sets up a local http server to serve files in |local_dir| along with
+ device port forwarding if needed.
+
+ Returns:
+ The list of arguments to be appended to the shell argument list.
+ """
+
+ origin_url = shell.ServeLocalDirectory(
+ local_dir, _LOCAL_ORIGIN_PORT if fixed_port else 0)
+ return ["--origin=" + origin_url]
« no previous file with comments | « mojo/devtools/common/devtoolslib/android_shell.py ('k') | mojo/tools/android_mojo_shell.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698