| 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, free_host_port=False): | |
| 10 """Serves the content of the local (host) directory, making it available to | |
| 11 the shell under the url returned by the function. | |
| 12 | |
| 13 The server will run on a separate thread until the program terminates. The | |
| 14 call returns immediately. | |
| 15 | |
| 16 Args: | |
| 17 local_dir_path: path to the directory to be served | |
| 18 port: port at which the server will be available to the shell. On Android | |
| 19 this can be different from the port on which the server runs on the | |
| 20 host. | |
| 21 free_host_port: spawn the server a system allocated port. This is ignored | |
| 22 on Linux, where |port| indicates the port on which the server will be | |
| 23 spawned. | |
| 24 | |
| 25 Returns: | |
| 26 The url that the shell can use to access the content of |local_dir_path|. | |
| 27 """ | |
| 28 raise NotImplementedError() | |
| 29 | |
| 30 def serve_local_directories(self, mappings, port=0, free_host_port=False): | 9 def serve_local_directories(self, mappings, port=0, free_host_port=False): |
| 31 """Serves the content of the local (host) directories, making it available | 10 """Serves the content of the local (host) directories, making it available |
| 32 to the shell under the url returned by the function. | 11 to the shell under the url returned by the function. |
| 33 | 12 |
| 34 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 |
| 35 call returns immediately. | 14 call returns immediately. |
| 36 | 15 |
| 37 Args: | 16 Args: |
| 38 mappings: List of tuples (prefix, local_base_path_list) mapping URLs that | 17 mappings: List of tuples (prefix, local_base_path_list) mapping URLs that |
| 39 start with |prefix| to one or more local directories enumerated in | 18 start with |prefix| to one or more local directories enumerated in |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 terminated | 59 terminated |
| 81 | 60 |
| 82 Returns: | 61 Returns: |
| 83 A tuple of (return_code, output, did_time_out). |return_code| is the exit | 62 A tuple of (return_code, output, did_time_out). |return_code| is the exit |
| 84 code returned by the shell or None if the exit code cannot be retrieved. | 63 code returned by the shell or None if the exit code cannot be retrieved. |
| 85 |output| is the stdout mingled with the stderr produced by the shell. | 64 |output| is the stdout mingled with the stderr produced by the shell. |
| 86 |did_time_out| is True iff the shell was terminated because it exceeded | 65 |did_time_out| is True iff the shell was terminated because it exceeded |
| 87 the |timeout| and False otherwise. | 66 the |timeout| and False otherwise. |
| 88 """ | 67 """ |
| 89 raise NotImplementedError() | 68 raise NotImplementedError() |
| OLD | NEW |