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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 563 shared_page_state_class=NoTransparentVisualsShared, | 563 shared_page_state_class=NoTransparentVisualsShared, |
| 564 expectations=expectations, | 564 expectations=expectations, |
| 565 expected_workaround='disable_transparent_visuals', | 565 expected_workaround='disable_transparent_visuals', |
| 566 unexpected_workaround=None) | 566 unexpected_workaround=None) |
| 567 | 567 |
| 568 def Validate(self, tab, results): | 568 def Validate(self, tab, results): |
| 569 if sys.platform.startswith('linux'): | 569 if sys.platform.startswith('linux'): |
| 570 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) | 570 super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) |
| 571 | 571 |
| 572 | 572 |
| 573 class OnlyOneWorkaroundSharedPageState(GpuProcessSharedPageState): | |
| 574 def __init__(self, test, finder_options, story_set): | |
| 575 super(OnlyOneWorkaroundSharedPageState, self).__init__( | |
| 576 test, finder_options, story_set) | |
| 577 | |
| 578 # Extra browser args need to be added here. Adding them in RunStory would be | |
| 579 # too late. | |
| 580 def WillRunStory(self, results): | |
| 581 if self._previous_page: | |
| 582 options = self._finder_options.browser_options | |
| 583 options.AppendExtraBrowserArgs('--disable-gpu-driver-bug-workarounds') | |
| 584 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') | |
| 585 for workaround in self._previous_page.gpu_workarounds: | |
| 586 options.AppendExtraBrowserArgs('--' + workaround) | |
| 587 super(OnlyOneWorkaroundSharedPageState, self).WillRunStory(results) | |
| 588 | |
| 589 # self._current_page is None in WillRunStory so do the transfer here. | |
| 590 def RunStory(self, results): | |
| 591 if self._previous_page: | |
| 592 self._current_page.gpu_workarounds = self._previous_page.gpu_workarounds | |
| 593 super(OnlyOneWorkaroundSharedPageState, self).RunStory(results) | |
| 594 | |
| 595 class OnlyOneWorkaroundPage(gpu_test_base.PageBase): | |
| 596 def __init__(self, story_set, expectations): | |
| 597 super(OnlyOneWorkaroundPage, self).__init__( | |
| 598 url='chrome:gpu', | |
| 599 name='GpuProcess.only_one_workaround', | |
| 600 page_set=story_set, | |
| 601 shared_page_state_class=OnlyOneWorkaroundSharedPageState, | |
| 602 expectations=expectations) | |
| 603 self.gpu_workarounds = None | |
| 604 | |
| 605 def Validate(self, tab, results): | |
|
Ken Russell (switch to Gerrit)
2016/08/09 21:30:32
Does this test pass the first time through? If so,
Julien Isorce Samsung
2016/08/15 23:29:44
Yes.
| |
| 606 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') | |
| 607 gpu_list = tab.EvaluateJavaScript( \ | |
| 608 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | |
| 609 | |
| 610 diff = set(browser_list).symmetric_difference(set(gpu_list)) | |
| 611 if len(diff) > 0: | |
| 612 print 'Test failed. Printing page contents:' | |
| 613 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 614 raise page_test.Failure('Browser and GPU process list of driver bug' \ | |
| 615 'workarounds are not equal: %s != %s, diff: %s' % \ | |
| 616 (browser_list, gpu_list, list(diff))) | |
| 617 | |
| 618 if self.gpu_workarounds is None: | |
| 619 self.gpu_workarounds = gpu_list | |
| 620 return | |
| 621 | |
| 622 self.gpu_workarounds.append('use_gpu_driver_workaround_for_testing') | |
| 623 diff = set(self.gpu_workarounds).symmetric_difference(set(gpu_list)) | |
| 624 if len(diff) > 0: | |
| 625 print 'Test failed. Printing page contents:' | |
| 626 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 627 raise page_test.Failure('GPU process and expected list of driver bug' \ | |
| 628 'workarounds are not equal: %s != %s, diff: %s' % \ | |
| 629 (self.gpu_workarounds, gpu_list, list(diff))) | |
| 630 | |
| 631 | |
| 573 class GpuProcessTestsStorySet(story_set_module.StorySet): | 632 class GpuProcessTestsStorySet(story_set_module.StorySet): |
| 574 | 633 |
| 575 """ Tests that accelerated content triggers the creation of a GPU process """ | 634 """ Tests that accelerated content triggers the creation of a GPU process """ |
| 576 | 635 |
| 577 def __init__(self, expectations, is_platform_android): | 636 def __init__(self, expectations, is_platform_android): |
| 578 super(GpuProcessTestsStorySet, self).__init__( | 637 super(GpuProcessTestsStorySet, self).__init__( |
| 579 serving_dirs=set(['../../../../content/test/data'])) | 638 serving_dirs=set(['../../../../content/test/data'])) |
| 580 | 639 |
| 581 urls_and_names_list = [ | 640 urls_and_names_list = [ |
| 582 ('file://../../data/gpu/functional_canvas_demo.html', | 641 ('file://../../data/gpu/functional_canvas_demo.html', |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 596 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 655 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 597 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 656 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 598 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) | 657 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) |
| 599 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) | 658 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) |
| 600 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) | 659 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) |
| 601 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) | 660 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) |
| 602 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) | 661 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) |
| 603 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) | 662 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) |
| 604 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, | 663 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, |
| 605 expectations)) | 664 expectations)) |
| 665 self.AddStory(OnlyOneWorkaroundPage(self, expectations)) | |
|
Ken Russell (switch to Gerrit)
2016/08/09 21:30:32
If it works correctly to run the same test twice,
Julien Isorce Samsung
2016/08/15 23:29:44
In patch set 8, I merged the warmup test with exis
| |
| 666 self.AddStory(OnlyOneWorkaroundPage(self, expectations)) | |
| 667 | |
| 606 if not is_platform_android: | 668 if not is_platform_android: |
| 607 self.AddStory(SkipGpuProcessPage(self, expectations)) | 669 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 608 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) | 670 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) |
| 609 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) | 671 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) |
| 610 | 672 |
| 611 @property | 673 @property |
| 612 def allow_mixed_story_states(self): | 674 def allow_mixed_story_states(self): |
| 613 # Return True here in order to be able to run pages with different browser | 675 # Return True here in order to be able to run pages with different browser |
| 614 # command line arguments. | 676 # command line arguments. |
| 615 return True | 677 return True |
| OLD | NEW |