OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from gpu_tests import gpu_process_expectations as expectations | 4 from gpu_tests import gpu_process_expectations as expectations |
5 from gpu_tests import gpu_test_base | 5 from gpu_tests import gpu_test_base |
6 import page_sets | 6 import page_sets |
7 | 7 |
8 from telemetry.page import page_test | 8 from telemetry.page import page_test |
9 from telemetry.story import story_set as story_set_module | |
9 | 10 |
10 test_harness_script = r""" | 11 test_harness_script = r""" |
11 var domAutomationController = {}; | 12 var domAutomationController = {}; |
12 domAutomationController._finished = false; | 13 domAutomationController._finished = false; |
13 domAutomationController.setAutomationId = function(id) {} | 14 domAutomationController.setAutomationId = function(id) {} |
14 domAutomationController.send = function(msg) { | 15 domAutomationController.send = function(msg) { |
15 domAutomationController._finished = true; | 16 domAutomationController._finished = true; |
16 } | 17 } |
17 | 18 |
18 window.domAutomationController = domAutomationController; | 19 window.domAutomationController = domAutomationController; |
(...skipping 25 matching lines...) Expand all Loading... | |
44 return 'gpu_process' | 45 return 'gpu_process' |
45 | 46 |
46 def _CreateExpectations(self): | 47 def _CreateExpectations(self): |
47 return expectations.GpuProcessExpectations() | 48 return expectations.GpuProcessExpectations() |
48 | 49 |
49 def CreateStorySet(self, options): | 50 def CreateStorySet(self, options): |
50 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations()) | 51 story_set = page_sets.GpuProcessTestsStorySet(self.GetExpectations()) |
51 for page in story_set: | 52 for page in story_set: |
52 page.script_to_evaluate_on_commit = test_harness_script | 53 page.script_to_evaluate_on_commit = test_harness_script |
53 return story_set | 54 return story_set |
55 | |
56 class NoGpuProcessValidator(gpu_test_base.ValidatorBase): | |
Ken Russell (switch to Gerrit)
2016/01/13 00:27:30
You'll need to factor this differently. It has to
| |
57 def __init__(self): | |
58 super(NoGpuProcessValidator, self).__init__( | |
59 needs_browser_restart_after_each_page=True) | |
60 | |
61 def ValidateAndMeasurePage(self, page, tab, results): | |
62 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' | |
63 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) | |
64 if has_gpu_process: | |
65 raise page_test.Failure('GPU process detected') | |
66 | |
67 class NoGpuProcess(gpu_test_base.TestBase): | |
68 """Tests that accelerated content does not trigger the creation of a GPU | |
69 process if the card is black listed""" | |
70 test = NoGpuProcessValidator | |
71 | |
72 @classmethod | |
73 def Name(cls): | |
74 return 'no_gpu_process' | |
75 | |
76 def _CreateExpectations(self): | |
77 return expectations.GpuProcessExpectations() | |
78 | |
79 def CreateStorySet(self, options): | |
80 options.AppendExtraBrowserArgs('--enable-gpu-benchmarking') | |
81 options.AppendExtraBrowserArgs('--gpu-testing-vendor-id=0x10de') | |
82 options.AppendExtraBrowserArgs('--gpu-testing-device-id=0x0de1') | |
83 options.AppendExtraBrowserArgs('--gpu-testing-gl-vendor=VMware') | |
84 options.AppendExtraBrowserArgs('--gpu-testing-gl-renderer=softpipe') | |
85 options.AppendExtraBrowserArgs('--gpu-testing-gl-version="2.1 Mesa 11.2.0-de vel"') | |
86 | |
87 story_set = story_set_module.StorySet() | |
88 story_set.AddStory(gpu_test_base.PageBase( | |
89 url='about:blank', name='GpuProcess.no_gpu_process', | |
90 page_set=story_set, expectations=self.GetExpectations())) | |
91 for page in story_set: | |
92 page.script_to_evaluate_on_commit = test_harness_script | |
93 return story_set | |
OLD | NEW |