Index: content/test/gpu/page_sets/gpu_process_tests.py |
diff --git a/content/test/gpu/page_sets/gpu_process_tests.py b/content/test/gpu/page_sets/gpu_process_tests.py |
index 87fa7e5136ec0845dcf02fe27de234f696822cd6..21dab16b63efdf743734ff10ec078a5d1fe997ce 100644 |
--- a/content/test/gpu/page_sets/gpu_process_tests.py |
+++ b/content/test/gpu/page_sets/gpu_process_tests.py |
@@ -570,6 +570,65 @@ class NoTransparentVisualsGpuProcessPage(DriverBugWorkaroundsTestsPage): |
super(NoTransparentVisualsGpuProcessPage, self).Validate(tab, results) |
+class OnlyOneWorkaroundSharedPageState(GpuProcessSharedPageState): |
+ def __init__(self, test, finder_options, story_set): |
+ super(OnlyOneWorkaroundSharedPageState, self).__init__( |
+ test, finder_options, story_set) |
+ |
+ # Extra browser args need to be added here. Adding them in RunStory would be |
+ # too late. |
+ def WillRunStory(self, results): |
+ if self._previous_page: |
+ options = self._finder_options.browser_options |
+ options.AppendExtraBrowserArgs('--disable-gpu-driver-bug-workarounds') |
+ options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') |
+ for workaround in self._previous_page.gpu_workarounds: |
+ options.AppendExtraBrowserArgs('--' + workaround) |
+ super(OnlyOneWorkaroundSharedPageState, self).WillRunStory(results) |
+ |
+ # self._current_page is None in WillRunStory so do the transfer here. |
+ def RunStory(self, results): |
+ if self._previous_page: |
+ self._current_page.gpu_workarounds = self._previous_page.gpu_workarounds |
+ super(OnlyOneWorkaroundSharedPageState, self).RunStory(results) |
+ |
+class OnlyOneWorkaroundPage(gpu_test_base.PageBase): |
+ def __init__(self, story_set, expectations): |
+ super(OnlyOneWorkaroundPage, self).__init__( |
+ url='chrome:gpu', |
+ name='GpuProcess.only_one_workaround', |
+ page_set=story_set, |
+ shared_page_state_class=OnlyOneWorkaroundSharedPageState, |
+ expectations=expectations) |
+ self.gpu_workarounds = None |
+ |
+ 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.
|
+ browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') |
+ gpu_list = tab.EvaluateJavaScript( \ |
+ 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
+ |
+ diff = set(browser_list).symmetric_difference(set(gpu_list)) |
+ if len(diff) > 0: |
+ print 'Test failed. Printing page contents:' |
+ print tab.EvaluateJavaScript('document.body.innerHTML') |
+ raise page_test.Failure('Browser and GPU process list of driver bug' \ |
+ 'workarounds are not equal: %s != %s, diff: %s' % \ |
+ (browser_list, gpu_list, list(diff))) |
+ |
+ if self.gpu_workarounds is None: |
+ self.gpu_workarounds = gpu_list |
+ return |
+ |
+ self.gpu_workarounds.append('use_gpu_driver_workaround_for_testing') |
+ diff = set(self.gpu_workarounds).symmetric_difference(set(gpu_list)) |
+ if len(diff) > 0: |
+ print 'Test failed. Printing page contents:' |
+ print tab.EvaluateJavaScript('document.body.innerHTML') |
+ raise page_test.Failure('GPU process and expected list of driver bug' \ |
+ 'workarounds are not equal: %s != %s, diff: %s' % \ |
+ (self.gpu_workarounds, gpu_list, list(diff))) |
+ |
+ |
class GpuProcessTestsStorySet(story_set_module.StorySet): |
""" Tests that accelerated content triggers the creation of a GPU process """ |
@@ -603,6 +662,9 @@ class GpuProcessTestsStorySet(story_set_module.StorySet): |
self.AddStory(DriverBugWorkaroundsUponGLRendererPage(self, expectations)) |
self.AddStory(EqualBugWorkaroundsInBrowserAndGpuProcessPage(self, |
expectations)) |
+ 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
|
+ self.AddStory(OnlyOneWorkaroundPage(self, expectations)) |
+ |
if not is_platform_android: |
self.AddStory(SkipGpuProcessPage(self, expectations)) |
self.AddStory(HasTransparentVisualsGpuProcessPage(self, expectations)) |