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

Side by Side Diff: Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner_unittest.py

Issue 17320009: Remove the 'http_lock' and 'file_lock' code from webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix merge again Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (C) 2012 Google Inc. All rights reserved. 1 # Copyright (C) 2012 Google Inc. All rights reserved.
2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged 2 # Copyright (C) 2010 Gabor Rapcsanyi (rgabor@inf.u-szeged.hu), University of Sze ged
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 options = run_webkit_tests.parse_args(['--platform', 'test-mac-snowleopa rd'])[0] 97 options = run_webkit_tests.parse_args(['--platform', 'test-mac-snowleopa rd'])[0]
98 options.child_processes = '1' 98 options.child_processes = '1'
99 99
100 host = MockHost() 100 host = MockHost()
101 port = port or host.port_factory.get(options.platform, options=options) 101 port = port or host.port_factory.get(options.platform, options=options)
102 return LockCheckingRunner(port, options, FakePrinter(), self, True) 102 return LockCheckingRunner(port, options, FakePrinter(), self, True)
103 103
104 def _run_tests(self, runner, tests): 104 def _run_tests(self, runner, tests):
105 test_inputs = [TestInput(test, 6000) for test in tests] 105 test_inputs = [TestInput(test, 6000) for test in tests]
106 expectations = TestExpectations(runner._port, tests) 106 expectations = TestExpectations(runner._port, tests)
107 runner.run_tests(expectations, test_inputs, set(), 107 runner.run_tests(expectations, test_inputs, set(), num_workers=1, retryi ng=False)
108 num_workers=1, needs_http=any('http' in test for test in tests), nee ds_websockets=any(['websocket' in test for test in tests]), retrying=False)
109
110 def test_http_locking(self):
111 runner = self._runner()
112 self._run_tests(runner, ['http/tests/passes/text.html', 'passes/text.htm l'])
113
114 def test_perf_locking(self):
115 runner = self._runner()
116 self._run_tests(runner, ['http/tests/passes/text.html', 'perf/foo/test.h tml'])
117 108
118 def test_interrupt_if_at_failure_limits(self): 109 def test_interrupt_if_at_failure_limits(self):
119 runner = self._runner() 110 runner = self._runner()
120 runner._options.exit_after_n_failures = None 111 runner._options.exit_after_n_failures = None
121 runner._options.exit_after_n_crashes_or_times = None 112 runner._options.exit_after_n_crashes_or_times = None
122 test_names = ['passes/text.html', 'passes/image.html'] 113 test_names = ['passes/text.html', 'passes/image.html']
123 runner._test_inputs = [TestInput(test_name, 6000) for test_name in test_ names] 114 runner._test_inputs = [TestInput(test_name, 6000) for test_name in test_ names]
124 115
125 run_results = TestRunResults(TestExpectations(runner._port, test_names), len(test_names)) 116 run_results = TestRunResults(TestExpectations(runner._port, test_names), len(test_names))
126 run_results.unexpected_failures = 100 117 run_results.unexpected_failures = 100
(...skipping 30 matching lines...) Expand all
157 runner._update_summary_with_result(run_results, result) 148 runner._update_summary_with_result(run_results, result)
158 self.assertEqual(1, run_results.expected) 149 self.assertEqual(1, run_results.expected)
159 self.assertEqual(0, run_results.unexpected) 150 self.assertEqual(0, run_results.unexpected)
160 151
161 run_results = TestRunResults(expectations, 1) 152 run_results = TestRunResults(expectations, 1)
162 result = TestResult(test_name=test, failures=[], reftest_type=['==']) 153 result = TestResult(test_name=test, failures=[], reftest_type=['=='])
163 runner._update_summary_with_result(run_results, result) 154 runner._update_summary_with_result(run_results, result)
164 self.assertEqual(0, run_results.expected) 155 self.assertEqual(0, run_results.expected)
165 self.assertEqual(1, run_results.unexpected) 156 self.assertEqual(1, run_results.unexpected)
166 157
167 def test_servers_started(self):
168
169 def start_http_server(number_of_servers=None):
170 self.http_started = True
171
172 def start_websocket_server():
173 self.websocket_started = True
174
175 def stop_http_server():
176 self.http_stopped = True
177
178 def stop_websocket_server():
179 self.websocket_stopped = True
180
181 host = MockHost()
182 port = host.port_factory.get('test-mac-leopard')
183 port.start_http_server = start_http_server
184 port.start_websocket_server = start_websocket_server
185 port.stop_http_server = stop_http_server
186 port.stop_websocket_server = stop_websocket_server
187
188 self.http_started = self.http_stopped = self.websocket_started = self.we bsocket_stopped = False
189 runner = self._runner(port=port)
190 runner._needs_http = True
191 runner._needs_websockets = False
192 runner.start_servers_with_lock(number_of_servers=4)
193 self.assertEqual(self.http_started, True)
194 self.assertEqual(self.websocket_started, False)
195 runner.stop_servers_with_lock()
196 self.assertEqual(self.http_stopped, True)
197 self.assertEqual(self.websocket_stopped, False)
198
199 self.http_started = self.http_stopped = self.websocket_started = self.we bsocket_stopped = False
200 runner._needs_http = True
201 runner._needs_websockets = True
202 runner.start_servers_with_lock(number_of_servers=4)
203 self.assertEqual(self.http_started, True)
204 self.assertEqual(self.websocket_started, True)
205 runner.stop_servers_with_lock()
206 self.assertEqual(self.http_stopped, True)
207 self.assertEqual(self.websocket_stopped, True)
208
209 self.http_started = self.http_stopped = self.websocket_started = self.we bsocket_stopped = False
210 runner._needs_http = False
211 runner._needs_websockets = False
212 runner.start_servers_with_lock(number_of_servers=4)
213 self.assertEqual(self.http_started, False)
214 self.assertEqual(self.websocket_started, False)
215 runner.stop_servers_with_lock()
216 self.assertEqual(self.http_stopped, False)
217 self.assertEqual(self.websocket_stopped, False)
218
219 158
220 class SharderTests(unittest.TestCase): 159 class SharderTests(unittest.TestCase):
221 160
222 test_list = [ 161 test_list = [
223 "http/tests/websocket/tests/unicode.htm", 162 "http/tests/websocket/tests/unicode.htm",
224 "animations/keyframes.html", 163 "animations/keyframes.html",
225 "http/tests/security/view-source-no-refresh.html", 164 "http/tests/security/view-source-no-refresh.html",
226 "http/tests/websocket/tests/websocket-protocol-ignored.html", 165 "http/tests/websocket/tests/websocket-protocol-ignored.html",
227 "fast/css/display-none-inline-style-change-crash.html", 166 "fast/css/display-none-inline-style-change-crash.html",
228 "http/tests/xmlhttprequest/supported-xml-content-types.html", 167 "http/tests/xmlhttprequest/supported-xml-content-types.html",
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 'perf/object-keys.html'])]) 268 'perf/object-keys.html'])])
330 269
331 locked, unlocked = self.get_shards(num_workers=4, fully_parallel=False) 270 locked, unlocked = self.get_shards(num_workers=4, fully_parallel=False)
332 self.assert_shards(locked, 271 self.assert_shards(locked,
333 [('locked_shard_1', 272 [('locked_shard_1',
334 ['http/tests/security/view-source-no-refresh.html', 273 ['http/tests/security/view-source-no-refresh.html',
335 'http/tests/websocket/tests/unicode.htm', 274 'http/tests/websocket/tests/unicode.htm',
336 'http/tests/websocket/tests/websocket-protocol-ignored.html', 275 'http/tests/websocket/tests/websocket-protocol-ignored.html',
337 'http/tests/xmlhttprequest/supported-xml-content-types.html', 276 'http/tests/xmlhttprequest/supported-xml-content-types.html',
338 'perf/object-keys.html'])]) 277 'perf/object-keys.html'])])
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698