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

Unified Diff: content/test/data/gpu/webgl_extension_test.html

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/webgl2_conformance_expectations.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/gpu/webgl_extension_test.html
diff --git a/content/test/data/gpu/webgl_extension_test.html b/content/test/data/gpu/webgl_extension_test.html
new file mode 100644
index 0000000000000000000000000000000000000000..d444c3b391d79cb1dc5db614719d5bad430ec7fa
--- /dev/null
+++ b/content/test/data/gpu/webgl_extension_test.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+ <script>
+ function checkExtension(name, context_type) {
+ var canvas = document.createElement("canvas");
+ document.body.appendChild(canvas);
+
+ var gl_context = canvas.getContext(context_type || "webgl");
+
+ // If we don't have a GL context, give up now
+ if (!gl_context) {
+ webglTestHarness.reportResults(name, false, "Unable to initialize " + context_type + " context.");
+ } else {
+ var gl_extension = gl_context.getExtension(name);
+ if (gl_extension) {
+ webglTestHarness.reportResults(name, true, name + " was available");
+ } else {
+ webglTestHarness.reportResults(name, false, name + " was not available");
+ }
+ }
+
+ webglTestHarness.notifyFinished(name);
+ }
+
+ function checkSupportedExtensions(expected_extensions, context_type) {
+ var canvas = document.createElement("canvas");
+ document.body.appendChild(canvas);
+
+ var gl_context = canvas.getContext(context_type || "webgl");
+
+ // If we don't have a GL context, give up now
+ if (!gl_context) {
+ webglTestHarness.reportResults(name, false, "Unable to initialize " + context_type + " context.");
+ } else {
+ var missing_list = [];
+ var extension_list = gl_context.getSupportedExtensions();
+ for (var i in extension_list) {
+ var extension = extension_list[i];
+ if (extension.indexOf("WEBKIT_") == 0)
+ continue; // Skip WEBKIT_ prefixed extensions since they all have unprefixed variants at this point.
+ var expected_index = expected_extensions.indexOf(extension);
+ if (expected_index == -1) {
+ missing_list.push(extension);
+ }
+ }
+
+ if (missing_list.length == 0) {
+ webglTestHarness.reportResults(name, true, "All " + context_type + " extensions are being tested.");
+ } else {
+ var error_string = "The following " + context_type + " extensions are not being tested and should be added to GetExtensionList() in content/test/gpu/gpu_tests/webgl_conformance.py:";
+ for (var i in missing_list) {
+ error_string += "\n\t" + missing_list[i];
+ }
+ webglTestHarness.reportResults(name, false, error_string);
+ }
+ }
+
+ webglTestHarness.notifyFinished(name);
+ }
+ </script>
+ <body></body>
+</html>
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/webgl2_conformance_expectations.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698