Amend Android scripting to allow remote execution.

These changes allow scripts to work over ssh with appropriate port
forwarding (with local device and remote host):

 - use predictable port number on the host when setting up local origin
   for mojo: urls
 - use fixed port when running apptests
 - change the default ports to avoid the ones used by system services on
   some ubiquitous VM setups

R=etiennej@chromium.org

Review URL: https://codereview.chromium.org/1189123002.

Cr-Mirrored-From: https://github.com/domokit/mojo
Cr-Mirrored-Commit: 4890edece25d92d994e2f816f247c9b6d73a336a
diff --git a/devtoolslib/android_shell.py b/devtoolslib/android_shell.py
index 15121df..f29a513 100644
--- a/devtoolslib/android_shell.py
+++ b/devtoolslib/android_shell.py
@@ -323,7 +323,7 @@
     """
     assert local_dir_path
     print 'starting http for', local_dir_path
-    server_address = StartHttpServer(local_dir_path,
+    server_address = StartHttpServer(local_dir_path, host_port=port,
                                      additional_mappings=additional_mappings)
 
     print 'local port=%d' % server_address[1]
diff --git a/devtoolslib/shell_arguments.py b/devtoolslib/shell_arguments.py
index c9f7d05..f8b25f5 100644
--- a/devtoolslib/shell_arguments.py
+++ b/devtoolslib/shell_arguments.py
@@ -7,12 +7,12 @@
 
 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.
-_MAP_ORIGIN_BASE_PORT = 31338
+_LOCAL_ORIGIN_PORT = 31840
+_MAP_ORIGIN_BASE_PORT = 31841
+
+_MAP_ORIGIN_PREFIX = '--map-origin='
 
 # Port on which the mojo:debugger http server will be available on the host
 # machine.