OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import logging |
| 6 import os |
| 7 import sys |
| 8 |
| 9 from gpu_tests import gpu_integration_test |
| 10 from gpu_tests import gpu_process_expectations |
| 11 from gpu_tests import path_util |
| 12 |
| 13 data_path = os.path.join( |
| 14 path_util.GetChromiumSrcDir(), 'content', 'test', 'data') |
| 15 |
| 16 test_harness_script = r""" |
| 17 var domAutomationController = {}; |
| 18 domAutomationController._finished = false; |
| 19 domAutomationController.setAutomationId = function(id) {} |
| 20 domAutomationController.send = function(msg) { |
| 21 domAutomationController._finished = true; |
| 22 } |
| 23 |
| 24 window.domAutomationController = domAutomationController; |
| 25 |
| 26 function GetDriverBugWorkarounds() { |
| 27 var query_result = document.querySelector('.workarounds-list'); |
| 28 var browser_list = [] |
| 29 for (var i=0; i < query_result.childElementCount; i++) |
| 30 browser_list.push(query_result.children[i].textContent); |
| 31 return browser_list; |
| 32 }; |
| 33 """ |
| 34 |
| 35 class GpuProcessIntegrationTest(gpu_integration_test.GpuIntegrationTest): |
| 36 # We store a deep copy of the original browser finder options in |
| 37 # order to be able to restart the browser multiple times, with a |
| 38 # different set of command line arguments each time. |
| 39 _original_finder_options = None |
| 40 |
| 41 # We keep track of the set of command line arguments used to launch |
| 42 # the browser most recently in order to figure out whether we need |
| 43 # to relaunch it, if a new pixel test requires a different set of |
| 44 # arguments. |
| 45 _last_launched_browser_args = set() |
| 46 |
| 47 @classmethod |
| 48 def Name(cls): |
| 49 """The name by which this test is invoked on the command line.""" |
| 50 return 'gpu_process' |
| 51 |
| 52 @classmethod |
| 53 def setUpClass(cls): |
| 54 super(cls, GpuProcessIntegrationTest).setUpClass() |
| 55 cls._original_finder_options = cls._finder_options.Copy() |
| 56 cls.CustomizeBrowserArgs([]) |
| 57 cls.StartBrowser() |
| 58 cls.SetStaticServerDirs([data_path]) |
| 59 |
| 60 @classmethod |
| 61 def CustomizeBrowserArgs(cls, browser_args): |
| 62 if not browser_args: |
| 63 browser_args = [] |
| 64 cls._finder_options = cls._original_finder_options.Copy() |
| 65 browser_options = cls._finder_options.browser_options |
| 66 # All tests receive the following options. They aren't recorded in |
| 67 # the _last_launched_browser_args. |
| 68 browser_options.AppendExtraBrowserArgs([ |
| 69 '--enable-gpu-benchmarking', |
| 70 # TODO(kbr): figure out why the following option seems to be |
| 71 # needed on Android for robustness. |
| 72 # https://github.com/catapult-project/catapult/issues/3122 |
| 73 '--no-first-run']) |
| 74 # Append the new arguments. |
| 75 browser_options.AppendExtraBrowserArgs(browser_args) |
| 76 cls._last_launched_browser_args = set(browser_args) |
| 77 cls.SetBrowserOptions(cls._finder_options) |
| 78 |
| 79 @classmethod |
| 80 def RestartBrowserIfNecessaryWithArgs(cls, browser_args): |
| 81 if not browser_args: |
| 82 browser_args = [] |
| 83 if set(browser_args) != cls._last_launched_browser_args: |
| 84 logging.info('Restarting browser with arguments: ' + str(browser_args)) |
| 85 cls.StopBrowser() |
| 86 cls.CustomizeBrowserArgs(browser_args) |
| 87 cls.StartBrowser() |
| 88 cls.tab = cls.browser.tabs[0] |
| 89 |
| 90 @classmethod |
| 91 def _CreateExpectations(cls): |
| 92 return gpu_process_expectations.GpuProcessExpectations() |
| 93 |
| 94 @classmethod |
| 95 def GenerateGpuTests(cls, options): |
| 96 # The browser test runner synthesizes methods with the exact name |
| 97 # given in GenerateGpuTests, so in order to hand-write our tests but |
| 98 # also go through the _RunGpuTest trampoline, the test needs to be |
| 99 # slightly differently named. |
| 100 |
| 101 # Also note that since functional_video.html refers to files in |
| 102 # ../media/ , the serving dir must be the common parent directory. |
| 103 tests = (('GpuProcess_canvas2d', 'gpu/functional_canvas_demo.html'), |
| 104 ('GpuProcess_css3d', 'gpu/functional_3d_css.html'), |
| 105 ('GpuProcess_webgl', 'gpu/functional_webgl.html'), |
| 106 ('GpuProcess_video', 'gpu/functional_video.html'), |
| 107 ('GpuProcess_gpu_info_complete', 'gpu/functional_3d_css.html'), |
| 108 ('GpuProcess_no_gpu_process', 'about:blank'), |
| 109 ('GpuProcess_driver_bug_workarounds_in_gpu_process', 'chrome:gpu'), |
| 110 ('GpuProcess_readback_webgl_gpu_process', 'chrome:gpu'), |
| 111 ('GpuProcess_driver_bug_workarounds_upon_gl_renderer', |
| 112 'chrome:gpu'), |
| 113 ('GpuProcess_only_one_workaround', 'chrome:gpu'), |
| 114 ('GpuProcess_skip_gpu_process', 'chrome:gpu'), |
| 115 ('GpuProcess_identify_active_gpu1', 'chrome:gpu'), |
| 116 ('GpuProcess_identify_active_gpu2', 'chrome:gpu'), |
| 117 ('GpuProcess_identify_active_gpu3', 'chrome:gpu'), |
| 118 ('GpuProcess_identify_active_gpu4', 'chrome:gpu'), |
| 119 ('GpuProcess_software_gpu_process', 'about:blank')) |
| 120 |
| 121 # The earlier has_transparent_visuals_gpu_process and |
| 122 # no_transparent_visuals_gpu_process tests became no-ops in |
| 123 # http://crrev.com/2347383002 and were deleted. |
| 124 |
| 125 for t in tests: |
| 126 yield (t[0], t[1], ('_' + t[0])) |
| 127 |
| 128 def RunActualGpuTest(self, test_path, *args): |
| 129 test_name = args[0] |
| 130 getattr(self, test_name)(test_path) |
| 131 |
| 132 ###################################### |
| 133 # Helper functions for the tests below |
| 134 |
| 135 def _Navigate(self, test_path): |
| 136 url = self.UrlOfStaticFilePath(test_path) |
| 137 # It's crucial to use the action_runner, rather than the tab's |
| 138 # Navigate method directly. It waits for the document ready state |
| 139 # to become interactive or better, avoiding critical race |
| 140 # conditions. |
| 141 self.tab.action_runner.Navigate( |
| 142 url, script_to_evaluate_on_commit=test_harness_script) |
| 143 |
| 144 def _NavigateAndWait(self, test_path): |
| 145 self._Navigate(test_path) |
| 146 self.tab.action_runner.WaitForJavaScriptCondition( |
| 147 'window.domAutomationController._finished', timeout_in_seconds=10) |
| 148 |
| 149 def _VerifyGpuProcessPresent(self): |
| 150 tab = self.tab |
| 151 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' |
| 152 has_gpu_channel = tab.EvaluateJavaScript(has_gpu_channel_js) |
| 153 if not has_gpu_channel: |
| 154 self.fail('No GPU channel detected') |
| 155 |
| 156 def _ValidateDriverBugWorkaroundsImpl(self, process_kind, is_expected, |
| 157 workaround_name): |
| 158 tab = self.tab |
| 159 if process_kind == "browser_process": |
| 160 gpu_driver_bug_workarounds = tab.EvaluateJavaScript( |
| 161 'GetDriverBugWorkarounds()') |
| 162 elif process_kind == "gpu_process": |
| 163 gpu_driver_bug_workarounds = tab.EvaluateJavaScript( |
| 164 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 165 |
| 166 is_present = workaround_name in gpu_driver_bug_workarounds |
| 167 failure = False |
| 168 if is_expected and not is_present: |
| 169 failure = True |
| 170 error_message = "is missing" |
| 171 elif not is_expected and is_present: |
| 172 failure = True |
| 173 error_message = "is not expected" |
| 174 |
| 175 if failure: |
| 176 print 'Test failed. Printing page contents:' |
| 177 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 178 self.fail('%s %s in %s workarounds: %s' |
| 179 % (workaround_name, error_message, process_kind, |
| 180 gpu_driver_bug_workarounds)) |
| 181 |
| 182 def _ValidateDriverBugWorkarounds(self, expected_workaround, |
| 183 unexpected_workaround): |
| 184 if not expected_workaround and not unexpected_workaround: |
| 185 return |
| 186 if expected_workaround: |
| 187 self._ValidateDriverBugWorkaroundsImpl( |
| 188 "browser_process", True, expected_workaround) |
| 189 self._ValidateDriverBugWorkaroundsImpl( |
| 190 "gpu_process", True, expected_workaround) |
| 191 if unexpected_workaround: |
| 192 self._ValidateDriverBugWorkaroundsImpl( |
| 193 "browser_process", False, unexpected_workaround) |
| 194 self._ValidateDriverBugWorkaroundsImpl( |
| 195 "gpu_process", False, unexpected_workaround) |
| 196 |
| 197 # This can only be called from one of the tests, i.e., after the |
| 198 # browser's been brought up once. |
| 199 def _RunningOnAndroid(self): |
| 200 options = self.__class__._original_finder_options.browser_options |
| 201 return options.browser_type.startswith('android') |
| 202 |
| 203 def _CompareAndCaptureDriverBugWorkarounds(self): |
| 204 tab = self.tab |
| 205 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
| 206 if not tab.EvaluateJavaScript(has_gpu_process_js): |
| 207 self.fail('No GPU process detected') |
| 208 |
| 209 has_gpu_channel_js = 'chrome.gpuBenchmarking.hasGpuChannel()' |
| 210 if not tab.EvaluateJavaScript(has_gpu_channel_js): |
| 211 self.fail('No GPU channel detected') |
| 212 |
| 213 browser_list = tab.EvaluateJavaScript('GetDriverBugWorkarounds()') |
| 214 gpu_list = tab.EvaluateJavaScript( |
| 215 'chrome.gpuBenchmarking.getGpuDriverBugWorkarounds()') |
| 216 |
| 217 diff = set(browser_list).symmetric_difference(set(gpu_list)) |
| 218 if len(diff) > 0: |
| 219 print 'Test failed. Printing page contents:' |
| 220 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 221 self.fail('Browser and GPU process list of driver bug' |
| 222 'workarounds are not equal: %s != %s, diff: %s' % |
| 223 (browser_list, gpu_list, list(diff))) |
| 224 |
| 225 basic_infos = tab.EvaluateJavaScript('browserBridge.gpuInfo.basic_info') |
| 226 disabled_gl_extensions = None |
| 227 for info in basic_infos: |
| 228 if info['description'].startswith('Disabled Extensions'): |
| 229 disabled_gl_extensions = info['value'] |
| 230 break |
| 231 |
| 232 return gpu_list, disabled_gl_extensions |
| 233 |
| 234 def _VerifyActiveAndInactiveGPUs( |
| 235 self, expected_active_gpu, expected_inactive_gpus): |
| 236 tab = self.tab |
| 237 basic_infos = tab.EvaluateJavaScript('browserBridge.gpuInfo.basic_info') |
| 238 active_gpu = [] |
| 239 inactive_gpus = [] |
| 240 index = 0 |
| 241 for info in basic_infos: |
| 242 description = info['description'] |
| 243 value = info['value'] |
| 244 if description.startswith('GPU%d' % index) and value.startswith('VENDOR'): |
| 245 if value.endswith('*ACTIVE*'): |
| 246 active_gpu.append(value) |
| 247 else: |
| 248 inactive_gpus.append(value) |
| 249 index += 1 |
| 250 if active_gpu != expected_active_gpu: |
| 251 self.fail('Active GPU field is wrong %s' % active_gpu) |
| 252 if inactive_gpus != expected_inactive_gpus: |
| 253 self.fail('Inactive GPU field is wrong %s' % inactive_gpus) |
| 254 |
| 255 ###################################### |
| 256 # The actual tests |
| 257 |
| 258 def _GpuProcess_canvas2d(self, test_path): |
| 259 self.RestartBrowserIfNecessaryWithArgs([]) |
| 260 self._NavigateAndWait(test_path) |
| 261 self._VerifyGpuProcessPresent() |
| 262 |
| 263 def _GpuProcess_css3d(self, test_path): |
| 264 self.RestartBrowserIfNecessaryWithArgs([]) |
| 265 self._NavigateAndWait(test_path) |
| 266 self._VerifyGpuProcessPresent() |
| 267 |
| 268 def _GpuProcess_webgl(self, test_path): |
| 269 self.RestartBrowserIfNecessaryWithArgs([]) |
| 270 self._NavigateAndWait(test_path) |
| 271 self._VerifyGpuProcessPresent() |
| 272 |
| 273 def _GpuProcess_video(self, test_path): |
| 274 self.RestartBrowserIfNecessaryWithArgs([]) |
| 275 self._NavigateAndWait(test_path) |
| 276 self._VerifyGpuProcessPresent() |
| 277 |
| 278 def _GpuProcess_gpu_info_complete(self, test_path): |
| 279 # Regression test for crbug.com/454906 |
| 280 self.RestartBrowserIfNecessaryWithArgs([]) |
| 281 self._NavigateAndWait(test_path) |
| 282 tab = self.tab |
| 283 if not tab.browser.supports_system_info: |
| 284 self.fail('Browser must support system info') |
| 285 system_info = tab.browser.GetSystemInfo() |
| 286 if not system_info.gpu: |
| 287 self.fail('Target machine must have a GPU') |
| 288 if not system_info.gpu.aux_attributes: |
| 289 self.fail('Browser must support GPU aux attributes') |
| 290 if not 'gl_renderer' in system_info.gpu.aux_attributes: |
| 291 self.fail('Browser must have gl_renderer in aux attribs') |
| 292 if len(system_info.gpu.aux_attributes['gl_renderer']) <= 0: |
| 293 self.fail('Must have a non-empty gl_renderer string') |
| 294 |
| 295 def _GpuProcess_no_gpu_process(self, test_path): |
| 296 options = self.__class__._original_finder_options.browser_options |
| 297 if options.browser_type.startswith('android'): |
| 298 # Android doesn't support starting up the browser without any |
| 299 # GPU process. This test is skipped on Android in |
| 300 # gpu_process_expectations.py, but we must at least be able to |
| 301 # bring up the browser in order to detect that the test |
| 302 # shouldn't run. Faking a vendor and device ID can get the |
| 303 # browser into a state where it won't launch. |
| 304 return |
| 305 elif sys.platform in ('cygwin', 'win32'): |
| 306 # Hit id 34 from kSoftwareRenderingListJson. |
| 307 self.RestartBrowserIfNecessaryWithArgs([ |
| 308 '--gpu-testing-vendor-id=0x5333', |
| 309 '--gpu-testing-device-id=0x8811']) |
| 310 elif sys.platform.startswith('linux'): |
| 311 # Hit id 50 from kSoftwareRenderingListJson. |
| 312 self.RestartBrowserIfNecessaryWithArgs([ |
| 313 '--gpu-no-complete-info-collection', |
| 314 '--gpu-testing-vendor-id=0x10de', |
| 315 '--gpu-testing-device-id=0x0de1', |
| 316 '--gpu-testing-gl-vendor=VMware', |
| 317 '--gpu-testing-gl-renderer=softpipe', |
| 318 '--gpu-testing-gl-version="2.1 Mesa 10.1"']) |
| 319 elif sys.platform == 'darwin': |
| 320 # Hit id 112 from kSoftwareRenderingListJson. |
| 321 self.RestartBrowserIfNecessaryWithArgs([ |
| 322 '--gpu-testing-vendor-id=0x8086', |
| 323 '--gpu-testing-device-id=0x0116']) |
| 324 self._Navigate(test_path) |
| 325 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
| 326 has_gpu_process = self.tab.EvaluateJavaScript(has_gpu_process_js) |
| 327 if has_gpu_process: |
| 328 self.fail('GPU process detected') |
| 329 |
| 330 def _GpuProcess_driver_bug_workarounds_in_gpu_process(self, test_path): |
| 331 self.RestartBrowserIfNecessaryWithArgs([ |
| 332 '--use_gpu_driver_workaround_for_testing']) |
| 333 self._Navigate(test_path) |
| 334 self._ValidateDriverBugWorkarounds( |
| 335 'use_gpu_driver_workaround_for_testing', None) |
| 336 |
| 337 def _GpuProcess_readback_webgl_gpu_process(self, test_path): |
| 338 # This test was designed to only run on desktop Linux. |
| 339 options = self.__class__._original_finder_options.browser_options |
| 340 is_platform_android = options.browser_type.startswith('android') |
| 341 if sys.platform.startswith('linux') and not is_platform_android: |
| 342 # Hit id 110 from kSoftwareRenderingListJson. |
| 343 self.RestartBrowserIfNecessaryWithArgs([ |
| 344 '--gpu-testing-vendor-id=0x10de', |
| 345 '--gpu-testing-device-id=0x0de1', |
| 346 '--gpu-testing-gl-vendor=VMware', |
| 347 '--gpu-testing-gl-renderer=Gallium 0.4 ' \ |
| 348 'on llvmpipe (LLVM 3.4, 256 bits)', |
| 349 '--gpu-testing-gl-version="3.0 Mesa 11.2"']) |
| 350 self._Navigate(test_path) |
| 351 feature_status_js = 'browserBridge.gpuInfo.featureStatus.featureStatus' |
| 352 feature_status_list = self.tab.EvaluateJavaScript(feature_status_js) |
| 353 result = True |
| 354 for name, status in feature_status_list.items(): |
| 355 if name == 'multiple_raster_threads': |
| 356 result = result and status == 'enabled_on' |
| 357 elif name == 'native_gpu_memory_buffers': |
| 358 result = result and status == 'disabled_software' |
| 359 elif name == 'webgl': |
| 360 result = result and status == 'enabled_readback' |
| 361 elif name == 'webgl2': |
| 362 result = result and status == 'unavailable_off' |
| 363 else: |
| 364 result = result and status == 'unavailable_software' |
| 365 if not result: |
| 366 self.fail('WebGL readback setup failed: %s' % feature_status_list) |
| 367 |
| 368 def _GpuProcess_driver_bug_workarounds_upon_gl_renderer(self, test_path): |
| 369 is_platform_android = self._RunningOnAndroid() |
| 370 if is_platform_android: |
| 371 # Hit id 108 from kGpuDriverBugListJson. |
| 372 self.RestartBrowserIfNecessaryWithArgs([ |
| 373 '--gpu-testing-gl-vendor=NVIDIA Corporation', |
| 374 '--gpu-testing-gl-renderer=NVIDIA Tegra', |
| 375 '--gpu-testing-gl-version=OpenGL ES 3.1 NVIDIA 343.00']) |
| 376 elif sys.platform in ('cygwin', 'win32'): |
| 377 # Hit id 51 and 87 from kGpuDriverBugListJson. |
| 378 self.RestartBrowserIfNecessaryWithArgs([ |
| 379 '--gpu-testing-vendor-id=0x1002', |
| 380 '--gpu-testing-device-id=0x6779', |
| 381 '--gpu-testing-driver-date=11-20-2014', |
| 382 '--gpu-testing-gl-vendor=Google Inc.', |
| 383 '--gpu-testing-gl-renderer=ANGLE ' \ |
| 384 '(AMD Radeon HD 6450 Direct3D11 vs_5_0 ps_5_0)', |
| 385 '--gpu-testing-gl-version=OpenGL ES 2.0 (ANGLE 2.1.0.0c0d8006a9dd)']) |
| 386 elif sys.platform.startswith('linux'): |
| 387 # Hit id 40 from kGpuDriverBugListJson. |
| 388 self.RestartBrowserIfNecessaryWithArgs([ |
| 389 '--gpu-testing-vendor-id=0x0101', |
| 390 '--gpu-testing-device-id=0x0102', |
| 391 '--gpu-testing-gl-vendor=ARM', |
| 392 '--gpu-testing-gl-renderer=Mali-400 MP']) |
| 393 elif sys.platform == 'darwin': |
| 394 # Currently on osx no workaround relies on gl-renderer. |
| 395 return |
| 396 self._Navigate(test_path) |
| 397 if is_platform_android: |
| 398 self._ValidateDriverBugWorkarounds( |
| 399 'unpack_overlapping_rows_separately_unpack_buffer', None) |
| 400 elif sys.platform in ('cygwin', 'win32'): |
| 401 self._ValidateDriverBugWorkarounds( |
| 402 'texsubimage_faster_than_teximage', 'disable_d3d11') |
| 403 elif sys.platform.startswith('linux'): |
| 404 self._ValidateDriverBugWorkarounds('disable_discard_framebuffer', None) |
| 405 else: |
| 406 self.fail('Unexpected platform ' + sys.platform) |
| 407 |
| 408 def _GpuProcess_only_one_workaround(self, test_path): |
| 409 # Start this test by launching the browser with no command line |
| 410 # arguments. |
| 411 self.RestartBrowserIfNecessaryWithArgs([]) |
| 412 self._Navigate(test_path) |
| 413 self._VerifyGpuProcessPresent() |
| 414 recorded_workarounds, recorded_disabled_gl_extensions = ( |
| 415 self._CompareAndCaptureDriverBugWorkarounds()) |
| 416 # Add the testing workaround to the recorded workarounds. |
| 417 recorded_workarounds.append('use_gpu_driver_workaround_for_testing') |
| 418 # Relaunch the browser with OS-specific command line arguments. |
| 419 browser_args = ['--use_gpu_driver_workaround_for_testing', |
| 420 '--disable-gpu-driver-bug-workarounds'] |
| 421 # Inject some info to make sure the flags above are effective. |
| 422 if sys.platform == 'darwin': |
| 423 # Hit id 33 from kGpuDriverBugListJson. |
| 424 browser_args.extend(['--gpu-testing-gl-vendor=Imagination']) |
| 425 else: |
| 426 # Hit id 5 from kGpuDriverBugListJson. |
| 427 browser_args.extend(['--gpu-testing-vendor-id=0x10de', |
| 428 '--gpu-testing-device-id=0x0001']) |
| 429 # no multi gpu on Android. |
| 430 if not self._RunningOnAndroid(): |
| 431 browser_args.extend(['--gpu-testing-secondary-vendor-ids=', |
| 432 '--gpu-testing-secondary-device-ids=']) |
| 433 for workaround in recorded_workarounds: |
| 434 browser_args.append('--' + workaround) |
| 435 browser_args.append('--disable-gl-extensions=' + |
| 436 recorded_disabled_gl_extensions) |
| 437 self.RestartBrowserIfNecessaryWithArgs(browser_args) |
| 438 self._Navigate(test_path) |
| 439 self._VerifyGpuProcessPresent() |
| 440 new_workarounds, new_disabled_gl_extensions = ( |
| 441 self._CompareAndCaptureDriverBugWorkarounds()) |
| 442 diff = set(recorded_workarounds).symmetric_difference(new_workarounds) |
| 443 tab = self.tab |
| 444 if len(diff) > 0: |
| 445 print 'Test failed. Printing page contents:' |
| 446 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 447 self.fail( |
| 448 'GPU process and expected list of driver bug ' |
| 449 'workarounds are not equal: %s != %s, diff: %s' % |
| 450 (recorded_workarounds, new_workarounds, list(diff))) |
| 451 if recorded_disabled_gl_extensions != new_disabled_gl_extensions: |
| 452 print 'Test failed. Printing page contents:' |
| 453 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 454 self.fail( |
| 455 'The expected disabled gl extensions are ' |
| 456 'incorrect: %s != %s:' % |
| 457 (recorded_disabled_gl_extensions, new_disabled_gl_extensions)) |
| 458 |
| 459 def _GpuProcess_skip_gpu_process(self, test_path): |
| 460 self.RestartBrowserIfNecessaryWithArgs([ |
| 461 '--disable-gpu', |
| 462 '--skip-gpu-data-loading']) |
| 463 self._Navigate(test_path) |
| 464 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
| 465 has_gpu_process = self.tab.EvaluateJavaScript(has_gpu_process_js) |
| 466 if has_gpu_process: |
| 467 self.fail('GPU process detected') |
| 468 |
| 469 def _GpuProcess_identify_active_gpu1(self, test_path): |
| 470 self.RestartBrowserIfNecessaryWithArgs([ |
| 471 '--gpu-testing-vendor-id=0x8086', |
| 472 '--gpu-testing-device-id=0x040a', |
| 473 '--gpu-testing-secondary-vendor-ids=0x10de', |
| 474 '--gpu-testing-secondary-device-ids=0x0de1', |
| 475 '--gpu-testing-gl-vendor=nouveau']) |
| 476 self._Navigate(test_path) |
| 477 self._VerifyActiveAndInactiveGPUs( |
| 478 ['VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*'], |
| 479 ['VENDOR = 0x8086, DEVICE= 0x040a']) |
| 480 |
| 481 def _GpuProcess_identify_active_gpu2(self, test_path): |
| 482 self.RestartBrowserIfNecessaryWithArgs([ |
| 483 '--gpu-testing-vendor-id=0x8086', |
| 484 '--gpu-testing-device-id=0x040a', |
| 485 '--gpu-testing-secondary-vendor-ids=0x10de', |
| 486 '--gpu-testing-secondary-device-ids=0x0de1', |
| 487 '--gpu-testing-gl-vendor=Intel']) |
| 488 self._Navigate(test_path) |
| 489 self._VerifyActiveAndInactiveGPUs( |
| 490 ['VENDOR = 0x8086, DEVICE= 0x040a *ACTIVE*'], |
| 491 ['VENDOR = 0x10de, DEVICE= 0x0de1']) |
| 492 |
| 493 def _GpuProcess_identify_active_gpu3(self, test_path): |
| 494 self.RestartBrowserIfNecessaryWithArgs([ |
| 495 '--gpu-testing-vendor-id=0x8086', |
| 496 '--gpu-testing-device-id=0x040a', |
| 497 '--gpu-testing-secondary-vendor-ids=0x10de;0x1002', |
| 498 '--gpu-testing-secondary-device-ids=0x0de1;0x6779', |
| 499 '--gpu-testing-gl-vendor=X.Org', |
| 500 '--gpu-testing-gl-renderer=AMD R600']) |
| 501 self._Navigate(test_path) |
| 502 self._VerifyActiveAndInactiveGPUs( |
| 503 ['VENDOR = 0x1002, DEVICE= 0x6779 *ACTIVE*'], |
| 504 ['VENDOR = 0x8086, DEVICE= 0x040a', |
| 505 'VENDOR = 0x10de, DEVICE= 0x0de1']) |
| 506 |
| 507 def _GpuProcess_identify_active_gpu4(self, test_path): |
| 508 self.RestartBrowserIfNecessaryWithArgs([ |
| 509 '--gpu-testing-vendor-id=0x10de', |
| 510 '--gpu-testing-device-id=0x0de1', |
| 511 '--gpu-testing-secondary-vendor-ids=', |
| 512 '--gpu-testing-secondary-device-ids=', |
| 513 '--gpu-testing-gl-vendor=nouveau']) |
| 514 self._Navigate(test_path) |
| 515 self._VerifyActiveAndInactiveGPUs( |
| 516 ['VENDOR = 0x10de, DEVICE= 0x0de1 *ACTIVE*'], |
| 517 []) |
| 518 |
| 519 def _GpuProcess_software_gpu_process(self, test_path): |
| 520 # Hit exception from id 50 from kSoftwareRenderingListJson. |
| 521 self.RestartBrowserIfNecessaryWithArgs([ |
| 522 '--gpu-testing-vendor-id=0x10de', |
| 523 '--gpu-testing-device-id=0x0de1', |
| 524 '--gpu-testing-gl-vendor=VMware', |
| 525 '--gpu-testing-gl-renderer=SVGA3D', |
| 526 '--gpu-testing-gl-version=2.1 Mesa 10.1']) |
| 527 self._Navigate(test_path) |
| 528 self._VerifyGpuProcessPresent() |
OLD | NEW |