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

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

Issue 2297673002: Port WebGL extension availability tests to the integration test harness. (Closed)
Patch Set: WEBGL_compressed_texture_es3_0 is not available on desktop Linux. Created 4 years, 2 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
« no previous file with comments | « content/test/gpu/gpu_tests/webgl_conformance_expectations.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 os
6
5 from gpu_tests import gpu_integration_test 7 from gpu_tests import gpu_integration_test
8 from gpu_tests import path_util
6 from gpu_tests import webgl_conformance 9 from gpu_tests import webgl_conformance
7 from gpu_tests import webgl_conformance_expectations 10 from gpu_tests import webgl_conformance_expectations
8 from gpu_tests import webgl2_conformance_expectations 11 from gpu_tests import webgl2_conformance_expectations
9 12
13 conformance_relcomps = (
14 'third_party', 'webgl', 'src', 'sdk', 'tests')
15
16 extensions_relcomps = (
17 'content', 'test', 'data', 'gpu')
18
19 conformance_relpath = os.path.join(*conformance_relcomps)
20 extensions_relpath = os.path.join(*extensions_relcomps)
21
22 # These URL prefixes are needed because having more than one static
23 # server dir is causing the base server directory to be moved up the
24 # directory hierarchy.
25 url_prefixes_to_trim = [
26 '/'.join(conformance_relcomps) + '/',
27 '/'.join(extensions_relcomps) + '/'
28 ]
29
30 extension_harness_additional_script = r"""
31 window.onload = function() { window._loaded = true; }
32 """
10 33
11 class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): 34 class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
12 35
13 _webgl_version = None 36 _webgl_version = None
14 37
15 @classmethod 38 @classmethod
16 def Name(cls): 39 def Name(cls):
17 return 'webgl_conformance' 40 return 'webgl_conformance'
18 41
19 @classmethod 42 @classmethod
20 def AddCommandlineArgs(cls, parser): 43 def AddCommandlineArgs(cls, parser):
21 parser.add_option('--webgl-conformance-version', 44 parser.add_option('--webgl-conformance-version',
22 help='Version of the WebGL conformance tests to run.', 45 help='Version of the WebGL conformance tests to run.',
23 default='1.0.4') 46 default='1.0.4')
24 parser.add_option('--webgl2-only', 47 parser.add_option('--webgl2-only',
25 help='Whether we include webgl 1 tests if version is 2.0.0 or above.', 48 help='Whether we include webgl 1 tests if version is 2.0.0 or above.',
26 default='false') 49 default='false')
27 50
28 @classmethod 51 @classmethod
29 def GenerateGpuTests(cls, options): 52 def GenerateGpuTests(cls, options):
53 #
54 # Conformance tests
55 #
30 test_paths = webgl_conformance.WebglConformance._ParseTests( 56 test_paths = webgl_conformance.WebglConformance._ParseTests(
31 '00_test_list.txt', 57 '00_test_list.txt',
32 options.webgl_conformance_version, 58 options.webgl_conformance_version,
33 (options.webgl2_only == 'true'), 59 (options.webgl2_only == 'true'),
34 None) 60 None)
35 cls._webgl_version = [ 61 cls._webgl_version = [
36 int(x) for x in options.webgl_conformance_version.split('.')][0] 62 int(x) for x in options.webgl_conformance_version.split('.')][0]
37 for test_path in test_paths: 63 for test_path in test_paths:
38 # generated test name cannot contain '.' 64 # generated test name cannot contain '.'
39 name = webgl_conformance.GenerateTestNameFromTestPath(test_path).replace( 65 name = webgl_conformance.GenerateTestNameFromTestPath(test_path).replace(
40 '.', '_') 66 '.', '_')
41 yield (name, test_path, ()) 67 yield (name,
68 os.path.join(conformance_relpath, test_path),
69 ('_RunConformanceTest'))
70
71 #
72 # Extension tests
73 #
74 extension_tests = cls._GetExtensionList()
75 # Coverage test.
76 yield('WebglExtension_TestCoverage',
77 os.path.join(extensions_relpath, 'webgl_extension_test.html'),
78 ('_RunExtensionCoverageTest',
79 extension_tests,
80 cls._webgl_version))
81 # Individual extension tests.
82 for extension in extension_tests:
83 yield('WebglExtension_%s' % extension,
84 os.path.join(extensions_relpath, 'webgl_extension_test.html'),
85 ('_RunExtensionTest',
86 extension,
87 cls._webgl_version))
88
89 @classmethod
90 def _GetExtensionList(cls):
91 if cls._webgl_version == 1:
92 return [
93 'ANGLE_instanced_arrays',
94 'EXT_blend_minmax',
95 'EXT_disjoint_timer_query',
96 'EXT_frag_depth',
97 'EXT_shader_texture_lod',
98 'EXT_sRGB',
99 'EXT_texture_filter_anisotropic',
100 'OES_element_index_uint',
101 'OES_standard_derivatives',
102 'OES_texture_float',
103 'OES_texture_float_linear',
104 'OES_texture_half_float',
105 'OES_texture_half_float_linear',
106 'OES_vertex_array_object',
107 'WEBGL_compressed_texture_astc',
108 'WEBGL_compressed_texture_atc',
109 'WEBGL_compressed_texture_etc1',
110 'WEBGL_compressed_texture_pvrtc',
111 'WEBGL_compressed_texture_s3tc',
112 'WEBGL_compressed_texture_s3tc_srgb',
113 'WEBGL_debug_renderer_info',
114 'WEBGL_debug_shaders',
115 'WEBGL_depth_texture',
116 'WEBGL_draw_buffers',
117 'WEBGL_lose_context',
118 ]
119 else:
120 return [
121 'EXT_color_buffer_float',
122 'EXT_disjoint_timer_query',
123 'EXT_texture_filter_anisotropic',
124 'OES_texture_float_linear',
125 'WEBGL_compressed_texture_astc',
126 'WEBGL_compressed_texture_atc',
127 'WEBGL_compressed_texture_es3_0',
128 'WEBGL_compressed_texture_etc1',
129 'WEBGL_compressed_texture_pvrtc',
130 'WEBGL_compressed_texture_s3tc',
131 'WEBGL_compressed_texture_s3tc_srgb',
132 'WEBGL_debug_renderer_info',
133 'WEBGL_debug_shaders',
134 'WEBGL_lose_context',
135 ]
42 136
43 def RunActualGpuTest(self, test_path, *args): 137 def RunActualGpuTest(self, test_path, *args):
138 # This indirection allows these tests to trampoline through
139 # _RunGpuTest.
140 test_name = args[0]
141 getattr(self, test_name)(test_path, *args[1:])
142
143 def _NavigateTo(self, test_path, harness_script):
44 url = self.UrlOfStaticFilePath(test_path) 144 url = self.UrlOfStaticFilePath(test_path)
45 harness_script = webgl_conformance.conformance_harness_script
46 self.tab.Navigate(url, script_to_evaluate_on_commit=harness_script) 145 self.tab.Navigate(url, script_to_evaluate_on_commit=harness_script)
146
147 def _CheckTestCompletion(self):
47 self.tab.action_runner.WaitForJavaScriptCondition( 148 self.tab.action_runner.WaitForJavaScriptCondition(
48 'webglTestHarness._finished', timeout_in_seconds=300) 149 'webglTestHarness._finished', timeout_in_seconds=300)
49 if not webgl_conformance._DidWebGLTestSucceed(self.tab): 150 if not webgl_conformance._DidWebGLTestSucceed(self.tab):
50 self.fail(webgl_conformance._WebGLTestMessages(self.tab)) 151 self.fail(webgl_conformance._WebGLTestMessages(self.tab))
51 152
153 def _RunConformanceTest(self, test_path, *args):
154 self._NavigateTo(test_path, webgl_conformance.conformance_harness_script)
155 self._CheckTestCompletion()
156
157
158 def _GetExtensionHarnessScript(self):
159 return (webgl_conformance.conformance_harness_script +
160 extension_harness_additional_script)
161
162 def _RunExtensionCoverageTest(self, test_path, *args):
163 self._NavigateTo(test_path, self._GetExtensionHarnessScript())
164 self.tab.action_runner.WaitForJavaScriptCondition(
165 'window._loaded', timeout_in_seconds=300)
166 extension_list = args[0]
167 webgl_version = args[1]
168 context_type = "webgl2" if webgl_version == 2 else "webgl"
169 extension_list_string = "["
170 for extension in extension_list:
171 extension_list_string = extension_list_string + extension + ", "
172 extension_list_string = extension_list_string + "]"
173 self.tab.action_runner.EvaluateJavaScript(
174 'checkSupportedExtensions("%s", "%s")' % (
175 extension_list_string, context_type))
176 self._CheckTestCompletion()
177
178 def _RunExtensionTest(self, test_path, *args):
179 self._NavigateTo(test_path, self._GetExtensionHarnessScript())
180 self.tab.action_runner.WaitForJavaScriptCondition(
181 'window._loaded', timeout_in_seconds=300)
182 extension = args[0]
183 webgl_version = args[1]
184 context_type = "webgl2" if webgl_version == 2 else "webgl"
185 self.tab.action_runner.EvaluateJavaScript(
186 'checkExtension("%s", "%s")' % (extension, context_type))
187 self._CheckTestCompletion()
188
52 @classmethod 189 @classmethod
53 def CustomizeOptions(cls): 190 def CustomizeOptions(cls):
54 assert cls._webgl_version == 1 or cls._webgl_version == 2 191 assert cls._webgl_version == 1 or cls._webgl_version == 2
55 validator = None 192 validator = None
56 if cls._webgl_version == 1: 193 if cls._webgl_version == 1:
57 validator = webgl_conformance.WebglConformanceValidator() 194 validator = webgl_conformance.WebglConformanceValidator()
58 else: 195 else:
59 validator = webgl_conformance.Webgl2ConformanceValidator() 196 validator = webgl_conformance.Webgl2ConformanceValidator()
60 validator.CustomizeBrowserOptions(cls._finder_options.browser_options) 197 validator.CustomizeBrowserOptions(cls._finder_options.browser_options)
61 198
62 @classmethod 199 @classmethod
63 def _CreateExpectations(cls): 200 def _CreateExpectations(cls):
64 assert cls._webgl_version == 1 or cls._webgl_version == 2 201 assert cls._webgl_version == 1 or cls._webgl_version == 2
65 if cls._webgl_version == 1: 202 if cls._webgl_version == 1:
66 return webgl_conformance_expectations.WebGLConformanceExpectations( 203 return webgl_conformance_expectations.WebGLConformanceExpectations(
67 webgl_conformance.conformance_path) 204 webgl_conformance.conformance_path, url_prefixes=url_prefixes_to_trim)
68 else: 205 else:
69 return webgl2_conformance_expectations.WebGL2ConformanceExpectations( 206 return webgl2_conformance_expectations.WebGL2ConformanceExpectations(
70 webgl_conformance.conformance_path) 207 webgl_conformance.conformance_path, url_prefixes=url_prefixes_to_trim)
71 208
72 @classmethod 209 @classmethod
73 def setUpClass(cls): 210 def setUpClass(cls):
74 super(cls, WebGLConformanceIntegrationTest).setUpClass() 211 super(cls, WebGLConformanceIntegrationTest).setUpClass()
75 cls.CustomizeOptions() 212 cls.CustomizeOptions()
76 cls.SetBrowserOptions(cls._finder_options) 213 cls.SetBrowserOptions(cls._finder_options)
77 cls.StartBrowser() 214 cls.StartBrowser()
78 cls.SetStaticServerDirs([webgl_conformance.conformance_path]) 215 # By setting multiple server directories, the root of the server
216 # implicitly becomes the common base directory, i.e., the Chromium
217 # src dir, and all URLs have to be specified relative to that.
218 cls.SetStaticServerDirs([
219 os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath),
220 os.path.join(path_util.GetChromiumSrcDir(), extensions_relpath)])
OLDNEW
« no previous file with comments | « content/test/gpu/gpu_tests/webgl_conformance_expectations.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698