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

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

Issue 1259763013: Devtools: add ServeLocalDirectories(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add one more comment. 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 | « mojo/devtools/common/devtoolslib/linux_shell.py ('k') | 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 5
6 class Shell(object): 6 class Shell(object):
7 """Represents an abstract Mojo shell.""" 7 """Represents an abstract Mojo shell."""
8 8
9 def ServeLocalDirectory(self, local_dir_path, port=0, 9 def ServeLocalDirectory(self, local_dir_path, port=0):
10 additional_mappings=None):
11 """Serves the content of the local (host) directory, making it available to 10 """Serves the content of the local (host) directory, making it available to
12 the shell under the url returned by the function. 11 the shell under the url returned by the function.
13 12
14 The server will run on a separate thread until the program terminates. The 13 The server will run on a separate thread until the program terminates. The
15 call returns immediately. 14 call returns immediately.
16 15
17 Args: 16 Args:
18 local_dir_path: path to the directory to be served 17 local_dir_path: path to the directory to be served
19 port: port at which the server will be available to the shell 18 port: port at which the server will be available to the shell
20 additional_mappings: List of tuples (prefix, local_base_path) mapping
21 URLs that start with |prefix| to local directory at |local_base_path|.
22 The prefixes should skip the leading slash.
23 19
24 Returns: 20 Returns:
25 The url that the shell can use to access the content of |local_dir_path|. 21 The url that the shell can use to access the content of |local_dir_path|.
22 """
23 raise NotImplementedError()
24
25 def ServeLocalDirectories(self, mappings, port=0):
26 """Serves the content of the local (host) directories, making it available
27 to the shell under the url returned by the function.
28
29 The server will run on a separate thread until the program terminates. The
30 call returns immediately.
31
32 Args:
33 mappings: List of tuples (prefix, local_base_path) mapping URLs that start
34 with |prefix| to local directory at |local_base_path|. The prefixes
35 should skip the leading slash. The first matching prefix will be used
36 each time.
37 port: port at which the server will be available to the shell
38
39 Returns:
40 The url that the shell can use to access the content of |local_dir_path|.
26 """ 41 """
27 raise NotImplementedError() 42 raise NotImplementedError()
28 43
29 def ForwardHostPortToShell(self, host_port): 44 def ForwardHostPortToShell(self, host_port):
30 """Forwards a port on the host machine to the same port wherever the shell 45 """Forwards a port on the host machine to the same port wherever the shell
31 is running. 46 is running.
32 47
33 This is a no-op if the shell is running locally. 48 This is a no-op if the shell is running locally.
34 """ 49 """
35 raise NotImplementedError() 50 raise NotImplementedError()
(...skipping 18 matching lines...) Expand all
54 terminated 69 terminated
55 70
56 Returns: 71 Returns:
57 A tuple of (return_code, output, did_time_out). |return_code| is the exit 72 A tuple of (return_code, output, did_time_out). |return_code| is the exit
58 code returned by the shell or None if the exit code cannot be retrieved. 73 code returned by the shell or None if the exit code cannot be retrieved.
59 |output| is the stdout mingled with the stderr produced by the shell. 74 |output| is the stdout mingled with the stderr produced by the shell.
60 |did_time_out| is True iff the shell was terminated because it exceeded 75 |did_time_out| is True iff the shell was terminated because it exceeded
61 the |timeout| and False otherwise. 76 the |timeout| and False otherwise.
62 """ 77 """
63 raise NotImplementedError() 78 raise NotImplementedError()
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/linux_shell.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698