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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 % (workaround, browser_list)) | 198 % (workaround, browser_list)) |
199 | 199 |
200 gpu_list = tab.EvaluateJavaScript( \ | 200 gpu_list = tab.EvaluateJavaScript( \ |
201 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | 201 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
202 if not workaround in gpu_list: | 202 if not workaround in gpu_list: |
203 print 'Test failed. Printing page contents:' | 203 print 'Test failed. Printing page contents:' |
204 print tab.EvaluateJavaScript('document.body.innerHTML') | 204 print tab.EvaluateJavaScript('document.body.innerHTML') |
205 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ | 205 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ |
206 % (workaround, gpu_list)) | 206 % (workaround, gpu_list)) |
207 | 207 |
| 208 |
| 209 class ReadbackWebGLGpuProcessSharedPageState(GpuProcessSharedPageState): |
| 210 def __init__(self, test, finder_options, story_set): |
| 211 super(ReadbackWebGLGpuProcessSharedPageState, self).__init__( |
| 212 test, finder_options, story_set) |
| 213 options = finder_options.browser_options |
| 214 |
| 215 if sys.platform.startswith('linux'): |
| 216 # Hit id 110 from kSoftwareRenderingListJson. |
| 217 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de') |
| 218 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0de1') |
| 219 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=VMware') |
| 220 options.AppendExtraBrowserArgs('--gpu-testing-gl-renderer=Gallium 0.4 ' \ |
| 221 'on llvmpipe (LLVM 3.4, 256 bits)') |
| 222 options.AppendExtraBrowserArgs('--gpu-testing-gl-version="3.0 Mesa 11.2"') |
| 223 |
| 224 class ReadbackWebGLGpuProcessPage(gpu_test_base.PageBase): |
| 225 def __init__(self, story_set, expectations): |
| 226 super(ReadbackWebGLGpuProcessPage, self).__init__( |
| 227 url='chrome:gpu', |
| 228 name='GpuProcess.readback_webgl_gpu_process', |
| 229 page_set=story_set, |
| 230 shared_page_state_class=ReadbackWebGLGpuProcessSharedPageState, |
| 231 expectations=expectations) |
| 232 |
| 233 def Validate(self, tab, results): |
| 234 if sys.platform.startswith('linux'): |
| 235 feature_status_js = 'browserBridge.gpuInfo.featureStatus.featureStatus' |
| 236 feature_status_list = tab.EvaluateJavaScript(feature_status_js) |
| 237 result = True |
| 238 for name, status in feature_status_list.items(): |
| 239 if name == 'multiple_raster_threads': |
| 240 result = result and status == 'enabled_on' |
| 241 elif name == 'native_gpu_memory_buffers': |
| 242 result = result and status == 'disabled_software' |
| 243 elif name == 'webgl': |
| 244 result = result and status == 'enabled_readback' |
| 245 else: |
| 246 result = result and status == 'unavailable_software' |
| 247 if not result: |
| 248 raise page_test.Failure('WebGL readback setup failed: %s' \ |
| 249 % feature_status_list) |
| 250 |
| 251 |
208 class GpuProcessTestsStorySet(story_set_module.StorySet): | 252 class GpuProcessTestsStorySet(story_set_module.StorySet): |
209 | 253 |
210 """ Tests that accelerated content triggers the creation of a GPU process """ | 254 """ Tests that accelerated content triggers the creation of a GPU process """ |
211 | 255 |
212 def __init__(self, expectations): | 256 def __init__(self, expectations): |
213 super(GpuProcessTestsStorySet, self).__init__( | 257 super(GpuProcessTestsStorySet, self).__init__( |
214 serving_dirs=set(['../../../../content/test/data'])) | 258 serving_dirs=set(['../../../../content/test/data'])) |
215 | 259 |
216 urls_and_names_list = [ | 260 urls_and_names_list = [ |
217 ('file://../../data/gpu/functional_canvas_demo.html', | 261 ('file://../../data/gpu/functional_canvas_demo.html', |
218 'GpuProcess.canvas2d'), | 262 'GpuProcess.canvas2d'), |
219 ('file://../../data/gpu/functional_3d_css.html', | 263 ('file://../../data/gpu/functional_3d_css.html', |
220 'GpuProcess.css3d'), | 264 'GpuProcess.css3d'), |
221 ('file://../../data/gpu/functional_webgl.html', | 265 ('file://../../data/gpu/functional_webgl.html', |
222 'GpuProcess.webgl') | 266 'GpuProcess.webgl') |
223 ] | 267 ] |
224 | 268 |
225 for url, name in urls_and_names_list: | 269 for url, name in urls_and_names_list: |
226 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) | 270 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) |
227 | 271 |
228 self.AddStory(FunctionalVideoPage(self, expectations)) | 272 self.AddStory(FunctionalVideoPage(self, expectations)) |
229 self.AddStory(GpuInfoCompletePage(self, expectations)) | 273 self.AddStory(GpuInfoCompletePage(self, expectations)) |
230 self.AddStory(NoGpuProcessPage(self, expectations)) | 274 self.AddStory(NoGpuProcessPage(self, expectations)) |
231 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 275 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
232 self.AddStory(SkipGpuProcessPage(self, expectations)) | 276 self.AddStory(SkipGpuProcessPage(self, expectations)) |
233 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 277 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 278 self.AddStory(ReadbackWebGLGpuProcessPage(self, expectations)) |
234 | 279 |
235 @property | 280 @property |
236 def allow_mixed_story_states(self): | 281 def allow_mixed_story_states(self): |
237 # Return True here in order to be able to run pages with different browser | 282 # Return True here in order to be able to run pages with different browser |
238 # command line arguments. | 283 # command line arguments. |
239 return True | 284 return True |
OLD | NEW |