Chromium Code Reviews| 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): |
| 11 | 11 |
| 12 gpu_switches = ['--gpu-no-complete-info-collection', | 12 gpu_switches = ['--gpu-no-complete-info-collection', |
| 13 '--gpu-testing-os-version', | 13 '--gpu-testing-os-version', |
| 14 '--gpu-testing-vendor-id', | 14 '--gpu-testing-vendor-id', |
| 15 '--gpu-testing-device-id', | 15 '--gpu-testing-device-id', |
| 16 '--gpu-testing-secondary-vendor-id', | |
| 17 '--gpu-testing-secondary-device-id', | |
| 16 '--gpu-testing-gl-vendor', | 18 '--gpu-testing-gl-vendor', |
| 17 '--gpu-testing-gl-renderer', | 19 '--gpu-testing-gl-renderer', |
| 18 '--gpu-testing-gl-version'] | 20 '--gpu-testing-gl-version'] |
| 19 | 21 |
| 20 def __init__(self, test, finder_options, story_set): | 22 def __init__(self, test, finder_options, story_set): |
| 21 super(GpuProcessSharedPageState, self).__init__( | 23 super(GpuProcessSharedPageState, self).__init__( |
| 22 test, finder_options, story_set) | 24 test, finder_options, story_set) |
| 23 options = finder_options.browser_options.extra_browser_args | 25 options = finder_options.browser_options.extra_browser_args |
| 24 | 26 |
| 25 # Clear all existing gpu testing switches. | 27 # Clear all existing gpu testing switches. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 % (workaround, browser_list)) | 200 % (workaround, browser_list)) |
| 199 | 201 |
| 200 gpu_list = tab.EvaluateJavaScript( \ | 202 gpu_list = tab.EvaluateJavaScript( \ |
| 201 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') | 203 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 202 if not workaround in gpu_list: | 204 if not workaround in gpu_list: |
| 203 print 'Test failed. Printing page contents:' | 205 print 'Test failed. Printing page contents:' |
| 204 print tab.EvaluateJavaScript('document.body.innerHTML') | 206 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 205 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ | 207 raise page_test.Failure('%s missing in GPU process workarounds: %s' \ |
| 206 % (workaround, gpu_list)) | 208 % (workaround, gpu_list)) |
| 207 | 209 |
| 210 class IdentifyActiveGpuSharedPageState(GpuProcessSharedPageState): | |
| 211 def __init__(self, test, finder_options, story_set): | |
| 212 super(IdentifyActiveGpuSharedPageState, self).__init__( | |
| 213 test, finder_options, story_set) | |
| 214 options = finder_options.browser_options | |
| 215 | |
| 216 if sys.platform in ('cygwin', 'win32') or sys.platform.startswith('linux'): | |
| 217 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x1002') | |
| 218 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x6779') | |
| 219 options.AppendExtraBrowserArgs('--gpu-testing-secondary-vendor-id=0x10de') | |
| 220 options.AppendExtraBrowserArgs('--gpu-testing-secondary-device-id=0x0de1') | |
|
Ken Russell (switch to Gerrit)
2016/04/14 01:54:59
A machine with both AMD and NVIDIA GPUs isn't a re
Julien Isorce Samsung
2016/04/14 18:02:47
Make sense I do not remember why I put AMD instead
| |
| 221 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=nouveau') | |
| 222 | |
| 223 class IdentifyActiveGpuPage(gpu_test_base.PageBase): | |
| 224 | |
| 225 def __init__(self, story_set, expectations): | |
| 226 super(IdentifyActiveGpuPage, self).__init__( | |
| 227 url='chrome:gpu', | |
| 228 name='GpuProcess.identify_active_gpu', | |
| 229 page_set=story_set, | |
| 230 shared_page_state_class=IdentifyActiveGpuSharedPageState, | |
| 231 expectations=expectations) | |
| 232 | |
| 233 def Validate(self, tab, results): | |
| 234 basic_infos = tab.EvaluateJavaScript('browserBridge.gpuInfo.basic_info') | |
| 235 active_gpu = [] | |
| 236 inactive_gpus = [] | |
| 237 index = 0 | |
| 238 for info in basic_infos: | |
| 239 description = info['description'] | |
| 240 value = info['value'] | |
| 241 if description.startswith('GPU%d' % index) and value.startswith('VENDOR'): | |
| 242 if value.endswith('*ACTIVE*'): | |
| 243 active_gpu.append(value) | |
| 244 else: | |
| 245 inactive_gpus.append(value) | |
| 246 index += 1 | |
| 247 | |
| 248 print active_gpu, inactive_gpus | |
| 249 | |
| 250 if len(active_gpu) != 1 or \ | |
| 251 active_gpu[0] != 'VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*': | |
| 252 raise page_test.Failure('Active GPU field is wrong %s' % active_gpu) | |
| 253 | |
| 254 if len(inactive_gpus) != 1 or \ | |
| 255 inactive_gpus[0] != 'VENDOR = 0x1002, DEVICE= 0x6779': | |
| 256 raise page_test.Failure('Inactive GPU field is wrong %s' % inactive_gpus) | |
| 257 | |
| 208 class GpuProcessTestsStorySet(story_set_module.StorySet): | 258 class GpuProcessTestsStorySet(story_set_module.StorySet): |
| 209 | 259 |
| 210 """ Tests that accelerated content triggers the creation of a GPU process """ | 260 """ Tests that accelerated content triggers the creation of a GPU process """ |
| 211 | 261 |
| 212 def __init__(self, expectations): | 262 def __init__(self, expectations): |
| 213 super(GpuProcessTestsStorySet, self).__init__( | 263 super(GpuProcessTestsStorySet, self).__init__( |
| 214 serving_dirs=set(['../../../../content/test/data'])) | 264 serving_dirs=set(['../../../../content/test/data'])) |
| 215 | 265 |
| 216 urls_and_names_list = [ | 266 urls_and_names_list = [ |
| 217 ('file://../../data/gpu/functional_canvas_demo.html', | 267 ('file://../../data/gpu/functional_canvas_demo.html', |
| 218 'GpuProcess.canvas2d'), | 268 'GpuProcess.canvas2d'), |
| 219 ('file://../../data/gpu/functional_3d_css.html', | 269 ('file://../../data/gpu/functional_3d_css.html', |
| 220 'GpuProcess.css3d'), | 270 'GpuProcess.css3d'), |
| 221 ('file://../../data/gpu/functional_webgl.html', | 271 ('file://../../data/gpu/functional_webgl.html', |
| 222 'GpuProcess.webgl') | 272 'GpuProcess.webgl') |
| 223 ] | 273 ] |
| 224 | 274 |
| 225 for url, name in urls_and_names_list: | 275 for url, name in urls_and_names_list: |
| 226 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) | 276 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) |
| 227 | 277 |
| 228 self.AddStory(FunctionalVideoPage(self, expectations)) | 278 self.AddStory(FunctionalVideoPage(self, expectations)) |
| 229 self.AddStory(GpuInfoCompletePage(self, expectations)) | 279 self.AddStory(GpuInfoCompletePage(self, expectations)) |
| 230 self.AddStory(NoGpuProcessPage(self, expectations)) | 280 self.AddStory(NoGpuProcessPage(self, expectations)) |
| 231 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 281 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 232 self.AddStory(SkipGpuProcessPage(self, expectations)) | 282 self.AddStory(SkipGpuProcessPage(self, expectations)) |
| 233 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) | 283 self.AddStory(DriverBugWorkaroundsInGpuProcessPage(self, expectations)) |
| 284 self.AddStory(IdentifyActiveGpuPage(self, expectations)) | |
| 234 | 285 |
| 235 @property | 286 @property |
| 236 def allow_mixed_story_states(self): | 287 def allow_mixed_story_states(self): |
| 237 # Return True here in order to be able to run pages with different browser | 288 # Return True here in order to be able to run pages with different browser |
| 238 # command line arguments. | 289 # command line arguments. |
| 239 return True | 290 return True |
| OLD | NEW |