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

Unified Diff: content/test/gpu/gpu_tests/webgl_conformance_integration_test.py

Issue 2378543002: (Reland) Port WebGL extension availability tests to the integration test harness. (Closed)
Patch Set: Skip WebglExtension_WEBGL_compressed_texture_s3tc_srgb on Android too. Created 4 years, 3 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 500e000f4c27859b230dfd2f56f393b331f56dc4..303ea2a16682a91a5ee0a0083bf93d420eb916a2 100644
--- a/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py
+++ b/content/test/gpu/gpu_tests/webgl_conformance_integration_test.py
@@ -2,11 +2,34 @@
# 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_relcomps = (
+ 'third_party', 'webgl', 'src', 'sdk', 'tests')
+
+extensions_relcomps = (
+ 'content', 'test', 'data', 'gpu')
+
+conformance_relpath = os.path.join(*conformance_relcomps)
+extensions_relpath = os.path.join(*extensions_relcomps)
+
+# These URL prefixes are needed because having more than one static
+# server dir is causing the base server directory to be moved up the
+# directory hierarchy.
+url_prefixes_to_trim = [
+ '/'.join(conformance_relcomps) + '/',
+ '/'.join(extensions_relcomps) + '/'
+]
+
+extension_harness_additional_script = r"""
+ window.onload = function() { window._loaded = true; }
+"""
class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
@@ -27,6 +50,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 +64,128 @@ 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_compressed_texture_s3tc_srgb',
+ '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_es3_0',
+ 'WEBGL_compressed_texture_etc1',
+ 'WEBGL_compressed_texture_pvrtc',
+ 'WEBGL_compressed_texture_s3tc',
+ 'WEBGL_compressed_texture_s3tc_srgb',
+ '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]
+ getattr(self, test_name)(test_path, *args[1:])
+
+ def _NavigateTo(self, test_path, harness_script):
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, webgl_conformance.conformance_harness_script)
+ self._CheckTestCompletion()
+
+
+ def _GetExtensionHarnessScript(self):
+ return (webgl_conformance.conformance_harness_script +
+ extension_harness_additional_script)
+
+ def _RunExtensionCoverageTest(self, test_path, *args):
+ self._NavigateTo(test_path, self._GetExtensionHarnessScript())
+ self.tab.action_runner.WaitForJavaScriptCondition(
+ 'window._loaded', timeout_in_seconds=300)
+ 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, self._GetExtensionHarnessScript())
+ self.tab.action_runner.WaitForJavaScriptCondition(
+ 'window._loaded', timeout_in_seconds=300)
+ 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
@@ -64,10 +201,10 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
assert cls._webgl_version == 1 or cls._webgl_version == 2
if cls._webgl_version == 1:
return webgl_conformance_expectations.WebGLConformanceExpectations(
- webgl_conformance.conformance_path)
+ webgl_conformance.conformance_path, url_prefixes=url_prefixes_to_trim)
else:
return webgl2_conformance_expectations.WebGL2ConformanceExpectations(
- webgl_conformance.conformance_path)
+ webgl_conformance.conformance_path, url_prefixes=url_prefixes_to_trim)
@classmethod
def setUpClass(cls):
@@ -75,4 +212,9 @@ class WebGLConformanceIntegrationTest(gpu_integration_test.GpuIntegrationTest):
cls.CustomizeOptions()
cls.SetBrowserOptions(cls._finder_options)
cls.StartBrowser()
- cls.SetStaticServerDirs([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.SetStaticServerDirs([
+ os.path.join(path_util.GetChromiumSrcDir(), conformance_relpath),
+ os.path.join(path_util.GetChromiumSrcDir(), extensions_relpath)])
« 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