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

Side by Side Diff: sky/tools/webkitpy/layout_tests/port/base_unittest.py

Issue 802573002: Prepare python code for reftests. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 port = self.make_port(with_tests=True) 280 port = self.make_port(with_tests=True)
281 tests = port.tests(['userscripts/resources']) 281 tests = port.tests(['userscripts/resources'])
282 self.assertEqual(tests, []) 282 self.assertEqual(tests, [])
283 283
284 def test_is_test_file(self): 284 def test_is_test_file(self):
285 filesystem = MockFileSystem() 285 filesystem = MockFileSystem()
286 self.assertTrue(Port.is_test_file(filesystem, '', 'foo.html')) 286 self.assertTrue(Port.is_test_file(filesystem, '', 'foo.html'))
287 self.assertTrue(Port.is_test_file(filesystem, '', 'foo.svg')) 287 self.assertTrue(Port.is_test_file(filesystem, '', 'foo.svg'))
288 self.assertTrue(Port.is_test_file(filesystem, '', 'test-ref-test.html')) 288 self.assertTrue(Port.is_test_file(filesystem, '', 'test-ref-test.html'))
289 self.assertFalse(Port.is_test_file(filesystem, '', 'foo.png')) 289 self.assertFalse(Port.is_test_file(filesystem, '', 'foo.png'))
290 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.html')) 290 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.sky'))
291 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.svg')) 291 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.svg'))
292 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.xht')) 292 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected.xht'))
293 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.html')) 293 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.sky'))
294 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.svg')) 294 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.svg'))
295 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.xhtml')) 295 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-expected-mismatc h.xhtml'))
296 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.html')) 296 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.html'))
297 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.html')) 297 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.html'))
298 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.xht')) 298 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-notref.xht'))
299 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.xhtml')) 299 self.assertFalse(Port.is_test_file(filesystem, '', 'foo-ref.xhtml'))
300 self.assertFalse(Port.is_test_file(filesystem, '', 'ref-foo.html')) 300 self.assertFalse(Port.is_test_file(filesystem, '', 'ref-foo.html'))
301 self.assertFalse(Port.is_test_file(filesystem, '', 'notref-foo.xhr')) 301 self.assertFalse(Port.is_test_file(filesystem, '', 'notref-foo.xhr'))
302 302
303 def test_parse_reftest_list(self): 303 def test_parse_reftest_list(self):
(...skipping 10 matching lines...) Expand all
314 # Note that we don't support the syntax in the last line; the code shoul d ignore it, rather than crashing. 314 # Note that we don't support the syntax in the last line; the code shoul d ignore it, rather than crashing.
315 315
316 reftest_list = Port._parse_reftest_list(port.host.filesystem, 'bar') 316 reftest_list = Port._parse_reftest_list(port.host.filesystem, 'bar')
317 self.assertEqual(reftest_list, {'bar/test.html': [('==', 'bar/test-ref.h tml')], 317 self.assertEqual(reftest_list, {'bar/test.html': [('==', 'bar/test-ref.h tml')],
318 'bar/test-2.html': [('!=', 'bar/test-notref.html')], 318 'bar/test-2.html': [('!=', 'bar/test-notref.html')],
319 'bar/test-3.html': [('==', 'bar/test-ref.html'), ('==', 'bar/test-re f2.html'), ('!=', 'bar/test-notref.html')]}) 319 'bar/test-3.html': [('==', 'bar/test-ref.html'), ('==', 'bar/test-re f2.html'), ('!=', 'bar/test-notref.html')]})
320 320
321 def test_reference_files(self): 321 def test_reference_files(self):
322 port = self.make_port(with_tests=True) 322 port = self.make_port(with_tests=True)
323 self.assertEqual(port.reference_files('passes/svgreftest.svg'), [('==', port.layout_tests_dir() + '/passes/svgreftest-expected.svg')]) 323 self.assertEqual(port.reference_files('passes/svgreftest.svg'), [('==', port.layout_tests_dir() + '/passes/svgreftest-expected.svg')])
324 self.assertEqual(port.reference_files('passes/xhtreftest.svg'), [('==', port.layout_tests_dir() + '/passes/xhtreftest-expected.html')]) 324 self.assertEqual(port.reference_files('passes/xhtreftest.svg'), [('==', port.layout_tests_dir() + '/passes/xhtreftest-expected.sky')])
325 self.assertEqual(port.reference_files('passes/phpreftest.php'), [('!=', port.layout_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')]) 325 self.assertEqual(port.reference_files('passes/phpreftest.php'), [('!=', port.layout_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')])
326 326
327 def test_operating_system(self): 327 def test_operating_system(self):
328 self.assertEqual('mac', self.make_port().operating_system()) 328 self.assertEqual('mac', self.make_port().operating_system())
329 329
330 def test_http_server_supports_ipv6(self): 330 def test_http_server_supports_ipv6(self):
331 port = self.make_port() 331 port = self.make_port()
332 self.assertTrue(port.http_server_supports_ipv6()) 332 self.assertTrue(port.http_server_supports_ipv6())
333 port.host.platform.os_name = 'cygwin' 333 port.host.platform.os_name = 'cygwin'
334 self.assertFalse(port.http_server_supports_ipv6()) 334 self.assertFalse(port.http_server_supports_ipv6())
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args']) 466 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'])
467 self.assertFalse(hasattr(suite, 'name')) 467 self.assertFalse(hasattr(suite, 'name'))
468 self.assertFalse(hasattr(suite, 'base')) 468 self.assertFalse(hasattr(suite, 'base'))
469 self.assertFalse(hasattr(suite, 'args')) 469 self.assertFalse(hasattr(suite, 'args'))
470 470
471 def test_legacy(self): 471 def test_legacy(self):
472 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'], use_legacy _naming=True) 472 suite = VirtualTestSuite('suite/bar', 'base/foo', ['--args'], use_legacy _naming=True)
473 self.assertEqual(suite.name, 'virtual/suite/bar') 473 self.assertEqual(suite.name, 'virtual/suite/bar')
474 self.assertEqual(suite.base, 'base/foo') 474 self.assertEqual(suite.base, 'base/foo')
475 self.assertEqual(suite.args, ['--args']) 475 self.assertEqual(suite.args, ['--args'])
OLDNEW
« no previous file with comments | « sky/tools/webkitpy/layout_tests/models/test_run_results_unittest.py ('k') | sky/tools/webkitpy/layout_tests/port/test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698