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 workaround = 'use_gpu_driver_workaround_for_testing' |
| 192 |
| 193 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') |
| 194 if not workaround in browser_list: |
| 195 print 'Test failed. Printing page contents:' |
| 196 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 197 raise page_test.Failure('%s missing in Browser process workarounds: %s' \ |
| 198 % (workaround, browser_list)) |
| 199 |
| 200 gpu_list = tab.EvaluateJavaScript( \ |
| 201 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 202 if not workaround in gpu_list: |
| 203 print 'Test failed. Printing page contents:' |
| 204 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 205 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ |
| 206 % (workaround, gpu_list)) |
| 207 |
172 class GpuProcessTestsStorySet(story_set_module.StorySet): | 208 class GpuProcessTestsStorySet(story_set_module.StorySet): |
173 | 209 |
174 """ Tests that accelerated content triggers the creation of a GPU process """ | 210 """ Tests that accelerated content triggers the creation of a GPU process """ |
175 | 211 |
176 def __init__(self, expectations): | 212 def __init__(self, expectations): |
177 super(GpuProcessTestsStorySet, self).__init__( | 213 super(GpuProcessTestsStorySet, self).__init__( |
178 serving_dirs=set(['../../../../content/test/data'])) | 214 serving_dirs=set(['../../../../content/test/data'])) |
179 | 215 |
180 urls_and_names_list = [ | 216 urls_and_names_list = [ |
181 ('file://../../data/gpu/functional_canvas_demo.html', | 217 ('file://../../data/gpu/functional_canvas_demo.html', |
182 'GpuProcess.canvas2d'), | 218 'GpuProcess.canvas2d'), |
183 ('file://../../data/gpu/functional_3d_css.html', | 219 ('file://../../data/gpu/functional_3d_css.html', |
184 'GpuProcess.css3d'), | 220 'GpuProcess.css3d'), |
185 ('file://../../data/gpu/functional_webgl.html', | 221 ('file://../../data/gpu/functional_webgl.html', |
186 'GpuProcess.webgl') | 222 'GpuProcess.webgl') |
187 ] | 223 ] |
188 | 224 |
189 for url, name in urls_and_names_list: | 225 for url, name in urls_and_names_list: |
190 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) | 226 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) |
191 | 227 |
192 self.AddStory(FunctionalVideoPage(self, expectations)) | 228 self.AddStory(FunctionalVideoPage(self, expectations)) |
193 self.AddStory(GpuInfoCompletePage(self, expectations)) | 229 self.AddStory(GpuInfoCompletePage(self, expectations)) |
194 self.AddStory(NoGpuProcessPage(self, expectations)) | 230 self.AddStory(NoGpuProcessPage(self, expectations)) |
195 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 231 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
196 self.AddStory(SkipGpuProcessPage(self, expectations)) | 232 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 233 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
197 | 234 |
198 @property | 235 @property |
199 def allow_mixed_story_states(self): | 236 def allow_mixed_story_states(self): |
200 # Return True here in order to be able to run pages with different browser | 237 # Return True here in order to be able to run pages with different browser |
201 # command line arguments. | 238 # command line arguments. |
202 return True | 239 return True |
OLD | NEW |