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

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

Issue 2121823003: Refactor test.py to be easier to fake. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated with Dirk's suggestion Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 'test-mac-mac10.11': 'mac10.11', 424 'test-mac-mac10.11': 'mac10.11',
425 'test-linux-x86': 'linux32', 425 'test-linux-x86': 'linux32',
426 'test-linux-precise': 'precise', 426 'test-linux-precise': 'precise',
427 'test-linux-trusty': 'trusty', 427 'test-linux-trusty': 'trusty',
428 } 428 }
429 self._version = version_map[self._name] 429 self._version = version_map[self._name]
430 430
431 if self._operating_system == 'linux' and self._version != 'linux32': 431 if self._operating_system == 'linux' and self._version != 'linux32':
432 self._architecture = 'x86_64' 432 self._architecture = 'x86_64'
433 433
434 self.all_systems = (('mac10.10', 'x86'),
435 ('mac10.11', 'x86'),
436 ('win7', 'x86'),
437 ('win10', 'x86'),
438 ('linux32', 'x86'),
439 ('precise', 'x86_64'),
440 ('trusty', 'x86_64'))
441
442 self.all_build_types = ('debug', 'release')
443
444 # To avoid surprises when introducing new macros, these are
445 # intentionally fixed in time.
446 self.configuration_specifier_macros_dict = {
447 'mac': ['mac10.10', 'mac10.11'],
448 'win': ['win7', 'win10'],
449 'linux': ['linux32', 'precise', 'trusty']
450 }
451
434 def buildbot_archives_baselines(self): 452 def buildbot_archives_baselines(self):
435 return self._name != 'test-win-win7' 453 return self._name != 'test-win-win7'
436 454
437 def default_pixel_tests(self): 455 def default_pixel_tests(self):
438 return True 456 return True
439 457
440 def _path_to_driver(self): 458 def _path_to_driver(self):
441 # This routine shouldn't normally be called, but it is called by 459 # This routine shouldn't normally be called, but it is called by
442 # the mock_drt Driver. We return something, but make sure it's useless. 460 # the mock_drt Driver. We return something, but make sure it's useless.
443 return 'MOCK _path_to_driver' 461 return 'MOCK _path_to_driver'
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'h ttpd.conf') 539 return self._filesystem.join(self.layout_tests_dir(), 'http', 'conf', 'h ttpd.conf')
522 540
523 def path_to_generic_test_expectations_file(self): 541 def path_to_generic_test_expectations_file(self):
524 return self._generic_expectations_path 542 return self._generic_expectations_path
525 543
526 def all_test_configurations(self): 544 def all_test_configurations(self):
527 """Returns a sequence of the TestConfigurations the port supports.""" 545 """Returns a sequence of the TestConfigurations the port supports."""
528 # By default, we assume we want to test every graphics type in 546 # By default, we assume we want to test every graphics type in
529 # every configuration on every system. 547 # every configuration on every system.
530 test_configurations = [] 548 test_configurations = []
531 for version, architecture in self._all_systems(): 549 for version, architecture in self.all_systems:
532 for build_type in self._all_build_types(): 550 for build_type in self.all_build_types:
533 test_configurations.append(TestConfiguration( 551 test_configurations.append(TestConfiguration(
534 version=version, 552 version=version,
535 architecture=architecture, 553 architecture=architecture,
536 build_type=build_type)) 554 build_type=build_type))
537 return test_configurations 555 return test_configurations
538 556
539 def _all_systems(self):
540 return (('mac10.10', 'x86'),
541 ('mac10.11', 'x86'),
542 ('win7', 'x86'),
543 ('win10', 'x86'),
544 ('linux32', 'x86'),
545 ('precise', 'x86_64'),
546 ('trusty', 'x86_64'))
547
548 def _all_build_types(self):
549 return ('debug', 'release')
550
551 def configuration_specifier_macros(self): 557 def configuration_specifier_macros(self):
552 """To avoid surprises when introducing new macros, these are intentional ly fixed in time.""" 558 return self.configuration_specifier_macros_dict
553 return {
554 'mac': ['mac10.10', 'mac10.11'],
555 'win': ['win7', 'win10'],
556 'linux': ['linux32', 'precise', 'trusty']
557 }
558 559
559 def virtual_test_suites(self): 560 def virtual_test_suites(self):
560 return [ 561 return [
561 VirtualTestSuite(prefix='virtual_passes', base='passes', args=['--vi rtual-arg']), 562 VirtualTestSuite(prefix='virtual_passes', base='passes', args=['--vi rtual-arg']),
562 VirtualTestSuite(prefix='skipped', base='failures/expected', args=[' --virtual-arg2']), 563 VirtualTestSuite(prefix='skipped', base='failures/expected', args=[' --virtual-arg2']),
563 VirtualTestSuite(prefix='references_use_default_args', base='passes/ reftest.html', 564 VirtualTestSuite(prefix='references_use_default_args', base='passes/ reftest.html',
564 args=['--virtual-arg'], references_use_default_args =True), 565 args=['--virtual-arg'], references_use_default_args =True),
565 ] 566 ]
566 567
567 568
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 else: 657 else:
657 image = test.actual_image 658 image = test.actual_image
658 return DriverOutput(actual_text, image, test.actual_checksum, audio, 659 return DriverOutput(actual_text, image, test.actual_checksum, audio,
659 crash=(crash or web_process_crash), crashed_process_ name=crashed_process_name, 660 crash=(crash or web_process_crash), crashed_process_ name=crashed_process_name,
660 crashed_pid=crashed_pid, crash_log=crash_log, 661 crashed_pid=crashed_pid, crash_log=crash_log,
661 test_time=time.time() - start_time, timeout=test.tim eout, error=test.error, pid=self.pid, 662 test_time=time.time() - start_time, timeout=test.tim eout, error=test.error, pid=self.pid,
662 leak=test.leak) 663 leak=test.leak)
663 664
664 def stop(self): 665 def stop(self):
665 self.started = False 666 self.started = False
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698