OLD | NEW |
---|---|
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
237 port = self.make_port(with_tests=True) | 237 port = self.make_port(with_tests=True) |
238 tests = port.tests(['userscripts']) | 238 tests = port.tests(['userscripts']) |
239 self.assertNotIn('userscripts/resources/iframe.html', tests) | 239 self.assertNotIn('userscripts/resources/iframe.html', tests) |
240 | 240 |
241 def test_find_with_skipped_directories_2(self): | 241 def test_find_with_skipped_directories_2(self): |
242 port = self.make_port(with_tests=True) | 242 port = self.make_port(with_tests=True) |
243 tests = port.tests(['userscripts/resources']) | 243 tests = port.tests(['userscripts/resources']) |
244 self.assertEqual(tests, []) | 244 self.assertEqual(tests, []) |
245 | 245 |
246 @staticmethod | 246 @staticmethod |
247 def _add_manifest_to_mock_file_system(filesystem): | 247 def _add_manifest_to_mock_file_system(filesystem, contents=None): |
248 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/MANIFEST.jso n', json.dumps({ | 248 if not contents: |
249 'items': { | 249 contents = { |
250 'testharness': { | 250 'items': { |
251 'dom/ranges/Range-attributes.html': [ | 251 'testharness': { |
252 ['/dom/ranges/Range-attributes.html', {}] | 252 'dom/ranges/Range-attributes.html': [ |
253 ], | 253 ['/dom/ranges/Range-attributes.html', {}] |
254 'dom/ranges/Range-attributes-slow.html': [ | 254 ], |
255 ['/dom/ranges/Range-attributes.html', {'timeout': 'long' }] | 255 'dom/ranges/Range-attributes-slow.html': [ |
256 ], | 256 ['/dom/ranges/Range-attributes.html', {'timeout': 'l ong'}] |
257 'console/console-is-a-namespace.any.js': [ | 257 ], |
258 ['/console/console-is-a-namespace.any.html', {}], | 258 'console/console-is-a-namespace.any.js': [ |
259 ['/console/console-is-a-namespace.any.worker.html', {}], | 259 ['/console/console-is-a-namespace.any.html', {}], |
260 ], | 260 ['/console/console-is-a-namespace.any.worker.html', {}], |
261 }, | 261 ], |
262 'manual': {}, | 262 }, |
263 'reftest': { | 263 'manual': {}, |
264 'html/dom/elements/global-attributes/dir_auto-EN-L.html': [ | 264 'reftest': { |
265 [ | 265 'html/dom/elements/global-attributes/dir_auto-EN-L.html' : [ |
266 '/html/dom/elements/global-attributes/dir_auto-EN-L. html', | |
267 [ | 266 [ |
267 '/html/dom/elements/global-attributes/dir_auto-E N-L.html', | |
268 [ | 268 [ |
269 '/html/dom/elements/global-attributes/dir_au to-EN-L-ref.html', | 269 [ |
270 '==' | 270 '/html/dom/elements/global-attributes/di r_auto-EN-L-ref.html', |
271 ] | 271 '==' |
272 ], | 272 ] |
273 {'timeout': 'long'} | 273 ], |
274 ] | 274 {'timeout': 'long'} |
275 ], | 275 ] |
276 }, | 276 ], |
277 }})) | 277 }, |
278 } | |
279 } | |
280 | |
281 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/MANIFEST.jso n', json.dumps(contents)) | |
278 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/dom/ranges/R ange-attributes.html', '') | 282 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/dom/ranges/R ange-attributes.html', '') |
279 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/console/cons ole-is-a-namespace.any.js', '') | 283 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/console/cons ole-is-a-namespace.any.js', '') |
280 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/common/blank .html', 'foo') | 284 filesystem.write_text_file(LAYOUT_TEST_DIR + '/external/wpt/common/blank .html', 'foo') |
281 | 285 |
282 def test_find_none_if_not_in_manifest(self): | 286 def test_find_none_if_not_in_manifest(self): |
283 port = self.make_port(with_tests=True) | 287 port = self.make_port(with_tests=True) |
284 PortTest._add_manifest_to_mock_file_system(port.host.filesystem) | 288 PortTest._add_manifest_to_mock_file_system(port.host.filesystem) |
285 self.assertNotIn('external/wpt/common/blank.html', port.tests([])) | 289 self.assertNotIn('external/wpt/common/blank.html', port.tests([])) |
286 | 290 |
287 def test_find_one_if_in_manifest(self): | 291 def test_find_one_if_in_manifest(self): |
292 mock_generate_manifest_calls = [] | |
293 | |
294 def mock_generate_manifest(): | |
295 mock_generate_manifest_calls.append('called') | |
296 # Contents are not important, just update so that they're different | |
297 # so the file hashes to a different value. This is meant to mock | |
298 # the result of running the update manifest command. | |
qyearsley
2017/01/26 23:08:51
Since the contents are not important, it would be
| |
299 PortTest._add_manifest_to_mock_file_system(port.host.filesystem, { | |
300 'items': { | |
301 'testharness': { | |
302 'dom/ranges/Range-attributes.html': [ | |
303 ['/dom/ranges/Range-attributes.html', {}] | |
304 ], | |
305 'dom/ranges/Range-attributes-slow.html': [ | |
306 ['/dom/ranges/Range-attributes.html', {'timeout': 'l ong'}] | |
307 ], | |
308 'console/console-is-a-namespace.any.js': [ | |
309 ['/console/console-is-a-namespace.any.html', {}], | |
310 ['/console/console-is-a-namespace.any.worker.html', {}], | |
311 ], | |
312 'rutabaga.html': [ | |
313 ['/rutabaga.html', {}], | |
314 ], | |
315 }, | |
316 'manual': {}, | |
317 'reftest': { | |
318 'html/dom/elements/global-attributes/dir_auto-EN-L.html' : [ | |
319 [ | |
320 '/html/dom/elements/global-attributes/dir_auto-E N-L.html', | |
321 [ | |
322 [ | |
323 '/html/dom/elements/global-attributes/di r_auto-EN-L-ref.html', | |
324 '==' | |
325 ] | |
326 ], | |
327 {'timeout': 'long'} | |
328 ] | |
329 ], | |
330 }, | |
331 } | |
332 }) | |
333 | |
288 port = self.make_port(with_tests=True) | 334 port = self.make_port(with_tests=True) |
289 PortTest._add_manifest_to_mock_file_system(port.host.filesystem) | 335 PortTest._add_manifest_to_mock_file_system(port.host.filesystem) |
336 port._generate_manifest = mock_generate_manifest # pylint: disable=W021 2 | |
jeffcarp
2017/01/26 22:26:39
After rebasing I couldn't get the tests to pass wi
qyearsley
2017/01/26 23:08:51
I think it's OK but might be nicer if it were simp
| |
337 | |
338 capture = OutputCapture() | |
qyearsley
2017/01/26 23:08:51
Is it possible to use LoggingTestCase.assertLog (a
| |
339 capture.capture_output() | |
340 | |
290 self.assertIn('external/wpt/dom/ranges/Range-attributes.html', port.test s([])) | 341 self.assertIn('external/wpt/dom/ranges/Range-attributes.html', port.test s([])) |
291 self.assertNotIn('external/wpt/console/console-is-a-namespace.any.js', p ort.tests([])) | 342 self.assertNotIn('external/wpt/console/console-is-a-namespace.any.js', p ort.tests([])) |
292 self.assertEqual(port.tests(['external']), ['external/wpt/dom/ranges/Ran ge-attributes.html']) | 343 self.assertEqual(port.tests(['external']), ['external/wpt/dom/ranges/Ran ge-attributes.html']) |
293 self.assertEqual(port.tests(['external/']), ['external/wpt/dom/ranges/Ra nge-attributes.html']) | 344 self.assertEqual(port.tests(['external/']), ['external/wpt/dom/ranges/Ra nge-attributes.html']) |
294 self.assertEqual(port.tests(['external/csswg-test']), []) | 345 self.assertEqual(port.tests(['external/csswg-test']), []) |
295 self.assertEqual(port.tests(['external/wpt']), ['external/wpt/dom/ranges /Range-attributes.html']) | 346 self.assertEqual(port.tests(['external/wpt']), ['external/wpt/dom/ranges /Range-attributes.html']) |
296 self.assertEqual(port.tests(['external/wpt/']), ['external/wpt/dom/range s/Range-attributes.html']) | 347 self.assertEqual(port.tests(['external/wpt/']), ['external/wpt/dom/range s/Range-attributes.html']) |
297 self.assertEqual(port.tests(['external/wpt/dom/ranges/Range-attributes.h tml']), | 348 self.assertEqual(port.tests(['external/wpt/dom/ranges/Range-attributes.h tml']), |
298 ['external/wpt/dom/ranges/Range-attributes.html']) | 349 ['external/wpt/dom/ranges/Range-attributes.html']) |
299 | 350 |
351 _, _, logs = capture.restore_output() | |
352 self.assertEqual(len(mock_generate_manifest_calls), 1) | |
353 self.assertIn('MANIFEST.json has been updated to reflect changes in exte rnal/wpt!', logs) | |
354 | |
300 def test_is_test_file(self): | 355 def test_is_test_file(self): |
301 port = self.make_port(with_tests=True) | 356 port = self.make_port(with_tests=True) |
302 is_test_file = functools.partial(Port.is_test_file, port, port.host.file system) | 357 is_test_file = functools.partial(Port.is_test_file, port, port.host.file system) |
303 self.assertTrue(is_test_file('', 'foo.html')) | 358 self.assertTrue(is_test_file('', 'foo.html')) |
304 self.assertTrue(is_test_file('', 'foo.svg')) | 359 self.assertTrue(is_test_file('', 'foo.svg')) |
305 self.assertTrue(is_test_file('', 'test-ref-test.html')) | 360 self.assertTrue(is_test_file('', 'test-ref-test.html')) |
306 self.assertTrue(is_test_file('inspector-unit', 'trie.js')) | 361 self.assertTrue(is_test_file('inspector-unit', 'trie.js')) |
307 self.assertFalse(is_test_file('inspector-unit', 'foo.html')) | 362 self.assertFalse(is_test_file('inspector-unit', 'foo.html')) |
308 self.assertFalse(is_test_file('inspector', 'devtools.js')) | 363 self.assertFalse(is_test_file('inspector', 'devtools.js')) |
309 self.assertFalse(is_test_file('', 'foo.png')) | 364 self.assertFalse(is_test_file('', 'foo.png')) |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
635 self.assertEqual(suite.args, ['--args']) | 690 self.assertEqual(suite.args, ['--args']) |
636 self.assertEqual(suite.reference_args, []) | 691 self.assertEqual(suite.reference_args, []) |
637 | 692 |
638 def test_non_default_reference_args(self): | 693 def test_non_default_reference_args(self): |
639 suite = VirtualTestSuite(prefix='suite', base='base/foo', args=['--args' ], references_use_default_args=False) | 694 suite = VirtualTestSuite(prefix='suite', base='base/foo', args=['--args' ], references_use_default_args=False) |
640 self.assertEqual(suite.args, ['--args']) | 695 self.assertEqual(suite.args, ['--args']) |
641 self.assertEqual(suite.reference_args, suite.args) | 696 self.assertEqual(suite.reference_args, suite.args) |
642 | 697 |
643 def test_no_slash(self): | 698 def test_no_slash(self): |
644 self.assertRaises(AssertionError, VirtualTestSuite, prefix='suite/bar', base='base/foo', args=['--args']) | 699 self.assertRaises(AssertionError, VirtualTestSuite, prefix='suite/bar', base='base/foo', args=['--args']) |
OLD | NEW |