Chromium Code Reviews| Index: mojo/devtools/common/devtoolslib/android_shell.py |
| diff --git a/mojo/devtools/common/devtoolslib/android_shell.py b/mojo/devtools/common/devtoolslib/android_shell.py |
| index 4bae3de4449c5de79b7ba20bcd41a67d3d93a756..80c87ceaaa1271fbf29595a69a11343234fda336 100644 |
| --- a/mojo/devtools/common/devtoolslib/android_shell.py |
| +++ b/mojo/devtools/common/devtoolslib/android_shell.py |
| @@ -142,7 +142,7 @@ class AndroidShell(Shell): |
| atexit.register(_UnmapPort) |
| return device_port |
| - def _StartHttpServerForDirectory(self, path, port=0): |
| + def _StartHttpServerForDirectory(self, path, device_port=0): |
| """Starts an http server serving files from |path|. Returns the local |
| url. |
| """ |
| @@ -151,7 +151,8 @@ class AndroidShell(Shell): |
| server_address = StartHttpServer(path) |
| print 'local port=%d' % server_address[1] |
| - return 'http://127.0.0.1:%d/' % self._MapPort(port, server_address[1]) |
| + return 'http://127.0.0.1:%d/' % self._MapPort(device_port, |
| + server_address[1]) |
| def _StartHttpServerForOriginMapping(self, mapping, port): |
| """If |mapping| points at a local file starts an http server to serve files |
| @@ -223,6 +224,19 @@ class AndroidShell(Shell): |
| local_dir, DEFAULT_BASE_PORT if fixed_port else 0) |
| return "--origin=" + origin_url |
| + def ServeLocalDirectory(self, local_dir_path, port=0): |
| + """Serves the content of the local (host) directory, making it available to |
| + the shell under the url returned by the function. |
| + |
| + The server will run on a separate thread until the program terminates. The |
| + call returns immediately. |
| + |
| + Args: |
| + local_dir_path: path to the directory to be served |
| + port: port at which the server will be available to the shell |
| + """ |
| + return self._StartHttpServerForDirectory(local_dir_path, port) |
|
qsr
2015/05/19 13:55:42
You are just delegatng to a private method -> you
ppi
2015/05/19 14:22:48
Done.
|
| + |
| def StartShell(self, |
| arguments, |
| stdout=None, |