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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 page_set=story_set, | 162 page_set=story_set, |
163 shared_page_state_class=SkipGpuProcessSharedPageState, | 163 shared_page_state_class=SkipGpuProcessSharedPageState, |
164 expectations=expectations) | 164 expectations=expectations) |
165 | 165 |
166 def Validate(self, tab, results): | 166 def Validate(self, tab, results): |
167 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' | 167 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
168 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) | 168 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) |
169 if has_gpu_process: | 169 if has_gpu_process: |
170 raise page_test.Failure('GPU process detected') | 170 raise page_test.Failure('GPU process detected') |
171 | 171 |
| 172 |
| 173 class DriverBugWorkaroundsSharedPageState(GpuProcessSharedPageState): |
| 174 def __init__(self, test, finder_options, story_set): |
| 175 super(DriverBugWorkaroundsSharedPageState, self).__init__( |
| 176 test, finder_options, story_set) |
| 177 options = finder_options.browser_options |
| 178 options.AppendExtraBrowserArgs('--use_gpu_driver_workaround_for_testing') |
| 179 |
| 180 |
| 181 class DriverBugWorkaroundsInGpuProcessPage(gpu_test_base.PageBase): |
| 182 def __init__(self, story_set, expectations): |
| 183 super(DriverBugWorkaroundsInGpuProcessPage, self).__init__( |
| 184 url='chrome:gpu', |
| 185 name='GpuProcess.driver_bug_workarounds_in_gpu_process', |
| 186 page_set=story_set, |
| 187 shared_page_state_class=DriverBugWorkaroundsSharedPageState, |
| 188 expectations=expectations) |
| 189 |
| 190 def Validate(self, tab, results): |
| 191 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') |
| 192 gpu_list = tab.EvaluateJavaScript( \ |
| 193 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 194 |
| 195 diff = set(browser_list).symmetric_difference(set(gpu_list)) |
| 196 if len(diff) > 0: |
| 197 print 'Test failed. Printing page contents:' |
| 198 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 199 raise page_test.Failure('Browser and GPU process list of driver bug' \ |
| 200 'workarounds are not equal: %s != %s, diff: %s' % \ |
| 201 (browser_list, gpu_list, list(diff))) |
| 202 |
| 203 workaround = 'use_gpu_driver_workaround_for_testing' |
| 204 |
| 205 if not workaround in gpu_list: |
| 206 print 'Test failed. Printing page contents:' |
| 207 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 208 raise page_test.Failure('%s not present in GPU process workarounds' \ |
| 209 % workaround) |
| 210 |
172 class GpuProcessTestsStorySet(story_set_module.StorySet): | 211 class GpuProcessTestsStorySet(story_set_module.StorySet): |
173 | 212 |
174 """ Tests that accelerated content triggers the creation of a GPU process """ | 213 """ Tests that accelerated content triggers the creation of a GPU process """ |
175 | 214 |
176 def __init__(self, expectations): | 215 def __init__(self, expectations): |
177 super(GpuProcessTestsStorySet, self).__init__( | 216 super(GpuProcessTestsStorySet, self).__init__( |
178 serving_dirs=set(['../../../../content/test/data'])) | 217 serving_dirs=set(['../../../../content/test/data'])) |
179 | 218 |
180 urls_and_names_list = [ | 219 urls_and_names_list = [ |
181 ('file://../../data/gpu/functional_canvas_demo.html', | 220 ('file://../../data/gpu/functional_canvas_demo.html', |
182 'GpuProcess.canvas2d'), | 221 'GpuProcess.canvas2d'), |
183 ('file://../../data/gpu/functional_3d_css.html', | 222 ('file://../../data/gpu/functional_3d_css.html', |
184 'GpuProcess.css3d'), | 223 'GpuProcess.css3d'), |
185 ('file://../../data/gpu/functional_webgl.html', | 224 ('file://../../data/gpu/functional_webgl.html', |
186 'GpuProcess.webgl') | 225 'GpuProcess.webgl') |
187 ] | 226 ] |
188 | 227 |
189 for url, name in urls_and_names_list: | 228 for url, name in urls_and_names_list: |
190 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) | 229 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) |
191 | 230 |
192 self.AddStory(FunctionalVideoPage(self, expectations)) | 231 self.AddStory(FunctionalVideoPage(self, expectations)) |
193 self.AddStory(GpuInfoCompletePage(self, expectations)) | 232 self.AddStory(GpuInfoCompletePage(self, expectations)) |
194 self.AddStory(NoGpuProcessPage(self, expectations)) | 233 self.AddStory(NoGpuProcessPage(self, expectations)) |
195 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 234 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
196 self.AddStory(SkipGpuProcessPage(self, expectations)) | 235 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 236 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
197 | 237 |
198 @property | 238 @property |
199 def allow_mixed_story_states(self): | 239 def allow_mixed_story_states(self): |
200 # Return True here in order to be able to run pages with different browser | 240 # Return True here in order to be able to run pages with different browser |
201 # command line arguments. | 241 # command line arguments. |
202 return True | 242 return True |
OLD | NEW |