| OLD | NEW |
| 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 extensions_path = os.path.join( | 15 |
| 16 path_util.GetChromiumSrcDir(), | |
| 17 'content', 'test', 'data', 'gpu') | |
| 18 conformance_path = os.path.join( | 16 conformance_path = os.path.join( |
| 19 path_util.GetChromiumSrcDir(), | 17 path_util.GetChromiumSrcDir(), |
| 20 'third_party', 'webgl', 'src', 'sdk', 'tests') | 18 'third_party', 'webgl', 'src', 'sdk', 'tests') |
| 21 | 19 |
| 22 conformance_harness_script = r""" | 20 conformance_harness_script = r""" |
| 23 var testHarness = {}; | 21 var testHarness = {}; |
| 24 testHarness._allTestSucceeded = true; | 22 testHarness._allTestSucceeded = true; |
| 25 testHarness._messages = ''; | 23 testHarness._messages = ''; |
| 26 testHarness._failures = 0; | 24 testHarness._failures = 0; |
| 27 testHarness._finished = false; | 25 testHarness._finished = false; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 '--test-type=gpu', | 119 '--test-type=gpu', |
| 122 '--enable-experimental-canvas-features' | 120 '--enable-experimental-canvas-features' |
| 123 ]) | 121 ]) |
| 124 browser = browser_finder.FindBrowser(options.finder_options) | 122 browser = browser_finder.FindBrowser(options.finder_options) |
| 125 if browser.target_os == 'darwin': | 123 if browser.target_os == 'darwin': |
| 126 # crbug.com/539993 | 124 # crbug.com/539993 |
| 127 options.AppendExtraBrowserArgs([ | 125 options.AppendExtraBrowserArgs([ |
| 128 '--disable-accelerated-video-decode' | 126 '--disable-accelerated-video-decode' |
| 129 ]) | 127 ]) |
| 130 | 128 |
| 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 | |
| 173 class WebglConformancePage(gpu_test_base.PageBase): | 129 class WebglConformancePage(gpu_test_base.PageBase): |
| 174 def __init__(self, story_set, test, expectations): | 130 def __init__(self, story_set, test, expectations): |
| 175 super(WebglConformancePage, self).__init__( | 131 super(WebglConformancePage, self).__init__( |
| 176 url='file://' + test, page_set=story_set, base_dir=story_set.base_dir, | 132 url='file://' + test, page_set=story_set, base_dir=story_set.base_dir, |
| 177 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState, | 133 shared_page_state_class=gpu_test_base.DesktopGpuSharedPageState, |
| 178 name=('WebglConformance.%s' % | 134 name=('WebglConformance.%s' % |
| 179 test.replace('/', '_').replace('-', '_'). | 135 test.replace('/', '_').replace('-', '_'). |
| 180 replace('\\', '_').rpartition('.')[0].replace('.', '_')), | 136 replace('\\', '_').rpartition('.')[0].replace('.', '_')), |
| 181 expectations=expectations) | 137 expectations=expectations) |
| 182 self.script_to_evaluate_on_commit = conformance_harness_script | 138 self.script_to_evaluate_on_commit = conformance_harness_script |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 options.webgl_conformance_version, | 172 options.webgl_conformance_version, |
| 217 (options.webgl2_only == 'true'), | 173 (options.webgl2_only == 'true'), |
| 218 None) | 174 None) |
| 219 | 175 |
| 220 self._webgl_version = [ | 176 self._webgl_version = [ |
| 221 int(x) for x in options.webgl_conformance_version.split('.')][0] | 177 int(x) for x in options.webgl_conformance_version.split('.')][0] |
| 222 | 178 |
| 223 ps = StorySet(serving_dirs=[''], base_dir=conformance_path) | 179 ps = StorySet(serving_dirs=[''], base_dir=conformance_path) |
| 224 | 180 |
| 225 expectations = self.GetExpectations() | 181 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 | |
| 234 for test in tests: | 182 for test in tests: |
| 235 ps.AddStory(WebglConformancePage(ps, test, expectations)) | 183 ps.AddStory(WebglConformancePage(ps, test, expectations)) |
| 236 | 184 |
| 237 return ps | 185 return ps |
| 238 | 186 |
| 239 def _CreateExpectations(self): | 187 def _CreateExpectations(self): |
| 240 assert self._webgl_version == 1 or self._webgl_version == 2 | 188 assert self._webgl_version == 1 or self._webgl_version == 2 |
| 241 if self._webgl_version == 1: | 189 if self._webgl_version == 1: |
| 242 return webgl_conformance_expectations.WebGLConformanceExpectations( | 190 return webgl_conformance_expectations.WebGLConformanceExpectations( |
| 243 conformance_path) | 191 conformance_path) |
| 244 else: | 192 else: |
| 245 return webgl2_conformance_expectations.WebGL2ConformanceExpectations( | 193 return webgl2_conformance_expectations.WebGL2ConformanceExpectations( |
| 246 conformance_path) | 194 conformance_path) |
| 247 | 195 |
| 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 | |
| 292 @staticmethod | 196 @staticmethod |
| 293 def _ParseTests(path, version, webgl2_only, folder_min_version): | 197 def _ParseTests(path, version, webgl2_only, folder_min_version): |
| 294 test_paths = [] | 198 test_paths = [] |
| 295 current_dir = os.path.dirname(path) | 199 current_dir = os.path.dirname(path) |
| 296 full_path = os.path.normpath(os.path.join(conformance_path, path)) | 200 full_path = os.path.normpath(os.path.join(conformance_path, path)) |
| 297 webgl_version = int(version.split('.')[0]) | 201 webgl_version = int(version.split('.')[0]) |
| 298 | 202 |
| 299 if not os.path.exists(full_path): | 203 if not os.path.exists(full_path): |
| 300 raise Exception('The WebGL conformance test path specified ' + | 204 raise Exception('The WebGL conformance test path specified ' + |
| 301 'does not exist: ' + full_path) | 205 'does not exist: ' + full_path) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 # We only check min-version >= 2.0.0 for the top level list. | 242 # We only check min-version >= 2.0.0 for the top level list. |
| 339 test_paths += WebglConformance._ParseTests( | 243 test_paths += WebglConformance._ParseTests( |
| 340 include_path, version, webgl2_only, min_version_to_compare) | 244 include_path, version, webgl2_only, min_version_to_compare) |
| 341 else: | 245 else: |
| 342 test = os.path.join(current_dir, test_name) | 246 test = os.path.join(current_dir, test_name) |
| 343 if webgl_version > 1: | 247 if webgl_version > 1: |
| 344 test += '?webglVersion=' + str(webgl_version) | 248 test += '?webglVersion=' + str(webgl_version) |
| 345 test_paths.append(test) | 249 test_paths.append(test) |
| 346 | 250 |
| 347 return test_paths | 251 return test_paths |
| OLD | NEW |