| 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 options = finder_options.browser_options | |
| 578 options.AppendExtraBrowserArgs('--disable-gpu-driver-bug-workarounds') | |
| 579 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') | |
| 580 | |
| 581 class OnlyOneWorkaroundPage(gpu_test_base.PageBase): | |
| 582 def __init__(self, story_set, expectations): | |
| 583 super(OnlyOneWorkaroundPage, self).__init__( | |
| 584 url='chrome:gpu', | |
| 585 name='GpuProcess.only_one_workaround', | |
| 586 page_set=story_set, | |
| 587 shared_page_state_class=OnlyOneWorkaroundSharedPageState, | |
| 588 expectations=expectations) | |
| 589 | |
| 590 def Validate(self, tab, results): | |
| 591 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') | |
| 592 gpu_list = tab.EvaluateJavaScript( \ | |
| 593 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | |
| 594 | |
| 595 if browser_list != ['use_gpu_driver_workaround_for_testing'] or \ | |
| 596 gpu_list != browser_list: | |
| 597 print 'Test failed. Printing page contents:' | |
| 598 print tab.EvaluateJavaScript('document.body.innerHTML') | |
| 599 raise page_test.Failure('Browser or GPU process lists are not reduced ' \ | |
| 600 'to only use_gpu_driver_workaround_for_testing ' \ | |
| 601 'workaround: %s != %s' % (browser_list, gpu_list)) | |
| 602 | |
| 603 | |
| 604 class GpuProcessTestsStorySet(story_set_module.StorySet): | 573 class GpuProcessTestsStorySet(story_set_module.StorySet): |
| 605 | 574 |
| 606 """ Tests that accelerated content triggers the creation of a GPU process """ | 575 """ Tests that accelerated content triggers the creation of a GPU process """ |
| 607 | 576 |
| 608 def __init__(self, expectations, is_platform_android): | 577 def __init__(self, expectations, is_platform_android): |
| 609 super(GpuProcessTestsStorySet, self).__init__( | 578 super(GpuProcessTestsStorySet, self).__init__( |
| 610 serving_dirs=set(['../../../../content/test/data'])) | 579 serving_dirs=set(['../../../../content/test/data'])) |
| 611 | 580 |
| 612 urls_and_names_list = [ | 581 urls_and_names_list = [ |
| 613 ('file://../../data/gpu/functional_canvas_demo.html', | 582 ('file://../../data/gpu/functional_canvas_demo.html', |
| (...skipping 13 matching lines...) Expand all Loading... |
| 627 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 596 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 628 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 597 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 629 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) | 598 self.AddStory(IdentifyActiveGpuPage1(self, expectations)) |
| 630 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) | 599 self.AddStory(IdentifyActiveGpuPage2(self, expectations)) |
| 631 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) | 600 self.AddStory(IdentifyActiveGpuPage3(self, expectations)) |
| 632 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) | 601 self.AddStory(IdentifyActiveGpuPage4(self, expectations)) |
| 633 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) | 602 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) |
| 634 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) | 603 self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) |
| 635 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, | 604 self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, |
| 636 expectations)) | 605 expectations)) |
| 637 self.AddStory(OnlyOneWorkaroundPage(self, expectations)) | |
| 638 | |
| 639 if not is_platform_android: | 606 if not is_platform_android: |
| 640 self.AddStory(SkipGpuProcessPage(self, expectations)) | 607 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 641 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) | 608 self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) |
| 642 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) | 609 self.AddStory(NoTransparentVisualsGpuProcessPage(self, expectations)) |
| 643 | 610 |
| 644 @property | 611 @property |
| 645 def allow_mixed_story_states(self): | 612 def allow_mixed_story_states(self): |
| 646 # Return True here in order to be able to run pages with different browser | 613 # Return True here in order to be able to run pages with different browser |
| 647 # command line arguments. | 614 # command line arguments. |
| 648 return True | 615 return True |
| OLD | NEW |