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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 2511333002: Cleanup after enabling WPTServe. (Closed)
Patch Set: Update a comment, remove the right testharnessreport.js Created 3 years, 11 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 (C) 2010 Google Inc. All rights reserved. 1 # Copyright (C) 2010 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 # options defined on it. 162 # options defined on it.
163 self._options = options or optparse.Values() 163 self._options = options or optparse.Values()
164 164
165 self.host = host 165 self.host = host
166 self._executive = host.executive 166 self._executive = host.executive
167 self._filesystem = host.filesystem 167 self._filesystem = host.filesystem
168 self._webkit_finder = WebKitFinder(host.filesystem) 168 self._webkit_finder = WebKitFinder(host.filesystem)
169 169
170 self._http_server = None 170 self._http_server = None
171 self._websocket_server = None 171 self._websocket_server = None
172 self._is_wptserve_enabled = getattr(options, 'enable_wptserve', False)
173 self._wpt_server = None 172 self._wpt_server = None
174 self._image_differ = None 173 self._image_differ = None
175 self.server_process_constructor = server_process.ServerProcess # overri dable for testing 174 self.server_process_constructor = server_process.ServerProcess # overri dable for testing
176 self._http_lock = None # FIXME: Why does this live on the port object? 175 self._http_lock = None # FIXME: Why does this live on the port object?
177 self._dump_reader = None 176 self._dump_reader = None
178 177
179 # FIXME: prettypatch.py knows this path, why is it copied here? 178 # FIXME: prettypatch.py knows this path, why is it copied here?
180 self._pretty_patch_path = self.path_from_webkit_base("Tools", "Scripts", "webkitruby", "PrettyPatch", "prettify.rb") 179 self._pretty_patch_path = self.path_from_webkit_base("Tools", "Scripts", "webkitruby", "PrettyPatch", "prettify.rb")
181 self._pretty_patch_available = None 180 self._pretty_patch_available = None
182 181
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
1140 """Start a web server. Raise an error if it can't start or is already ru nning. 1139 """Start a web server. Raise an error if it can't start or is already ru nning.
1141 1140
1142 Ports can stub this out if they don't need a websocket server to be runn ing. 1141 Ports can stub this out if they don't need a websocket server to be runn ing.
1143 """ 1142 """
1144 assert not self._websocket_server, 'Already running a websocket server.' 1143 assert not self._websocket_server, 'Already running a websocket server.'
1145 1144
1146 server = pywebsocket.PyWebSocket(self, self.results_directory()) 1145 server = pywebsocket.PyWebSocket(self, self.results_directory())
1147 server.start() 1146 server.start()
1148 self._websocket_server = server 1147 self._websocket_server = server
1149 1148
1150 def is_wptserve_enabled(self):
1151 """Used as feature flag for WPT Serve feature."""
1152 return self._is_wptserve_enabled
1153
1154 @staticmethod 1149 @staticmethod
1155 def is_wptserve_test(test): 1150 def is_wptserve_test(test):
1156 """Whether wptserve should be used for a given test if enabled.""" 1151 """Whether wptserve should be used for a given test if enabled."""
1157 return test.startswith("external/wpt/") 1152 return test.startswith("external/wpt/")
1158 1153
1159 def should_use_wptserve(self, test): 1154 def should_use_wptserve(self, test):
1160 return self.is_wptserve_enabled() and self.is_wptserve_test(test) 1155 return self.is_wptserve_test(test)
1161 1156
1162 def start_wptserve(self): 1157 def start_wptserve(self):
1163 """Start a WPT web server. Raise an error if it can't start or is alread y running. 1158 """Start a WPT web server. Raise an error if it can't start or is alread y running.
1164 1159
1165 Ports can stub this out if they don't need a WPT web server to be runnin g. 1160 Ports can stub this out if they don't need a WPT web server to be runnin g.
1166 """ 1161 """
1167 assert not self._wpt_server, 'Already running an http server.' 1162 assert not self._wpt_server, 'Already running an http server.'
1168 assert self.is_wptserve_enabled(), 'Cannot start server if WPT is not en abled.'
1169 1163
1170 # We currently don't support any output mechanism for the WPT server. 1164 # We currently don't support any output mechanism for the WPT server.
1171 server = wptserve.WPTServe(self, self.results_directory()) 1165 server = wptserve.WPTServe(self, self.results_directory())
1172 server.start() 1166 server.start()
1173 self._wpt_server = server 1167 self._wpt_server = server
1174 1168
1175 def stop_wptserve(self): 1169 def stop_wptserve(self):
1176 """Shut down the WPT server if it is running. Do nothing if it isn't.""" 1170 """Shut down the WPT server if it is running. Do nothing if it isn't."""
1177 if self._wpt_server: 1171 if self._wpt_server:
1178 self._wpt_server.stop() 1172 self._wpt_server.stop()
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 _log.warning("Unexpected ignore mode: '%s'.", ignore_mode) 1308 _log.warning("Unexpected ignore mode: '%s'.", ignore_mode)
1315 return {} 1309 return {}
1316 1310
1317 def expectations_files(self): 1311 def expectations_files(self):
1318 paths = [ 1312 paths = [
1319 self.path_to_generic_test_expectations_file(), 1313 self.path_to_generic_test_expectations_file(),
1320 self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests'), 1314 self._filesystem.join(self.layout_tests_dir(), 'NeverFixTests'),
1321 self._filesystem.join(self.layout_tests_dir(), 'StaleTestExpectation s'), 1315 self._filesystem.join(self.layout_tests_dir(), 'StaleTestExpectation s'),
1322 self._filesystem.join(self.layout_tests_dir(), 'SlowTests'), 1316 self._filesystem.join(self.layout_tests_dir(), 'SlowTests'),
1323 ] 1317 ]
1324 if self.is_wptserve_enabled():
1325 paths.append(self._filesystem.join(self.layout_tests_dir(), 'WPTServ eExpectations'))
1326 paths.extend(self._flag_specific_expectations_files()) 1318 paths.extend(self._flag_specific_expectations_files())
1327 return paths 1319 return paths
1328 1320
1329 def repository_path(self): 1321 def repository_path(self):
1330 """Returns the repository path for the chromium code base.""" 1322 """Returns the repository path for the chromium code base."""
1331 return self.path_from_chromium_base('build') 1323 return self.path_from_chromium_base('build')
1332 1324
1333 # This is a class variable so we can test error output easily. 1325 # This is a class variable so we can test error output easily.
1334 _pretty_patch_error_html = "Failed to run PrettyPatch, see error log." 1326 _pretty_patch_error_html = "Failed to run PrettyPatch, see error log."
1335 1327
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 1643
1652 def __init__(self, base, args, reference_args=None): 1644 def __init__(self, base, args, reference_args=None):
1653 self.name = base 1645 self.name = base
1654 self.base = base 1646 self.base = base
1655 self.args = args 1647 self.args = args
1656 self.reference_args = args if reference_args is None else reference_args 1648 self.reference_args = args if reference_args is None else reference_args
1657 self.tests = set() 1649 self.tests = set()
1658 1650
1659 def __repr__(self): 1651 def __repr__(self):
1660 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args) 1652 return "PhysicalTestSuite('%s', '%s', %s, %s)" % (self.name, self.base, self.args, self.reference_args)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698