Chromium Code Reviews| Index: content/test/gpu/gpu_tests/webgl_conformance_integration_test.py |
| diff --git a/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py b/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py |
| index 5e4d80807a856b31e68c86c5e119fa475a2cf80b..98f088ba6b59e68a7c09445cab2c01150e4a9579 100644 |
| --- a/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py |
| +++ b/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py |
| @@ -2,12 +2,22 @@ |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| +import os |
| + |
| from gpu_tests import gpu_integration_test |
| +from gpu_tests import path_util |
| from gpu_tests import webgl_conformance |
| from gpu_tests import webgl_conformance_expectations |
| from gpu_tests import webgl2_conformance_expectations |
| +conformance_relpath = os.path.join( |
| + 'third_party', 'webgl', 'src', 'sdk', 'tests') |
| + |
| +extensions_relpath = os.path.join( |
| + 'content', 'test', 'data', 'gpu') |
| + |
| + |
| class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): |
| _webgl_version = None |
| @@ -27,6 +37,9 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): |
| @classmethod |
| def GenerateGpuTests(cls, options): |
| + # |
| + # Conformance tests |
| + # |
| test_paths = webgl_conformance.WebglConformance._ParseTests( |
| '00_test_list.txt', |
| options.webgl_conformance_version, |
| @@ -38,17 +51,118 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): |
| # generated test name cannot contain '.' |
| name = webgl_conformance.GenerateTestNameFromTestPath(test_path).replace( |
| '.', '_') |
| - yield (name, test_path, ()) |
| + yield (name, |
| + os.path.join(conformance_relpath, test_path), |
| + ('_RunConformanceTest')) |
| + |
| + # |
| + # Extension tests |
| + # |
| + extension_tests = cls._GetExtensionList() |
| + # Coverage test. |
| + yield('WebglExtension_TestCoverage', |
| + os.path.join(extensions_relpath, 'webgl_extension_test.html'), |
| + ('_RunExtensionCoverageTest', |
| + extension_tests, |
| + cls._webgl_version)) |
| + # Individual extension tests. |
| + for extension in extension_tests: |
| + yield('WebglExtension_%s' % extension, |
| + os.path.join(extensions_relpath, 'webgl_extension_test.html'), |
| + ('_RunExtensionTest', |
| + extension, |
| + cls._webgl_version)) |
| + |
| + @classmethod |
| + def _GetExtensionList(cls): |
| + if cls._webgl_version == 1: |
| + return [ |
| + 'ANGLE_instanced_arrays', |
| + 'EXT_blend_minmax', |
| + 'EXT_disjoint_timer_query', |
| + 'EXT_frag_depth', |
| + 'EXT_shader_texture_lod', |
| + 'EXT_sRGB', |
| + 'EXT_texture_filter_anisotropic', |
| + 'OES_element_index_uint', |
| + 'OES_standard_derivatives', |
| + 'OES_texture_float', |
| + 'OES_texture_float_linear', |
| + 'OES_texture_half_float', |
| + 'OES_texture_half_float_linear', |
| + 'OES_vertex_array_object', |
| + 'WEBGL_compressed_texture_astc', |
| + 'WEBGL_compressed_texture_atc', |
| + 'WEBGL_compressed_texture_etc1', |
| + 'WEBGL_compressed_texture_pvrtc', |
| + 'WEBGL_compressed_texture_s3tc', |
| + 'WEBGL_debug_renderer_info', |
| + 'WEBGL_debug_shaders', |
| + 'WEBGL_depth_texture', |
| + 'WEBGL_draw_buffers', |
| + 'WEBGL_lose_context', |
| + ] |
| + else: |
| + return [ |
| + 'EXT_color_buffer_float', |
| + 'EXT_disjoint_timer_query', |
| + 'EXT_texture_filter_anisotropic', |
| + 'OES_texture_float_linear', |
| + 'WEBGL_compressed_texture_astc', |
| + 'WEBGL_compressed_texture_atc', |
| + 'WEBGL_compressed_texture_etc1', |
| + 'WEBGL_compressed_texture_pvrtc', |
| + 'WEBGL_compressed_texture_s3tc', |
| + 'WEBGL_debug_renderer_info', |
| + 'WEBGL_debug_shaders', |
| + 'WEBGL_lose_context', |
| + ] |
| def RunActualGpuTest(self, test_path, *args): |
| + # This indirection allows these tests to trampoline through |
| + # _RunGpuTest. |
| + test_name = args[0] |
| + # pdb.set_trace() |
| + getattr(self, test_name)(test_path, *args[1:]) |
| + |
| + def _NavigateTo(self, test_path): |
| url = self.UrlOfStaticFilePath(test_path) |
| harness_script = webgl_conformance.conformance_harness_script |
| self.tab.Navigate(url, script_to_evaluate_on_commit=harness_script) |
| + |
| + def _CheckTestCompletion(self): |
| self.tab.action_runner.WaitForJavaScriptCondition( |
| 'webglTestHarness._finished', timeout_in_seconds=300) |
| if not webgl_conformance._DidWebGLTestSucceed(self.tab): |
| self.fail(webgl_conformance._WebGLTestMessages(self.tab)) |
| + def _RunConformanceTest(self, test_path, *args): |
| + self._NavigateTo(test_path) |
| + self._CheckTestCompletion() |
| + |
| + def _RunExtensionCoverageTest(self, test_path, *args): |
|
Ken Russell (switch to Gerrit)
2016/08/30 13:11:29
Compare to similar code in webgl_conformance.py.
|
| + self._NavigateTo(test_path) |
| + extension_list = args[0] |
| + webgl_version = args[1] |
| + context_type = "webgl2" if webgl_version == 2 else "webgl" |
| + extension_list_string = "[" |
| + for extension in extension_list: |
| + extension_list_string = extension_list_string + extension + ", " |
| + extension_list_string = extension_list_string + "]" |
| + self.tab.action_runner.EvaluateJavaScript( |
| + 'checkSupportedExtensions("%s", "%s")' % ( |
| + extension_list_string, context_type)) |
| + self._CheckTestCompletion() |
| + |
| + def _RunExtensionTest(self, test_path, *args): |
| + self._NavigateTo(test_path) |
| + extension = args[0] |
| + webgl_version = args[1] |
| + context_type = "webgl2" if webgl_version == 2 else "webgl" |
| + self.tab.action_runner.EvaluateJavaScript( |
| + 'checkExtension("%s", "%s")' % (extension, context_type)) |
| + self._CheckTestCompletion() |
| + |
| @classmethod |
| def CustomizeOptions(cls): |
| assert cls._webgl_version == 1 or cls._webgl_version == 2 |
| @@ -75,4 +189,9 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest): |
| cls.CustomizeOptions() |
| cls.SetBrowserOptions(cls._finder_options) |
| cls.StartBrowser() |
| - cls.SetStaticServerDir(webgl_conformance.conformance_path) |
| + # By setting multiple server directories, the root of the server |
| + # implicitly becomes the common base directory, i.e., the Chromium |
| + # src dir, and all URLs have to be specified relative to that. |
| + cls.SetStaticServerDir([ |
| + os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath), |
| + os.path.join(path_util.GetChromiumSrcDir(), extensions_relpath)]) |