Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 import sys | 4 import sys |
| 5 from telemetry.story import story_set as story_set_module | 5 from telemetry.story import story_set as story_set_module |
| 6 from telemetry.page import page_test | 6 from telemetry.page import page_test |
| 7 | 7 |
| 8 from gpu_tests import gpu_test_base | 8 from gpu_tests import gpu_test_base |
| 9 | 9 |
| 10 class GpuProcessSharedPageState(gpu_test_base.GpuSharedPageState): | 10 class GpuProcessSharedPageState(gpu_test_base.GpuSharedPageState): |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 return | 113 return |
| 114 | 114 |
| 115 if self.expected_workaround: | 115 if self.expected_workaround: |
| 116 self._Validate(tab, "browser_process", True, self.expected_workaround) | 116 self._Validate(tab, "browser_process", True, self.expected_workaround) |
| 117 self._Validate(tab, "gpu_process", True, self.expected_workaround) | 117 self._Validate(tab, "gpu_process", True, self.expected_workaround) |
| 118 | 118 |
| 119 if self.unexpected_workaround: | 119 if self.unexpected_workaround: |
| 120 self._Validate(tab, "browser_process", False, self.unexpected_workaround) | 120 self._Validate(tab, "browser_process", False, self.unexpected_workaround) |
| 121 self._Validate(tab, "gpu_process", False, self.unexpected_workaround) | 121 self._Validate(tab, "gpu_process", False, self.unexpected_workaround) |
| 122 | 122 |
| 123 | |
| 124 class EqualBugWorkaroundsBasePage(gpu_test_base.PageBase): | |
| 125 def __init__(self, name=None, page_set=None, shared_page_state_class=None, | |
| 126 expectations=None): | |
| 127 super(EqualBugWorkaroundsBasePage, self).__init__( | |
| 128 url='chrome:gpu', | |
| 129 name=name, | |
| 130 page_set=page_set, | |
| 131 shared_page_state_class=shared_page_state_class, | |
| 132 expectations=expectations) | |
| 133 | |
| 134 def Validate(self, tab, results): | |
| 135 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') | |
| 136 gpu_list = tab.EvaluateJavaScript( \ | |
| 137 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | |
| 138 | |
| 139 diff = set(browser_list).symmetric_difference(set(gpu_list)) | |
| 140 if len(diff) > 0: | |
| 141 print 'Test failed. Printing page contents:' | |
| 142 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 143 raise page_test.Failure('Browser and GPU process list of driver bug' \ | |
| 144 'workarounds are not equal: %s != %s, diff: %s' % \ | |
| 145 (browser_list, gpu_list, list(diff))) | |
| 146 | |
| 147 return gpu_list | |
| 148 | |
| 149 | |
| 123 class GpuProcessTestsPage(gpu_test_base.PageBase): | 150 class GpuProcessTestsPage(gpu_test_base.PageBase): |
| 124 def __init__(self, url, name, story_set, expectations): | 151 def __init__(self, url, name, story_set, expectations): |
| 125 super(GpuProcessTestsPage, self).__init__(url=url, | 152 super(GpuProcessTestsPage, self).__init__(url=url, |
| 126 shared_page_state_class=gpu_test_base.GpuSharedPageState, | 153 shared_page_state_class=gpu_test_base.GpuSharedPageState, |
| 127 page_set=story_set, | 154 page_set=story_set, |
| 128 name=name, | 155 name=name, |
| 129 expectations=expectations) | 156 expectations=expectations) |
| 130 | 157 |
| 131 | 158 |
| 132 class FunctionalVideoPage(GpuProcessTestsPage): | 159 class FunctionalVideoPage(GpuProcessTestsPage): |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 result = result and status == 'disabled_software' | 518 result = result and status == 'disabled_software' |
| 492 elif name == 'webgl': | 519 elif name == 'webgl': |
| 493 result = result and status == 'enabled_readback' | 520 result = result and status == 'enabled_readback' |
| 494 else: | 521 else: |
| 495 result = result and status == 'unavailable_software' | 522 result = result and status == 'unavailable_software' |
| 496 if not result: | 523 if not result: |
| 497 raise page_test.Failure('WebGL readback setup failed: %s' \ | 524 raise page_test.Failure('WebGL readback setup failed: %s' \ |
| 498 % feature_status_list) | 525 % feature_status_list) |
| 499 | 526 |
| 500 | 527 |
| 501 class EqualBugWorkaroundsInBrowserAndGpuProcessPage(gpu_test_base.PageBase): | |
| 502 def __init__(self, story_set, expectations): | |
| 503 super(EqualBugWorkaroundsInBrowserAndGpuProcessPage, self).__init__( | |
| 504 url='chrome:gpu', | |
| 505 name='GpuProcess.equal_bug_workarounds_in_browser_and_gpu_process', | |
| 506 page_set=story_set, | |
| 507 shared_page_state_class=GpuProcessSharedPageState, | |
| 508 expectations=expectations) | |
| 509 | |
| 510 def Validate(self, tab, results): | |
| 511 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') | |
| 512 gpu_list = tab.EvaluateJavaScript( \ | |
| 513 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | |
| 514 | |
| 515 diff = set(browser_list).symmetric_difference(set(gpu_list)) | |
| 516 if len(diff) > 0: | |
| 517 print 'Test failed. Printing page contents:' | |
| 518 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 519 raise page_test.Failure('Browser and GPU process list of driver bug' \ | |
| 520 'workarounds are not equal: %s != %s, diff: %s' % \ | |
| 521 (browser_list, gpu_list, list(diff))) | |
| 522 | |
| 523 | |
| 524 class HasTransparentVisualsShared(GpuProcessSharedPageState): | 528 class HasTransparentVisualsShared(GpuProcessSharedPageState): |
| 525 def __init__(self, test, finder_options, story_set): | 529 def __init__(self, test, finder_options, story_set): |
| 526 super(HasTransparentVisualsShared, self).__init__( | 530 super(HasTransparentVisualsShared, self).__init__( |
| 527 test, finder_options, story_set) | 531 test, finder_options, story_set) |
| 528 options = finder_options.browser_options | 532 options = finder_options.browser_options |
| 529 if sys.platform.startswith('linux'): | 533 if sys.platform.startswith('linux'): |
| 530 # Hit id 173 from kGpuDriverBugListJson. | 534 # Hit id 173 from kGpuDriverBugListJson. |
| 531 options.AppendExtraBrowserArgs('--gpu-testing-gl-version=3.0 Mesa ' \ | 535 options.AppendExtraBrowserArgs('--gpu-testing-gl-version=3.0 Mesa ' \ |
| 532 '12.1') | 536 '12.1') |
| 533 | 537 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 562 shared_page_state_class=NoTransparentVisualsShared, | 566 shared_page_state_class=NoTransparentVisualsShared, |
| 563 expectations=expectations, | 567 expectations=expectations, |
| 564 expected_workaround='disable_transparent_visuals', | 568 expected_workaround='disable_transparent_visuals', |
| 565 unexpected_workaround=None) | 569 unexpected_workaround=None) |
| 566 | 570 |
| 567 def Validate(self, tab, results): | 571 def Validate(self, tab, results): |
| 568 if sys.platform.startswith('linux'): | 572 if sys.platform.startswith('linux'): |
| 569 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) | 573 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) |
| 570 | 574 |
| 571 | 575 |
| 576 class TransferWorkaroundSharedPageState(GpuProcessSharedPageState): | |
| 577 def __init__(self, test, finder_options, story_set): | |
| 578 super(TransferWorkaroundSharedPageState, self).__init__( | |
| 579 test, finder_options, story_set) | |
| 580 | |
| 581 # Extra browser args need to be added here. Adding them in RunStory would be | |
| 582 # too late. | |
| 583 def WillRunStory(self, results): | |
| 584 if self.WarmUpDone(): | |
| 585 options = self._finder_options.browser_options | |
| 586 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') | |
| 587 options.AppendExtraBrowserArgs('--disable-gpu-driver-bug-workarounds') | |
| 588 | |
| 589 # Inject some info to make sure the flag above is effective. | |
| 590 if sys.platform == 'darwin': | |
| 591 # Hit id 33 from kGpuDriverBugListJson. | |
| 592 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=Imagination') | |
| 593 else: | |
| 594 # Hit id 5 from kGpuDriverBugListJson. | |
| 595 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10dee') | |
|
Ken Russell (switch to Gerrit)
2016/08/17 06:52:22
This looks like a typo, and that it should be 0x10
Julien Isorce Samsung
2016/08/17 07:49:13
Oh sorry it is a left over of some local testing.
Ken Russell (switch to Gerrit)
2016/08/17 18:48:42
It's concerning to me that it would have been poss
| |
| 596 options.AppendExtraBrowserArgs('--gpu-testing-device-id=') | |
| 597 options.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-ids=') | |
| 598 options.AppendExtraBrowserArgs('--gpu-testing-secondary-device-ids=') | |
| 599 | |
| 600 for workaround in self.RecordedWorkarounds(): | |
| 601 options.AppendExtraBrowserArgs('--' + workaround) | |
| 602 super(TransferWorkaroundSharedPageState, self).WillRunStory(results) | |
| 603 | |
| 604 # self._current_page is None in WillRunStory so do the transfer here. | |
| 605 def RunStory(self, results): | |
| 606 if self.WarmUpDone(): | |
| 607 self._current_page.expected_workarounds = self.RecordedWorkarounds() | |
| 608 self.AddTestingWorkaround(self._current_page.expected_workarounds) | |
| 609 super(TransferWorkaroundSharedPageState, self).RunStory(results) | |
| 610 | |
| 611 def WarmUpDone(self): | |
| 612 return self._previous_page is not None and \ | |
| 613 self.RecordedWorkarounds() is not None | |
| 614 | |
| 615 def RecordedWorkarounds(self): | |
| 616 return self._previous_page.recorded_workarounds | |
| 617 | |
| 618 def AddTestingWorkaround(self, workarounds): | |
| 619 if workarounds is not None: | |
| 620 workarounds.append('use_gpu_driver_workaround_for_testing') | |
| 621 | |
| 622 | |
| 623 class EqualBugWorkaroundsPage(EqualBugWorkaroundsBasePage): | |
| 624 def __init__(self, story_set, expectations): | |
| 625 super(EqualBugWorkaroundsPage, self).__init__( | |
| 626 name='GpuProcess.equal_bug_workarounds_in_browser_and_gpu_process', | |
| 627 page_set=story_set, | |
| 628 shared_page_state_class=TransferWorkaroundSharedPageState, | |
| 629 expectations=expectations) | |
| 630 self.recorded_workarounds = None | |
| 631 | |
| 632 def Validate(self, tab, results): | |
| 633 gpu_list = super(EqualBugWorkaroundsPage, self).Validate(tab, results) | |
| 634 self.recorded_workarounds = gpu_list | |
| 635 | |
| 636 | |
| 637 class OnlyOneWorkaroundPage(EqualBugWorkaroundsBasePage): | |
| 638 def __init__(self, story_set, expectations): | |
| 639 super(OnlyOneWorkaroundPage, self).__init__( | |
| 640 name='GpuProcess.only_one_workaround', | |
| 641 page_set=story_set, | |
| 642 shared_page_state_class=TransferWorkaroundSharedPageState, | |
| 643 expectations=expectations) | |
| 644 self.expected_workarounds = None | |
| 645 | |
| 646 def Validate(self, tab, results): | |
| 647 # Requires EqualBugWorkaroundsPage to succeed. If it has failed then just | |
| 648 # pass to not overload the logs. | |
| 649 if self.expected_workarounds is None: | |
| 650 return | |
| 651 | |
| 652 gpu_list = super(OnlyOneWorkaroundPage, self).Validate(tab, results) | |
| 653 | |
| 654 diff = set(self.expected_workarounds).symmetric_difference(set(gpu_list)) | |
| 655 if len(diff) > 0: | |
| 656 print 'Test failed. Printing page contents:' | |
| 657 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 658 raise page_test.Failure('GPU process and expected list of driver bug' \ | |
| 659 'workarounds are not equal: %s != %s, diff: %s' % \ | |
| 660 (self.expected_workarounds, gpu_list, list(diff))) | |
| 661 | |
| 662 | |
| 572 class GpuProcessTestsStorySet(story_set_module.StorySet): | 663 class GpuProcessTestsStorySet(story_set_module.StorySet): |
| 573 | 664 |
| 574 """ Tests that accelerated content triggers the creation of a GPU process """ | 665 """ Tests that accelerated content triggers the creation of a GPU process """ |
| 575 | 666 |
| 576 def __init__(self, expectations, is_platform_android): | 667 def __init__(self, expectations, is_platform_android): |
| 577 super(GpuProcessTestsStorySet, self).__init__( | 668 super(GpuProcessTestsStorySet, self).__init__( |
| 578 serving_dirs=set(['../../../../content/test/data'])) | 669 serving_dirs=set(['../../../../content/test/data'])) |
| 579 | 670 |
| 580 urls_and_names_list = [ | 671 urls_and_names_list = [ |
| 581 ('file://../../data/gpu/functional_canvas_demo.html', | 672 ('file://../../data/gpu/functional_canvas_demo.html', |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 593 self.AddStory(GpuInfoCompletePage(self, expectations)) | 684 self.AddStory(GpuInfoCompletePage(self, expectations)) |
| 594 self.AddStory(NoGpuProcessPage(self, expectations)) | 685 self.AddStory(NoGpuProcessPage(self, expectations)) |
| 595 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 686 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 596 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 687 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 597 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) | 688 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) |
| 598 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) | 689 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) |
| 599 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) | 690 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) |
| 600 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) | 691 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) |
| 601 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) | 692 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) |
| 602 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) | 693 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) |
| 603 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, | 694 self.AddStory(EqualBugWorkaroundsPage(self, expectations)) |
| 604 expectations)) | 695 self.AddStory(OnlyOneWorkaroundPage(self, expectations)) |
| 696 | |
| 605 if not is_platform_android: | 697 if not is_platform_android: |
| 606 self.AddStory(SkipGpuProcessPage(self, expectations)) | 698 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 607 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) | 699 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) |
| 608 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) | 700 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) |
| 609 | 701 |
| 610 @property | 702 @property |
| 611 def allow_mixed_story_states(self): | 703 def allow_mixed_story_states(self): |
| 612 # Return True here in order to be able to run pages with different browser | 704 # Return True here in order to be able to run pages with different browser |
| 613 # command line arguments. | 705 # command line arguments. |
| 614 return True | 706 return True |
| OLD | NEW |