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

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

Issue 1268713005: Unify method name casing in devtools. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
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 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
11 the shell under the url returned by the function. 11 the shell under the url returned by the function.
12 12
13 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
14 call returns immediately. 14 call returns immediately.
15 15
16 Args: 16 Args:
17 local_dir_path: path to the directory to be served 17 local_dir_path: path to the directory to be served
18 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
19 19
20 Returns: 20 Returns:
21 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 """ 22 """
23 raise NotImplementedError() 23 raise NotImplementedError()
24 24
25 def ServeLocalDirectories(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) mapping URLs that start
34 with |prefix| to local directory at |local_base_path|. The prefixes 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 35 should skip the leading slash. The first matching prefix will be used
36 each time. 36 each time.
37 port: port at which the server will be available to the shell 37 port: port at which the server will be available to the shell
38 38
39 Returns: 39 Returns:
40 The url that the shell can use to access the content of |local_dir_path|. 40 The url that the shell can use to access the content of |local_dir_path|.
41 """ 41 """
42 raise NotImplementedError() 42 raise NotImplementedError()
43 43
44 def ForwardHostPortToShell(self, host_port): 44 def forward_host_port_to_shell(self, host_port):
45 """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
46 is running. 46 is running.
47 47
48 This is a no-op if the shell is running locally. 48 This is a no-op if the shell is running locally.
49 """ 49 """
50 raise NotImplementedError() 50 raise NotImplementedError()
51 51
52 def Run(self, arguments): 52 def run(self, arguments):
53 """Runs the shell with given arguments until shell exits, passing the stdout 53 """Runs the shell with given arguments until shell exits, passing the stdout
54 mingled with stderr produced by the shell onto the stdout. 54 mingled with stderr produced by the shell onto the stdout.
55 55
56 Returns: 56 Returns:
57 Exit code retured by the shell or None if the exit code cannot be 57 Exit code retured by the shell or None if the exit code cannot be
58 retrieved. 58 retrieved.
59 """ 59 """
60 raise NotImplementedError() 60 raise NotImplementedError()
61 61
62 def RunAndGetOutput(self, arguments, timeout=None): 62 def run_and_get_output(self, arguments, timeout=None):
63 """Runs the shell with given arguments until shell exits and returns the 63 """Runs the shell with given arguments until shell exits and returns the
64 output. 64 output.
65 65
66 Args: 66 Args:
67 arguments: list of arguments for the shell 67 arguments: list of arguments for the shell
68 timeout: maximum running time in seconds, after which the shell will be 68 timeout: maximum running time in seconds, after which the shell will be
69 terminated 69 terminated
70 70
71 Returns: 71 Returns:
72 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
73 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.
74 |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.
75 |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
76 the |timeout| and False otherwise. 76 the |timeout| and False otherwise.
77 """ 77 """
78 raise NotImplementedError() 78 raise NotImplementedError()
OLDNEW
« no previous file with comments | « mojo/devtools/common/devtoolslib/linux_shell.py ('k') | mojo/devtools/common/devtoolslib/shell_arguments.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698