Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
index fff2d4c7cead96bf670a185cf1d6fd8df558bdfb..b2e498c5c15c43b592064df991d9d82f7b87f8fa 100644 |
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py |
@@ -27,7 +27,8 @@ |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
"""Abstract base class of Port-specific entry points for the layout tests |
-test infrastructure (the Port and Driver classes).""" |
+test infrastructure (the Port and Driver classes). |
+""" |
import collections |
import cgi |
@@ -307,7 +308,8 @@ class Port(object): |
def default_baseline_search_path(self): |
"""Return a list of absolute paths to directories to search under for |
- baselines. The directories are searched in order.""" |
+ baselines. The directories are searched in order. |
+ """ |
return map(self._webkit_baseline_path, self.FALLBACK_PATHS[self.version()]) |
@memoized |
@@ -534,7 +536,8 @@ class Port(object): |
def diff_text(self, expected_text, actual_text, expected_filename, actual_filename): |
"""Returns a string containing the diff of the two text strings |
- in 'unified diff' format.""" |
+ in 'unified diff' format. |
+ """ |
# The filenames show up in the diff output, make sure they're |
# raw bytes and not unicode, so that they don't trigger join() |
@@ -568,7 +571,8 @@ class Port(object): |
def expected_baselines_by_extension(self, test_name): |
"""Returns a dict mapping baseline suffix to relative path for each baseline in |
- a test. For reftests, it returns ".==" or ".!=" instead of the suffix.""" |
+ a test. For reftests, it returns ".==" or ".!=" instead of the suffix. |
+ """ |
# FIXME: The name similarity between this and expected_baselines() below, is unfortunate. |
# We should probably rename them both. |
baseline_dict = {} |
@@ -696,7 +700,8 @@ class Port(object): |
def expected_text(self, test_name): |
"""Returns the text output we expect the test to produce, or None |
if we don't expect there to be any text output. |
- End-of-line characters are normalized to '\n'.""" |
+ End-of-line characters are normalized to '\n'. |
+ """ |
# FIXME: DRT output is actually utf-8, but since we don't decode the |
# output from DRT (instead treating it as a binary string), we read the |
# baselines as a binary string, too. |
@@ -967,7 +972,8 @@ class Port(object): |
def name(self): |
"""Returns a name that uniquely identifies this particular type of port |
(e.g., "mac-snowleopard" or "linux-trusty" and can be passed |
- to factory.get() to instantiate the port.""" |
+ to factory.get() to instantiate the port. |
+ """ |
return self._name |
def operating_system(self): |
@@ -979,7 +985,8 @@ class Port(object): |
'leopard' or 'win7'. |
This is used to help identify the exact port when parsing test |
- expectations, determining search paths, and logging information.""" |
+ expectations, determining search paths, and logging information. |
+ """ |
return self._version |
def architecture(self): |
@@ -997,7 +1004,8 @@ class Port(object): |
def relative_test_filename(self, filename): |
"""Returns a test_name a relative unix-style path for a filename under the LayoutTests |
- directory. Ports may legitimately return abspaths here if no relpath makes sense.""" |
+ directory. Ports may legitimately return abspaths here if no relpath makes sense. |
+ """ |
# Ports that run on windows need to override this method to deal with |
# filenames with backslashes in them. |
if filename.startswith(self.layout_tests_dir()): |
@@ -1008,7 +1016,8 @@ class Port(object): |
@memoized |
def abspath_for_test(self, test_name): |
"""Returns the full path to the file for a given test name. This is the |
- inverse of relative_test_filename().""" |
+ inverse of relative_test_filename(). |
+ """ |
return self._filesystem.join(self.layout_tests_dir(), test_name) |
def results_directory(self): |
@@ -1111,7 +1120,8 @@ class Port(object): |
def show_results_html_file(self, results_filename): |
"""This routine should display the HTML file pointed at by |
- results_filename in a users' browser.""" |
+ results_filename in a users' browser. |
+ """ |
return self.host.user.open_url(abspath_to_uri(self.host.platform, results_filename)) |
def create_driver(self, worker_number, no_timeout=False): |
@@ -1121,7 +1131,8 @@ class Port(object): |
def start_helper(self): |
"""If a port needs to reconfigure graphics settings or do other |
things to ensure a known test configuration, it should override this |
- method.""" |
+ method. |
+ """ |
helper_path = self._path_to_helper() |
if helper_path: |
_log.debug("Starting layout helper %s", helper_path) |
@@ -1134,13 +1145,15 @@ class Port(object): |
def requires_http_server(self): |
"""Does the port require an HTTP server for running tests? This could |
- be the case when the tests aren't run on the host platform.""" |
+ be the case when the tests aren't run on the host platform. |
+ """ |
return False |
def start_http_server(self, additional_dirs, number_of_drivers): |
"""Start a web server. Raise an error if it can't start or is already running. |
- Ports can stub this out if they don't need a web server to be running.""" |
+ Ports can stub this out if they don't need a web server to be running. |
+ """ |
assert not self._http_server, 'Already running an http server.' |
server = apache_http.ApacheHTTP(self, self.results_directory(), |
@@ -1152,7 +1165,8 @@ class Port(object): |
def start_websocket_server(self): |
"""Start a web server. Raise an error if it can't start or is already running. |
- Ports can stub this out if they don't need a websocket server to be running.""" |
+ Ports can stub this out if they don't need a websocket server to be running. |
+ """ |
assert not self._websocket_server, 'Already running a websocket server.' |
server = pywebsocket.PyWebSocket(self, self.results_directory()) |
@@ -1174,7 +1188,8 @@ class Port(object): |
def start_wptserve(self): |
"""Start a WPT web server. Raise an error if it can't start or is already running. |
- Ports can stub this out if they don't need a WPT web server to be running.""" |
+ Ports can stub this out if they don't need a WPT web server to be running. |
+ """ |
assert not self._wpt_server, 'Already running an http server.' |
assert self.is_wptserve_enabled(), 'Cannot start server if WPT is not enabled.' |
@@ -1198,7 +1213,8 @@ class Port(object): |
def stop_helper(self): |
"""Shut down the test helper if it is running. Do nothing if |
it isn't, or it isn't available. If a port overrides start_helper() |
- it must override this routine as well.""" |
+ it must override this routine as well. |
+ """ |
if self._helper: |
_log.debug("Stopping layout test helper") |
try: |
@@ -1236,7 +1252,8 @@ class Port(object): |
@memoized |
def all_test_configurations(self): |
"""Returns a list of TestConfiguration instances, representing all available |
- test configurations for this port.""" |
+ test configurations for this port. |
+ """ |
return self._generate_all_test_configurations() |
# FIXME: Belongs on a Platform object. |
@@ -1248,7 +1265,8 @@ class Port(object): |
(precise, trusty) -> linux # Change specific name of Linux distro to a more generic term. |
Returns a dictionary, each key representing a macro term ('win', for example), |
- and value being a list of valid configuration specifiers (such as ['vista', 'win7']).""" |
+ and value being a list of valid configuration specifiers (such as ['vista', 'win7']). |
+ """ |
return self.CONFIGURATION_SPECIFIER_MACROS |
def _generate_all_test_configurations(self): |
@@ -1280,7 +1298,8 @@ class Port(object): |
so don't use names that are paths if they're not paths. |
Generally speaking the ordering should be files in the filesystem in cascade order |
(TestExpectations followed by Skipped, if the port honors both formats), |
- then any built-in expectations (e.g., from compile-time exclusions), then --additional-expectations options.""" |
+ then any built-in expectations (e.g., from compile-time exclusions), then --additional-expectations options. |
+ """ |
# FIXME: rename this to test_expectations() once all the callers are updated to know about the ordered dict. |
expectations = collections.OrderedDict() |
@@ -1367,7 +1386,8 @@ class Port(object): |
def _run_wdiff(self, actual_filename, expected_filename): |
"""Runs wdiff and may throw exceptions. |
- This is mostly a hook for unit testing.""" |
+ This is mostly a hook for unit testing. |
+ """ |
# Diffs are treated as binary as they may include multiple files |
# with conflicting encodings. Thus we do not decode the output. |
command = self._wdiff_command(actual_filename, expected_filename) |
@@ -1380,7 +1400,8 @@ class Port(object): |
def wdiff_text(self, actual_filename, expected_filename): |
"""Returns a string of HTML indicating the word-level diff of the |
contents of the two filenames. Returns an empty string if word-level |
- diffing isn't available.""" |
+ diffing isn't available. |
+ """ |
if not self.wdiff_available(): |
return "" |
try: |
@@ -1444,7 +1465,8 @@ class Port(object): |
If the WEBKIT_HTTP_SERVER_CONF_PATH environment variable is set, its |
contents will be used instead. |
- This is needed only by ports that use the apache_http_server module.""" |
+ This is needed only by ports that use the apache_http_server module. |
+ """ |
config_file_from_env = self.host.environ.get('WEBKIT_HTTP_SERVER_CONF_PATH') |
if config_file_from_env: |
if not self._filesystem.exists(config_file_from_env): |
@@ -1490,20 +1512,23 @@ class Port(object): |
is used to help configure the system for the test run, or None |
if no helper is needed. |
- This is likely only used by start/stop_helper().""" |
+ This is likely only used by start/stop_helper(). |
+ """ |
return None |
def _path_to_image_diff(self): |
"""Returns the full path to the image_diff binary, or None if it is not available. |
- This is likely used only by diff_image()""" |
+ This is likely used only by diff_image() |
+ """ |
return self._build_path('image_diff') |
@memoized |
def _path_to_wdiff(self): |
"""Returns the full path to the wdiff binary, or None if it is not available. |
- This is likely used only by wdiff_text()""" |
+ This is likely used only by wdiff_text() |
+ """ |
for path in ("/usr/bin/wdiff", "/usr/bin/dwdiff"): |
if self._filesystem.exists(path): |
return path |
@@ -1511,7 +1536,8 @@ class Port(object): |
def _webkit_baseline_path(self, platform): |
"""Return the full path to the top of the baseline tree for a |
- given platform.""" |
+ given platform. |
+ """ |
return self._filesystem.join(self.layout_tests_dir(), 'platform', platform) |
def _driver_class(self): |