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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 def __init__(self, story_set, expectations): | 137 def __init__(self, story_set, expectations): |
138 super(SoftwareGpuProcessPage, self).__init__( | 138 super(SoftwareGpuProcessPage, self).__init__( |
139 url='about:blank', | 139 url='about:blank', |
140 name='GpuProcess.software_gpu_process', | 140 name='GpuProcess.software_gpu_process', |
141 page_set=story_set, | 141 page_set=story_set, |
142 shared_page_state_class=SoftwareGpuProcessSharedPageState, | 142 shared_page_state_class=SoftwareGpuProcessSharedPageState, |
143 expectations=expectations) | 143 expectations=expectations) |
144 | 144 |
145 | 145 |
| 146 class SkipGpuProcessSharedPageState(GpuProcessSharedPageState): |
| 147 def __init__(self, test, finder_options, story_set): |
| 148 super(SkipGpuProcessSharedPageState, self).__init__( |
| 149 test, finder_options, story_set) |
| 150 options = finder_options.browser_options |
| 151 |
| 152 options.AppendExtraBrowserArgs('--disable-gpu') |
| 153 options.AppendExtraBrowserArgs('--skip-gpu-data-loading') |
| 154 |
| 155 |
| 156 class SkipGpuProcessPage(gpu_test_base.PageBase): |
| 157 |
| 158 def __init__(self, story_set, expectations): |
| 159 super(SkipGpuProcessPage, self).__init__( |
| 160 url='chrome:gpu', |
| 161 name='GpuProcess.skip_gpu_process', |
| 162 page_set=story_set, |
| 163 shared_page_state_class=SkipGpuProcessSharedPageState, |
| 164 expectations=expectations) |
| 165 |
| 166 def Validate(self, tab, results): |
| 167 has_gpu_process_js = 'chrome.gpuBenchmarking.hasGpuProcess()' |
| 168 has_gpu_process = tab.EvaluateJavaScript(has_gpu_process_js) |
| 169 if has_gpu_process: |
| 170 raise page_test.Failure('GPU process detected') |
| 171 |
146 class GpuProcessTestsStorySet(story_set_module.StorySet): | 172 class GpuProcessTestsStorySet(story_set_module.StorySet): |
147 | 173 |
148 """ Tests that accelerated content triggers the creation of a GPU process """ | 174 """ Tests that accelerated content triggers the creation of a GPU process """ |
149 | 175 |
150 def __init__(self, expectations): | 176 def __init__(self, expectations): |
151 super(GpuProcessTestsStorySet, self).__init__( | 177 super(GpuProcessTestsStorySet, self).__init__( |
152 serving_dirs=set(['../../../../content/test/data'])) | 178 serving_dirs=set(['../../../../content/test/data'])) |
153 | 179 |
154 urls_and_names_list = [ | 180 urls_and_names_list = [ |
155 ('file://../../data/gpu/functional_canvas_demo.html', | 181 ('file://../../data/gpu/functional_canvas_demo.html', |
156 'GpuProcess.canvas2d'), | 182 'GpuProcess.canvas2d'), |
157 ('file://../../data/gpu/functional_3d_css.html', | 183 ('file://../../data/gpu/functional_3d_css.html', |
158 'GpuProcess.css3d'), | 184 'GpuProcess.css3d'), |
159 ('file://../../data/gpu/functional_webgl.html', | 185 ('file://../../data/gpu/functional_webgl.html', |
160 'GpuProcess.webgl') | 186 'GpuProcess.webgl') |
161 ] | 187 ] |
162 | 188 |
163 for url, name in urls_and_names_list: | 189 for url, name in urls_and_names_list: |
164 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) | 190 self.AddStory(GpuProcessTestsPage(url, name, self, expectations)) |
165 | 191 |
166 self.AddStory(FunctionalVideoPage(self, expectations)) | 192 self.AddStory(FunctionalVideoPage(self, expectations)) |
167 self.AddStory(GpuInfoCompletePage(self, expectations)) | 193 self.AddStory(GpuInfoCompletePage(self, expectations)) |
168 self.AddStory(NoGpuProcessPage(self, expectations)) | 194 self.AddStory(NoGpuProcessPage(self, expectations)) |
169 self.AddStory(SoftwareGpuProcessPage(self, expectations)) | 195 self.AddStory(SoftwareGpuProcessPage(self, expectations)) |
| 196 self.AddStory(SkipGpuProcessPage(self, expectations)) |
170 | 197 |
171 @property | 198 @property |
172 def allow_mixed_story_states(self): | 199 def allow_mixed_story_states(self): |
173 # Return True here in order to be able to run pages with different browser | 200 # Return True here in order to be able to run pages with different browser |
174 # command line arguments. | 201 # command line arguments. |
175 return True | 202 return True |
OLD | NEW |