OLD | NEW |
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 serve_local_directory(self, local_dir_path, port=0): | 9 def serve_local_directory(self, local_dir_path, port=0): |
10 """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 |
(...skipping 12 matching lines...) Expand all Loading... |
23 raise NotImplementedError() | 23 raise NotImplementedError() |
24 | 24 |
25 def serve_local_directories(self, mappings, port=0): | 25 def serve_local_directories(self, mappings, port=0): |
26 """Serves the content of the local (host) directories, making it available | 26 """Serves the content of the local (host) directories, making it available |
27 to the shell under the url returned by the function. | 27 to the shell under the url returned by the function. |
28 | 28 |
29 The server will run on a separate thread until the program terminates. The | 29 The server will run on a separate thread until the program terminates. The |
30 call returns immediately. | 30 call returns immediately. |
31 | 31 |
32 Args: | 32 Args: |
33 mappings: List of tuples (prefix, local_base_path) mapping URLs that start | 33 mappings: List of tuples (prefix, local_base_path_list) mapping URLs that |
34 with |prefix| to local directory at |local_base_path|. The prefixes | 34 start with |prefix| to one or more local directories enumerated in |
35 should skip the leading slash. The first matching prefix will be used | 35 |local_base_path_list|. The prefixes should skip the leading slash. |
36 each time. | 36 The first matching prefix and the first location that contains the |
| 37 requested file will be used each time. |
37 port: port at which the server will be available to the shell | 38 port: port at which the server will be available to the shell |
38 | 39 |
39 Returns: | 40 Returns: |
40 The url that the shell can use to access the content of |local_dir_path|. | 41 The url that the shell can use to access the server. |
41 """ | 42 """ |
42 raise NotImplementedError() | 43 raise NotImplementedError() |
43 | 44 |
44 def forward_host_port_to_shell(self, host_port): | 45 def forward_host_port_to_shell(self, host_port): |
45 """Forwards a port on the host machine to the same port wherever the shell | 46 """Forwards a port on the host machine to the same port wherever the shell |
46 is running. | 47 is running. |
47 | 48 |
48 This is a no-op if the shell is running locally. | 49 This is a no-op if the shell is running locally. |
49 """ | 50 """ |
50 raise NotImplementedError() | 51 raise NotImplementedError() |
(...skipping 18 matching lines...) Expand all Loading... |
69 terminated | 70 terminated |
70 | 71 |
71 Returns: | 72 Returns: |
72 A tuple of (return_code, output, did_time_out). |return_code| is the exit | 73 A tuple of (return_code, output, did_time_out). |return_code| is the exit |
73 code returned by the shell or None if the exit code cannot be retrieved. | 74 code returned by the shell or None if the exit code cannot be retrieved. |
74 |output| is the stdout mingled with the stderr produced by the shell. | 75 |output| is the stdout mingled with the stderr produced by the shell. |
75 |did_time_out| is True iff the shell was terminated because it exceeded | 76 |did_time_out| is True iff the shell was terminated because it exceeded |
76 the |timeout| and False otherwise. | 77 the |timeout| and False otherwise. |
77 """ | 78 """ |
78 raise NotImplementedError() | 79 raise NotImplementedError() |
OLD | NEW |