Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: content/test/gpu/gpu_tests/webgl_conformance.py

Issue 1887713006: Added tests to check that WebGL extensions are available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sigh... Trying to fix the expectations again. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 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 os 4 import os
5 5
6 from gpu_tests import gpu_test_base 6 from gpu_tests import gpu_test_base
7 from gpu_tests import path_util 7 from gpu_tests import path_util
8 from gpu_tests import webgl_conformance_expectations 8 from gpu_tests import webgl_conformance_expectations
9 from gpu_tests import webgl2_conformance_expectations 9 from gpu_tests import webgl2_conformance_expectations
10 10
11 from telemetry.internal.browser import browser_finder 11 from telemetry.internal.browser import browser_finder
12 from telemetry.page import page_test 12 from telemetry.page import page_test
13 from telemetry.story.story_set import StorySet 13 from telemetry.story.story_set import StorySet
14 14
15 15 extensions_path = os.path.join(
16 path_util.GetChromiumSrcDir(),
17 'content', 'test', 'data', 'gpu')
16 conformance_path = os.path.join( 18 conformance_path = os.path.join(
17 path_util.GetChromiumSrcDir(), 19 path_util.GetChromiumSrcDir(),
18 'third_party', 'webgl', 'src', 'sdk', 'tests') 20 'third_party', 'webgl', 'src', 'sdk', 'tests')
19 21
20 conformance_harness_script = r""" 22 conformance_harness_script = r"""
21 var testHarness = {}; 23 var testHarness = {};
22 testHarness._allTestSucceeded = true; 24 testHarness._allTestSucceeded = true;
23 testHarness._messages = ''; 25 testHarness._messages = '';
24 testHarness._failures = 0; 26 testHarness._failures = 0;
25 testHarness._finished = false; 27 testHarness._finished = false;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 '--test-type=gpu', 121 '--test-type=gpu',
120 '--enable-experimental-canvas-features' 122 '--enable-experimental-canvas-features'
121 ]) 123 ])
122 browser = browser_finder.FindBrowser(options.finder_options) 124 browser = browser_finder.FindBrowser(options.finder_options)
123 if browser.target_os == 'darwin': 125 if browser.target_os == 'darwin':
124 # crbug.com/539993 126 # crbug.com/539993
125 options.AppendExtraBrowserArgs([ 127 options.AppendExtraBrowserArgs([
126 '--disable-accelerated-video-decode' 128 '--disable-accelerated-video-decode'
127 ]) 129 ])
128 130
131 class WebglExtensionPage(gpu_test_base.PageBase):
132 def __init__(self, story_set, extension, webgl_version, expectations):
133 super(WebglExtensionPage, self).__init__(
134 url='file://' + extensions_path + '/webgl_extension_test.html',
135 page_set=story_set, base_dir=extensions_path,
136 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState,
137 name=('WebglExtension.%s' % extension),
138 expectations=expectations)
139 self.extension = extension
140 self.context_type = "webgl2" if webgl_version == 2 else "webgl"
141 self.script_to_evaluate_on_commit = conformance_harness_script
142
143 def RunNavigateSteps(self, action_runner):
144 super(WebglExtensionPage, self).RunNavigateSteps(action_runner)
145 action_runner.EvaluateJavaScript('checkExtension("%s", "%s")' %
146 (self.extension, self.context_type))
147 action_runner.WaitForJavaScriptCondition(
148 'webglTestHarness._finished', timeout_in_seconds=3)
149
150 class WebglExtensionListPage(gpu_test_base.PageBase):
151 def __init__(self, story_set, extension_list, webgl_version, expectations):
152 super(WebglExtensionListPage, self).__init__(
153 url='file://' + extensions_path + '/webgl_extension_test.html',
154 page_set=story_set, base_dir=extensions_path,
155 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState,
156 name=('WebglExtension.TestCoverage'),
157 expectations=expectations)
158 self.extension_list = extension_list
159 self.context_type = "webgl2" if webgl_version == 2 else "webgl"
160 self.script_to_evaluate_on_commit = conformance_harness_script
161
162 def RunNavigateSteps(self, action_runner):
163 super(WebglExtensionListPage, self).RunNavigateSteps(action_runner)
164 extension_list_string = "["
165 for extension in self.extension_list:
166 extension_list_string = extension_list_string + extension + ", "
167 extension_list_string = extension_list_string + "]"
168 action_runner.EvaluateJavaScript('checkSupportedExtensions("%s", "%s")' %
169 (extension_list_string, self.context_type))
170 action_runner.WaitForJavaScriptCondition(
171 'webglTestHarness._finished', timeout_in_seconds=3)
172
129 class WebglConformancePage(gpu_test_base.PageBase): 173 class WebglConformancePage(gpu_test_base.PageBase):
130 def __init__(self, story_set, test, expectations): 174 def __init__(self, story_set, test, expectations):
131 super(WebglConformancePage, self).__init__( 175 super(WebglConformancePage, self).__init__(
132 url='file://' + test, page_set=story_set, base_dir=story_set.base_dir, 176 url='file://' + test, page_set=story_set, base_dir=story_set.base_dir,
133 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState, 177 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState,
134 name=('WebglConformance.%s' % 178 name=('WebglConformance.%s' %
135 test.replace('/', '_').replace('-', '_'). 179 test.replace('/', '_').replace('-', '_').
136 replace('\\', '_').rpartition('.')[0].replace('.', '_')), 180 replace('\\', '_').rpartition('.')[0].replace('.', '_')),
137 expectations=expectations) 181 expectations=expectations)
138 self.script_to_evaluate_on_commit = conformance_harness_script 182 self.script_to_evaluate_on_commit = conformance_harness_script
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 options.webgl_conformance_version, 216 options.webgl_conformance_version,
173 (options.webgl2_only == 'true'), 217 (options.webgl2_only == 'true'),
174 None) 218 None)
175 219
176 self._webgl_version = [ 220 self._webgl_version = [
177 int(x) for x in options.webgl_conformance_version.split('.')][0] 221 int(x) for x in options.webgl_conformance_version.split('.')][0]
178 222
179 ps = StorySet(serving_dirs=[''], base_dir=conformance_path) 223 ps = StorySet(serving_dirs=[''], base_dir=conformance_path)
180 224
181 expectations = self.GetExpectations() 225 expectations = self.GetExpectations()
226
227 extension_tests = self.GetExtensionList()
228 ps.AddStory(WebglExtensionListPage(ps, extension_tests, self._webgl_version,
229 expectations))
230 for extension in extension_tests:
231 ps.AddStory(WebglExtensionPage(ps, extension, self._webgl_version,
232 expectations))
233
182 for test in tests: 234 for test in tests:
183 ps.AddStory(WebglConformancePage(ps, test, expectations)) 235 ps.AddStory(WebglConformancePage(ps, test, expectations))
184 236
185 return ps 237 return ps
186 238
187 def _CreateExpectations(self): 239 def _CreateExpectations(self):
188 assert self._webgl_version == 1 or self._webgl_version == 2 240 assert self._webgl_version == 1 or self._webgl_version == 2
189 if self._webgl_version == 1: 241 if self._webgl_version == 1:
190 return webgl_conformance_expectations.WebGLConformanceExpectations( 242 return webgl_conformance_expectations.WebGLConformanceExpectations(
191 conformance_path) 243 conformance_path)
192 else: 244 else:
193 return webgl2_conformance_expectations.WebGL2ConformanceExpectations( 245 return webgl2_conformance_expectations.WebGL2ConformanceExpectations(
194 conformance_path) 246 conformance_path)
195 247
248 def GetExtensionList(self):
249 if self._webgl_version == 1:
250 return [
251 'ANGLE_instanced_arrays',
252 'EXT_blend_minmax',
253 'EXT_disjoint_timer_query',
254 'EXT_frag_depth',
255 'EXT_shader_texture_lod',
256 'EXT_sRGB',
257 'EXT_texture_filter_anisotropic',
258 'OES_element_index_uint',
259 'OES_standard_derivatives',
260 'OES_texture_float',
261 'OES_texture_float_linear',
262 'OES_texture_half_float',
263 'OES_texture_half_float_linear',
264 'OES_vertex_array_object',
265 'WEBGL_compressed_texture_astc',
266 'WEBGL_compressed_texture_atc',
267 'WEBGL_compressed_texture_etc1',
268 'WEBGL_compressed_texture_pvrtc',
269 'WEBGL_compressed_texture_s3tc',
270 'WEBGL_debug_renderer_info',
271 'WEBGL_debug_shaders',
272 'WEBGL_depth_texture',
273 'WEBGL_draw_buffers',
274 'WEBGL_lose_context',
275 ]
276 else:
277 return [
278 'EXT_color_buffer_float',
279 'EXT_disjoint_timer_query',
280 'EXT_texture_filter_anisotropic',
281 'OES_texture_float_linear',
282 'WEBGL_compressed_texture_astc',
283 'WEBGL_compressed_texture_atc',
284 'WEBGL_compressed_texture_etc1',
285 'WEBGL_compressed_texture_pvrtc',
286 'WEBGL_compressed_texture_s3tc',
287 'WEBGL_debug_renderer_info',
288 'WEBGL_debug_shaders',
289 'WEBGL_lose_context',
290 ]
291
196 @staticmethod 292 @staticmethod
197 def _ParseTests(path, version, webgl2_only, folder_min_version): 293 def _ParseTests(path, version, webgl2_only, folder_min_version):
198 test_paths = [] 294 test_paths = []
199 current_dir = os.path.dirname(path) 295 current_dir = os.path.dirname(path)
200 full_path = os.path.normpath(os.path.join(conformance_path, path)) 296 full_path = os.path.normpath(os.path.join(conformance_path, path))
201 webgl_version = int(version.split('.')[0]) 297 webgl_version = int(version.split('.')[0])
202 298
203 if not os.path.exists(full_path): 299 if not os.path.exists(full_path):
204 raise Exception('The WebGL conformance test path specified ' + 300 raise Exception('The WebGL conformance test path specified ' +
205 'does not exist: ' + full_path) 301 'does not exist: ' + full_path)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 # We only check min-version >= 2.0.0 for the top level list. 338 # We only check min-version >= 2.0.0 for the top level list.
243 test_paths += WebglConformance._ParseTests( 339 test_paths += WebglConformance._ParseTests(
244 include_path, version, webgl2_only, min_version_to_compare) 340 include_path, version, webgl2_only, min_version_to_compare)
245 else: 341 else:
246 test = os.path.join(current_dir, test_name) 342 test = os.path.join(current_dir, test_name)
247 if webgl_version > 1: 343 if webgl_version > 1:
248 test += '?webglVersion=' + str(webgl_version) 344 test += '?webglVersion=' + str(webgl_version)
249 test_paths.append(test) 345 test_paths.append(test)
250 346
251 return test_paths 347 return test_paths
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698