Chromium Code Reviews| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 351 add_file(test, '-expected.wav', test.expected_audio) | 351 add_file(test, '-expected.wav', test.expected_audio) |
| 352 continue | 352 continue |
| 353 add_file(test, '-expected.txt', test.expected_text) | 353 add_file(test, '-expected.txt', test.expected_text) |
| 354 add_file(test, '-expected.png', test.expected_image) | 354 add_file(test, '-expected.png', test.expected_image) |
| 355 | 355 |
| 356 filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'virt ual_passes', 'passes', 'args-expected.txt'), 'args-txt --virtual-arg') | 356 filesystem.write_text_file(filesystem.join(LAYOUT_TEST_DIR, 'virtual', 'virt ual_passes', 'passes', 'args-expected.txt'), 'args-txt --virtual-arg') |
| 357 # Clear the list of written files so that we can watch what happens during t esting. | 357 # Clear the list of written files so that we can watch what happens during t esting. |
| 358 filesystem.clear_written_files() | 358 filesystem.clear_written_files() |
| 359 | 359 |
| 360 | 360 |
| 361 class TestPort(Port): | 361 class TestPort(Port): |
|
qyearsley
2016/03/21 21:45:25
Question, unrelated to this CL:
Do you know what
Dirk Pranke
2016/03/29 22:39:01
A TestPort is a fake implementation of the Port cl
bokan
2016/04/05 12:28:56
I'm not sure. TestPort is a testing version of the
| |
| 362 port_name = 'test' | 362 port_name = 'test' |
| 363 default_port_name = 'test-mac-mac10.10' | 363 default_port_name = 'test-mac-mac10.10' |
| 364 | 364 |
| 365 # TODO(wkorman): The below constant is legacy code and is only referenced by a unit test. Find the modern way to do | 365 # TODO(wkorman): The below constant is legacy code and is only referenced by a unit test. Find the modern way to do |
| 366 # the same thing that test is doing and delete this. | 366 # the same thing that test is doing and delete this. |
| 367 # | 367 # |
| 368 # A list of platform names sufficient to cover all the baselines. | 368 # A list of platform names sufficient to cover all the baselines. |
| 369 # The list should be sorted so that a later platform will reuse | 369 # The list should be sorted so that a later platform will reuse |
| 370 # an earlier platform's baselines if they are the same (e.g., | 370 # an earlier platform's baselines if they are the same (e.g., |
| 371 # 'mac10.10' should precede 'mac10.9'). | 371 # 'mac10.10' should precede 'mac10.9'). |
| 372 ALL_BASELINE_VARIANTS = ( | 372 ALL_BASELINE_VARIANTS = ( |
| 373 'test-linux-trusty', 'test-linux-precise', 'test-linux-x86', | 373 'test-linux-trusty', 'test-linux-precise', 'test-linux-x86', |
| 374 'test-mac-mac10.11', 'test-mac-mac10.10', | 374 'test-mac-mac10.11', 'test-mac-mac10.10', |
| 375 'test-win-win10', 'test-win-win7' | 375 'test-win-win10', 'test-win-win7' |
| 376 ) | 376 ) |
| 377 | 377 |
| 378 FALLBACK_PATHS = { | 378 FALLBACK_PATHS = { |
| 379 'win7': ['test-win-win7', 'test-win-win10'], | 379 'win7': ['test-win-win7', 'test-win-win10'], |
| 380 'win10': ['test-win-win10'], | 380 'win10': ['test-win-win10'], |
| 381 'mac10.10': ['test-mac-mac10.10', 'test-mac-mac10.11'], | 381 'mac10.10': ['test-mac-mac10.10', 'test-mac-mac10.11'], |
| 382 'mac10.11': ['test-mac-mac10.11'], | 382 'mac10.11': ['test-mac-mac10.11'], |
| 383 'trusty': ['test-linux-trusty', 'test-win-win7'], | 383 'trusty': ['test-linux-trusty', 'test-win-win7'], |
| 384 'precise': ['test-linux-precise', 'test-linux-trusty', 'test-win-win 7'], | 384 'precise': ['test-linux-precise', 'test-linux-trusty', 'test-win-win 7'], |
| 385 'linux32': ['test-linux-x86', 'test-linux-precise', 'test-linux-trus ty', 'test-win-win7'], | 385 'linux32': ['test-linux-x86', 'test-linux-precise', 'test-linux-trus ty', 'test-win-win7'], |
| 386 } | 386 } |
| 387 | 387 |
| 388 _mock_all_systems = (('mac10.10', 'x86'), | |
| 389 ('mac10.11', 'x86'), | |
| 390 ('win7', 'x86'), | |
| 391 ('win10', 'x86'), | |
| 392 ('linux32', 'x86'), | |
| 393 ('precise', 'x86_64'), | |
| 394 ('trusty', 'x86_64')) | |
| 395 | |
| 396 _mock_all_build_types = ('debug', 'release') | |
| 397 | |
| 398 """To avoid surprises when introducing new macros, these are intentionally f ixed in time.""" | |
| 399 _mock_configuration_specifier_macros = { | |
| 400 'mac': ['mac10.10', 'mac10.11'], | |
| 401 'win': ['win7', 'win10'], | |
| 402 'linux': ['linux32', 'precise', 'trusty'] | |
| 403 } | |
|
Dirk Pranke
2016/03/29 22:39:01
Nit: I would leave out the "_mock" part of these n
bokan
2016/04/05 12:28:56
Done.
| |
| 404 | |
| 388 @classmethod | 405 @classmethod |
| 389 def determine_full_port_name(cls, host, options, port_name): | 406 def determine_full_port_name(cls, host, options, port_name): |
| 390 if port_name == 'test': | 407 if port_name == 'test': |
| 391 return TestPort.default_port_name | 408 return TestPort.default_port_name |
| 392 return port_name | 409 return port_name |
| 393 | 410 |
| 394 def __init__(self, host, port_name=None, **kwargs): | 411 def __init__(self, host, port_name=None, **kwargs): |
| 395 Port.__init__(self, host, port_name or TestPort.default_port_name, **kwa rgs) | 412 Port.__init__(self, host, port_name or TestPort.default_port_name, **kwa rgs) |
| 396 self._tests = unit_test_list() | 413 self._tests = unit_test_list() |
| 397 self._flakes = set() | 414 self._flakes = set() |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 # every configuration on every system. | 546 # every configuration on every system. |
| 530 test_configurations = [] | 547 test_configurations = [] |
| 531 for version, architecture in self._all_systems(): | 548 for version, architecture in self._all_systems(): |
| 532 for build_type in self._all_build_types(): | 549 for build_type in self._all_build_types(): |
| 533 test_configurations.append(TestConfiguration( | 550 test_configurations.append(TestConfiguration( |
| 534 version=version, | 551 version=version, |
| 535 architecture=architecture, | 552 architecture=architecture, |
| 536 build_type=build_type)) | 553 build_type=build_type)) |
| 537 return test_configurations | 554 return test_configurations |
| 538 | 555 |
| 556 def set_all_systems(self, all_systems): | |
| 557 self._mock_all_systems = all_systems | |
| 558 | |
| 539 def _all_systems(self): | 559 def _all_systems(self): |
| 540 return (('mac10.10', 'x86'), | 560 return self._mock_all_systems |
|
Dirk Pranke
2016/03/29 22:39:01
Why not just make these things public instance var
bokan
2016/04/05 12:28:56
Done.
| |
| 541 ('mac10.11', 'x86'), | 561 |
| 542 ('win7', 'x86'), | 562 def set_all_build_types(self, all_build_types): |
| 543 ('win10', 'x86'), | 563 self._mock_all_build_types = all_build_types |
| 544 ('linux32', 'x86'), | |
| 545 ('precise', 'x86_64'), | |
| 546 ('trusty', 'x86_64')) | |
| 547 | 564 |
| 548 def _all_build_types(self): | 565 def _all_build_types(self): |
| 549 return ('debug', 'release') | 566 return self._mock_all_build_types |
| 567 | |
| 568 def set_configuration_specifier_macros(self, macros): | |
| 569 self._mock_configuration_specifier_macros = macros | |
| 550 | 570 |
| 551 def configuration_specifier_macros(self): | 571 def configuration_specifier_macros(self): |
| 552 """To avoid surprises when introducing new macros, these are intentional ly fixed in time.""" | 572 return self._mock_configuration_specifier_macros |
| 553 return { | |
| 554 'mac': ['mac10.10', 'mac10.11'], | |
| 555 'win': ['win7', 'win10'], | |
| 556 'linux': ['linux32', 'precise', 'trusty'] | |
| 557 } | |
| 558 | 573 |
| 559 def virtual_test_suites(self): | 574 def virtual_test_suites(self): |
| 560 return [ | 575 return [ |
| 561 VirtualTestSuite(prefix='virtual_passes', base='passes', args=['--vi rtual-arg']), | 576 VirtualTestSuite(prefix='virtual_passes', base='passes', args=['--vi rtual-arg']), |
| 562 VirtualTestSuite(prefix='skipped', base='failures/expected', args=[' --virtual-arg2']), | 577 VirtualTestSuite(prefix='skipped', base='failures/expected', args=[' --virtual-arg2']), |
| 563 VirtualTestSuite(prefix='references_use_default_args', base='passes/ reftest.html', | 578 VirtualTestSuite(prefix='references_use_default_args', base='passes/ reftest.html', |
| 564 args=['--virtual-arg'], references_use_default_args =True), | 579 args=['--virtual-arg'], references_use_default_args =True), |
| 565 ] | 580 ] |
| 566 | 581 |
| 567 | 582 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 655 else: | 670 else: |
| 656 image = test.actual_image | 671 image = test.actual_image |
| 657 return DriverOutput(actual_text, image, test.actual_checksum, audio, | 672 return DriverOutput(actual_text, image, test.actual_checksum, audio, |
| 658 crash=(crash or web_process_crash), crashed_process_name=crashed_pro cess_name, | 673 crash=(crash or web_process_crash), crashed_process_name=crashed_pro cess_name, |
| 659 crashed_pid=crashed_pid, crash_log=crash_log, | 674 crashed_pid=crashed_pid, crash_log=crash_log, |
| 660 test_time=time.time() - start_time, timeout=test.timeout, error=test .error, pid=self.pid, | 675 test_time=time.time() - start_time, timeout=test.timeout, error=test .error, pid=self.pid, |
| 661 leak=test.leak) | 676 leak=test.leak) |
| 662 | 677 |
| 663 def stop(self): | 678 def stop(self): |
| 664 self.started = False | 679 self.started = False |
| OLD | NEW |