| OLD | NEW |
| 1 # Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 | 4 |
| 5 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 | 8 |
| 9 from gpu_tests import gpu_integration_test | 9 from gpu_tests import gpu_integration_test |
| 10 from gpu_tests import gpu_process_expectations | 10 from gpu_tests import gpu_process_expectations |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ('GpuProcess_css3d', 'gpu/functional_3d_css.html'), | 103 ('GpuProcess_css3d', 'gpu/functional_3d_css.html'), |
| 104 ('GpuProcess_webgl', 'gpu/functional_webgl.html'), | 104 ('GpuProcess_webgl', 'gpu/functional_webgl.html'), |
| 105 ('GpuProcess_video', 'gpu/functional_video.html'), | 105 ('GpuProcess_video', 'gpu/functional_video.html'), |
| 106 ('GpuProcess_gpu_info_complete', 'gpu/functional_3d_css.html'), | 106 ('GpuProcess_gpu_info_complete', 'gpu/functional_3d_css.html'), |
| 107 ('GpuProcess_no_gpu_process', 'about:blank'), | 107 ('GpuProcess_no_gpu_process', 'about:blank'), |
| 108 ('GpuProcess_driver_bug_workarounds_in_gpu_process', 'chrome:gpu'), | 108 ('GpuProcess_driver_bug_workarounds_in_gpu_process', 'chrome:gpu'), |
| 109 ('GpuProcess_readback_webgl_gpu_process', 'chrome:gpu'), | 109 ('GpuProcess_readback_webgl_gpu_process', 'chrome:gpu'), |
| 110 ('GpuProcess_driver_bug_workarounds_upon_gl_renderer', | 110 ('GpuProcess_driver_bug_workarounds_upon_gl_renderer', |
| 111 'chrome:gpu'), | 111 'chrome:gpu'), |
| 112 ('GpuProcess_only_one_workaround', 'chrome:gpu'), | 112 ('GpuProcess_only_one_workaround', 'chrome:gpu'), |
| 113 ('GpuProcess_skip_gpu_process', 'chrome:gpu'), | 113 ('GpuProcess_skip_gpu_process', 'gpu/functional_webgl.html'), |
| 114 ('GpuProcess_identify_active_gpu1', 'chrome:gpu'), | 114 ('GpuProcess_identify_active_gpu1', 'chrome:gpu'), |
| 115 ('GpuProcess_identify_active_gpu2', 'chrome:gpu'), | 115 ('GpuProcess_identify_active_gpu2', 'chrome:gpu'), |
| 116 ('GpuProcess_identify_active_gpu3', 'chrome:gpu'), | 116 ('GpuProcess_identify_active_gpu3', 'chrome:gpu'), |
| 117 ('GpuProcess_identify_active_gpu4', 'chrome:gpu'), | 117 ('GpuProcess_identify_active_gpu4', 'chrome:gpu'), |
| 118 ('GpuProcess_disabling_workarounds_works', 'chrome:gpu')) | 118 ('GpuProcess_disabling_workarounds_works', 'chrome:gpu'), |
| 119 ('GpuProcess_swiftshader_for_webgl', 'gpu/functional_webgl.html')) |
| 119 | 120 |
| 120 # The earlier has_transparent_visuals_gpu_process and | 121 # The earlier has_transparent_visuals_gpu_process and |
| 121 # no_transparent_visuals_gpu_process tests became no-ops in | 122 # no_transparent_visuals_gpu_process tests became no-ops in |
| 122 # http://crrev.com/2347383002 and were deleted. | 123 # http://crrev.com/2347383002 and were deleted. |
| 123 | 124 |
| 124 for t in tests: | 125 for t in tests: |
| 125 yield (t[0], t[1], ('_' + t[0])) | 126 yield (t[0], t[1], ('_' + t[0])) |
| 126 | 127 |
| 127 def RunActualGpuTest(self, test_path, *args): | 128 def RunActualGpuTest(self, test_path, *args): |
| 128 test_name = args[0] | 129 test_name = args[0] |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 (recorded_workarounds, new_workarounds, list(diff))) | 444 (recorded_workarounds, new_workarounds, list(diff))) |
| 444 if recorded_disabled_gl_extensions != new_disabled_gl_extensions: | 445 if recorded_disabled_gl_extensions != new_disabled_gl_extensions: |
| 445 print 'Test failed. Printing page contents:' | 446 print 'Test failed. Printing page contents:' |
| 446 print tab.EvaluateJavaScript('document.body.innerHTML') | 447 print tab.EvaluateJavaScript('document.body.innerHTML') |
| 447 self.fail( | 448 self.fail( |
| 448 'The expected disabled gl extensions are ' | 449 'The expected disabled gl extensions are ' |
| 449 'incorrect: %s != %s:' % | 450 'incorrect: %s != %s:' % |
| 450 (recorded_disabled_gl_extensions, new_disabled_gl_extensions)) | 451 (recorded_disabled_gl_extensions, new_disabled_gl_extensions)) |
| 451 | 452 |
| 452 def _GpuProcess_skip_gpu_process(self, test_path): | 453 def _GpuProcess_skip_gpu_process(self, test_path): |
| 454 # This test loads functional_webgl.html so that there is a |
| 455 # deliberate attempt to use an API which would start the GPU |
| 456 # process. On platforms where SwiftShader is used, this test |
| 457 # should be skipped. Once SwiftShader is enabled on all platforms, |
| 458 # this test should be removed. |
| 453 self.RestartBrowserIfNecessaryWithArgs([ | 459 self.RestartBrowserIfNecessaryWithArgs([ |
| 454 '--disable-gpu', | 460 '--disable-gpu', |
| 455 '--skip-gpu-data-loading']) | 461 '--skip-gpu-data-loading']) |
| 456 self._Navigate(test_path) | 462 self._NavigateAndWait(test_path) |
| 457 if self.tab.EvaluateJavaScript('chrome.gpuBenchmarking.hasGpuProcess()'): | 463 if self.tab.EvaluateJavaScript('chrome.gpuBenchmarking.hasGpuProcess()'): |
| 458 self.fail('GPU process detected') | 464 self.fail('GPU process detected') |
| 459 | 465 |
| 460 def _GpuProcess_identify_active_gpu1(self, test_path): | 466 def _GpuProcess_identify_active_gpu1(self, test_path): |
| 461 self.RestartBrowserIfNecessaryWithArgs([ | 467 self.RestartBrowserIfNecessaryWithArgs([ |
| 462 '--gpu-testing-vendor-id=0x8086', | 468 '--gpu-testing-vendor-id=0x8086', |
| 463 '--gpu-testing-device-id=0x040a', | 469 '--gpu-testing-device-id=0x040a', |
| 464 '--gpu-testing-secondary-vendor-ids=0x10de', | 470 '--gpu-testing-secondary-vendor-ids=0x10de', |
| 465 '--gpu-testing-secondary-device-ids=0x0de1', | 471 '--gpu-testing-secondary-device-ids=0x0de1', |
| 466 '--gpu-testing-gl-vendor=nouveau']) | 472 '--gpu-testing-gl-vendor=nouveau']) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 '--gpu-testing-secondary-device-ids=', | 522 '--gpu-testing-secondary-device-ids=', |
| 517 '--gpu-testing-gl-vendor=FakeVendor', | 523 '--gpu-testing-gl-vendor=FakeVendor', |
| 518 '--gpu-testing-gl-renderer=FakeRenderer', | 524 '--gpu-testing-gl-renderer=FakeRenderer', |
| 519 '--use_gpu_driver_workaround_for_testing=0']) | 525 '--use_gpu_driver_workaround_for_testing=0']) |
| 520 self._Navigate(test_path) | 526 self._Navigate(test_path) |
| 521 workarounds, _ = ( | 527 workarounds, _ = ( |
| 522 self._CompareAndCaptureDriverBugWorkarounds()) | 528 self._CompareAndCaptureDriverBugWorkarounds()) |
| 523 if 'use_gpu_driver_workaround_for_testing' in workarounds: | 529 if 'use_gpu_driver_workaround_for_testing' in workarounds: |
| 524 self.fail('use_gpu_driver_workaround_for_testing erroneously present') | 530 self.fail('use_gpu_driver_workaround_for_testing erroneously present') |
| 525 | 531 |
| 532 def _GpuProcess_swiftshader_for_webgl(self, test_path): |
| 533 # This test loads functional_webgl.html so that there is a |
| 534 # deliberate attempt to use an API which would start the GPU |
| 535 # process. On Windows, and eventually on other platforms where |
| 536 # SwiftShader is used, this test should pass. |
| 537 # |
| 538 # TODO(kbr): figure out a better way than --disable-gpu to |
| 539 # reliably trigger SwiftShader. |
| 540 self.RestartBrowserIfNecessaryWithArgs(['--disable-gpu']) |
| 541 self._NavigateAndWait(test_path) |
| 542 # It looks like when SwiftShader is in use (via --disable-gpu), |
| 543 # that GPU information collection doesn't yet contain what's |
| 544 # expected (the system_info.gpu.aux_attributes['gl_renderer'] |
| 545 # looks like it'll be null). Verified locally that we can fetch |
| 546 # the desired information via WebGL. |
| 547 renderer = self.tab.EvaluateJavaScript('gl_renderer') |
| 548 if not renderer: |
| 549 self.fail('getParameter(UNMASKED_RENDERER_WEBGL) was null') |
| 550 if 'SwiftShader' not in renderer: |
| 551 self.fail('Expected SwiftShader renderer; instead got ' + renderer) |
| 552 |
| 526 def load_tests(loader, tests, pattern): | 553 def load_tests(loader, tests, pattern): |
| 527 del loader, tests, pattern # Unused. | 554 del loader, tests, pattern # Unused. |
| 528 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) | 555 return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__]) |
| OLD | NEW |