Add WebGL Conformance Tests context folder.
authorgman@chromium.org <gman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 12:57:12 +0000 (12:57 +0000)
committergman@chromium.org <gman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Feb 2013 12:57:12 +0000 (12:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=109114

Reviewed by Kenneth Russell.

* webgl/conformance/context/constants-expected.txt: Added.
* webgl/conformance/context/constants.html: Added.
* webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias-expected.txt: Added.
* webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias.html: Added.
* webgl/conformance/context/context-lost-expected.txt: Added.
* webgl/conformance/context/context-lost-restored-expected.txt: Added.
* webgl/conformance/context/context-lost-restored.html: Added.
* webgl/conformance/context/context-lost.html: Added.
* webgl/conformance/context/context-release-upon-reload-expected.txt: Added.
* webgl/conformance/context/context-release-upon-reload.html: Added.
* webgl/conformance/context/context-release-with-workers-expected.txt: Added.
* webgl/conformance/context/context-release-with-workers.html: Added.
* webgl/conformance/context/context-type-test-expected.txt: Added.
* webgl/conformance/context/context-type-test.html: Added.
* webgl/conformance/context/incorrect-context-object-behaviour-expected.txt: Added.
* webgl/conformance/context/incorrect-context-object-behaviour.html: Added.
* webgl/conformance/context/methods-expected.txt: Added.
* webgl/conformance/context/methods.html: Added.
* webgl/conformance/context/premultiplyalpha-test-expected.txt: Added.
* webgl/conformance/context/premultiplyalpha-test.html: Added.
* webgl/conformance/context/resource-sharing-test-expected.txt: Added.
* webgl/conformance/context/resource-sharing-test.html: Added.
* webgl/resources/webgl_test_files/conformance/context/00_test_list.txt: Added.
* webgl/resources/webgl_test_files/conformance/context/constants.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-lost-restored.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-lost.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-release-upon-reload.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-release-with-workers.html: Added.
* webgl/resources/webgl_test_files/conformance/context/context-type-test.html: Added.
* webgl/resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html: Added.
* webgl/resources/webgl_test_files/conformance/context/methods.html: Added.
* webgl/resources/webgl_test_files/conformance/context/premultiplyalpha-test.html: Added.
* webgl/resources/webgl_test_files/conformance/context/resource-sharing-test.html: Added.
* webgl/resources/webgl_test_files/conformance/context/resources/context-release-child-with-worker.html: Added.
* webgl/resources/webgl_test_files/conformance/context/resources/context-release-upon-reload-child.html: Added.
* webgl/resources/webgl_test_files/conformance/context/resources/context-release-worker.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@142098 268f45cc-cd09-0410-ab3c-d52691b4dbfc

38 files changed:
LayoutTests/ChangeLog
LayoutTests/webgl/conformance/context/constants-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/constants.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-lost-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-lost-restored-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-lost-restored.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-lost.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-release-upon-reload-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-release-upon-reload.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-release-with-workers-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-release-with-workers.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-type-test-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/context-type-test.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/methods-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/methods.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/premultiplyalpha-test-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/premultiplyalpha-test.html [new file with mode: 0644]
LayoutTests/webgl/conformance/context/resource-sharing-test-expected.txt [new file with mode: 0644]
LayoutTests/webgl/conformance/context/resource-sharing-test.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/00_test_list.txt [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost-restored.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-upon-reload.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-with-workers.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-type-test.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/methods.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/premultiplyalpha-test.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/resource-sharing-test.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-child-with-worker.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-upon-reload-child.html [new file with mode: 0644]
LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-worker.js [new file with mode: 0644]

index 180b16f..1a8b03b 100644 (file)
@@ -1,5 +1,50 @@
 2013-02-07  Gregg Tavares  <gman@chromium.org>
 
+        Add WebGL Conformance Tests context folder.
+        https://bugs.webkit.org/show_bug.cgi?id=109114
+
+        Reviewed by Kenneth Russell.
+
+        * webgl/conformance/context/constants-expected.txt: Added.
+        * webgl/conformance/context/constants.html: Added.
+        * webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias-expected.txt: Added.
+        * webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias.html: Added.
+        * webgl/conformance/context/context-lost-expected.txt: Added.
+        * webgl/conformance/context/context-lost-restored-expected.txt: Added.
+        * webgl/conformance/context/context-lost-restored.html: Added.
+        * webgl/conformance/context/context-lost.html: Added.
+        * webgl/conformance/context/context-release-upon-reload-expected.txt: Added.
+        * webgl/conformance/context/context-release-upon-reload.html: Added.
+        * webgl/conformance/context/context-release-with-workers-expected.txt: Added.
+        * webgl/conformance/context/context-release-with-workers.html: Added.
+        * webgl/conformance/context/context-type-test-expected.txt: Added.
+        * webgl/conformance/context/context-type-test.html: Added.
+        * webgl/conformance/context/incorrect-context-object-behaviour-expected.txt: Added.
+        * webgl/conformance/context/incorrect-context-object-behaviour.html: Added.
+        * webgl/conformance/context/methods-expected.txt: Added.
+        * webgl/conformance/context/methods.html: Added.
+        * webgl/conformance/context/premultiplyalpha-test-expected.txt: Added.
+        * webgl/conformance/context/premultiplyalpha-test.html: Added.
+        * webgl/conformance/context/resource-sharing-test-expected.txt: Added.
+        * webgl/conformance/context/resource-sharing-test.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/00_test_list.txt: Added.
+        * webgl/resources/webgl_test_files/conformance/context/constants.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-lost-restored.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-lost.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-release-upon-reload.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-release-with-workers.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/context-type-test.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/methods.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/premultiplyalpha-test.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/resource-sharing-test.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/resources/context-release-child-with-worker.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/resources/context-release-upon-reload-child.html: Added.
+        * webgl/resources/webgl_test_files/conformance/context/resources/context-release-worker.js: Added.
+
+2013-02-07  Gregg Tavares  <gman@chromium.org>
+
         Add WebGL Conformance Tests uniforms folder.
         https://bugs.webkit.org/show_bug.cgi?id=109112
 
diff --git a/LayoutTests/webgl/conformance/context/constants-expected.txt b/LayoutTests/webgl/conformance/context/constants-expected.txt
new file mode 100644 (file)
index 0000000..e44b021
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/constants.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/constants.html b/LayoutTests/webgl/conformance/context/constants.html
new file mode 100644 (file)
index 0000000..7095c7c
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for constants.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/constants.html">../../resources/webgl_test_files/conformance/context/constants.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/constants.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias-expected.txt b/LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias-expected.txt
new file mode 100644 (file)
index 0000000..6e9a51b
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias.html b/LayoutTests/webgl/conformance/context/context-attributes-alpha-depth-stencil-antialias.html
new file mode 100644 (file)
index 0000000..1008f14
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-attributes-alpha-depth-stencil-antialias.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html">../../resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-lost-expected.txt b/LayoutTests/webgl/conformance/context/context-lost-expected.txt
new file mode 100644 (file)
index 0000000..eeacb2c
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-lost.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-lost-restored-expected.txt b/LayoutTests/webgl/conformance/context/context-lost-restored-expected.txt
new file mode 100644 (file)
index 0000000..202da2b
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-lost-restored.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-lost-restored.html b/LayoutTests/webgl/conformance/context/context-lost-restored.html
new file mode 100644 (file)
index 0000000..c1d78ca
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-lost-restored.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-lost-restored.html">../../resources/webgl_test_files/conformance/context/context-lost-restored.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-lost-restored.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-lost.html b/LayoutTests/webgl/conformance/context/context-lost.html
new file mode 100644 (file)
index 0000000..f3685b3
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-lost.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-lost.html">../../resources/webgl_test_files/conformance/context/context-lost.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-lost.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-release-upon-reload-expected.txt b/LayoutTests/webgl/conformance/context/context-release-upon-reload-expected.txt
new file mode 100644 (file)
index 0000000..339810c
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-release-upon-reload.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-release-upon-reload.html b/LayoutTests/webgl/conformance/context/context-release-upon-reload.html
new file mode 100644 (file)
index 0000000..c085ed0
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-release-upon-reload.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-release-upon-reload.html">../../resources/webgl_test_files/conformance/context/context-release-upon-reload.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-release-upon-reload.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-release-with-workers-expected.txt b/LayoutTests/webgl/conformance/context/context-release-with-workers-expected.txt
new file mode 100644 (file)
index 0000000..f32a66b
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-release-with-workers.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-release-with-workers.html b/LayoutTests/webgl/conformance/context/context-release-with-workers.html
new file mode 100644 (file)
index 0000000..6a843f7
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-release-with-workers.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-release-with-workers.html">../../resources/webgl_test_files/conformance/context/context-release-with-workers.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-release-with-workers.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/context-type-test-expected.txt b/LayoutTests/webgl/conformance/context/context-type-test-expected.txt
new file mode 100644 (file)
index 0000000..2fe2918
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/context-type-test.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/context-type-test.html b/LayoutTests/webgl/conformance/context/context-type-test.html
new file mode 100644 (file)
index 0000000..4ff7cc1
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for context-type-test.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/context-type-test.html">../../resources/webgl_test_files/conformance/context/context-type-test.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/context-type-test.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour-expected.txt b/LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour-expected.txt
new file mode 100644 (file)
index 0000000..79a9d88
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour.html b/LayoutTests/webgl/conformance/context/incorrect-context-object-behaviour.html
new file mode 100644 (file)
index 0000000..9808bd0
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for incorrect-context-object-behaviour.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html">../../resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/methods-expected.txt b/LayoutTests/webgl/conformance/context/methods-expected.txt
new file mode 100644 (file)
index 0000000..50bbb87
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/methods.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/methods.html b/LayoutTests/webgl/conformance/context/methods.html
new file mode 100644 (file)
index 0000000..67ce139
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for methods.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/methods.html">../../resources/webgl_test_files/conformance/context/methods.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/methods.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/premultiplyalpha-test-expected.txt b/LayoutTests/webgl/conformance/context/premultiplyalpha-test-expected.txt
new file mode 100644 (file)
index 0000000..4005e0e
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/premultiplyalpha-test.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/premultiplyalpha-test.html b/LayoutTests/webgl/conformance/context/premultiplyalpha-test.html
new file mode 100644 (file)
index 0000000..b7574f6
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for premultiplyalpha-test.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/premultiplyalpha-test.html">../../resources/webgl_test_files/conformance/context/premultiplyalpha-test.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/premultiplyalpha-test.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/conformance/context/resource-sharing-test-expected.txt b/LayoutTests/webgl/conformance/context/resource-sharing-test-expected.txt
new file mode 100644 (file)
index 0000000..c9be388
--- /dev/null
@@ -0,0 +1,5 @@
+This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.
+
+Test: ../../resources/webgl_test_files/conformance/context/resource-sharing-test.html
+PASS
+
diff --git a/LayoutTests/webgl/conformance/context/resource-sharing-test.html b/LayoutTests/webgl/conformance/context/resource-sharing-test.html
new file mode 100644 (file)
index 0000000..b8cf006
--- /dev/null
@@ -0,0 +1,18 @@
+<!-- This file is auto-generated by generate-webgl-tests.py. DO NOT EDIT -->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Conformance Test Wrapper for resource-sharing-test.html</title>
+<script type="text/javascript" src="../../../fast/js/resources/js-test-pre.js"></script>
+<script type="text/javascript" src="../../resources/webkit-webgl-test-harness.js"></script>
+</head>
+<body>
+<p>This test runs the WebGL Test listed below in an iframe and reports PASS or FAIL.</p>
+Test: <a href="../../resources/webgl_test_files/conformance/context/resource-sharing-test.html">../../resources/webgl_test_files/conformance/context/resource-sharing-test.html</a>
+<div id="result"></div>
+<div id="iframe">
+<iframe src="../../resources/webgl_test_files/conformance/context/resource-sharing-test.html" width="800" height="600"></iframe>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/00_test_list.txt b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/00_test_list.txt
new file mode 100644 (file)
index 0000000..751102a
--- /dev/null
@@ -0,0 +1,14 @@
+constants.html
+--min-version 1.0.2 context-attribute-preserve-drawing-buffer.html
+context-attributes-alpha-depth-stencil-antialias.html
+--min-version 1.0.2 --slow context-creation-and-destruction.html
+--min-version 1.0.2 context-release-upon-reload.html
+--min-version 1.0.2 context-release-with-workers.html
+context-lost-restored.html
+context-lost.html
+context-type-test.html
+incorrect-context-object-behaviour.html
+methods.html
+premultiplyalpha-test.html
+resource-sharing-test.html
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/constants.html
new file mode 100644 (file)
index 0000000..48d8d6a
--- /dev/null
@@ -0,0 +1,540 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Constants Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
+<script>
+"use strict";
+description("This test ensures that the WebGL context has all the constants in the specification.");
+
+var constants = {
+    /* ClearBufferMask */
+DEPTH_BUFFER_BIT               : 0x00000100,
+STENCIL_BUFFER_BIT             : 0x00000400,
+COLOR_BUFFER_BIT               : 0x00004000,
+    
+    /* BeginMode */
+POINTS                         : 0x0000,
+LINES                          : 0x0001,
+LINE_LOOP                      : 0x0002,
+LINE_STRIP                     : 0x0003,
+TRIANGLES                      : 0x0004,
+TRIANGLE_STRIP                 : 0x0005,
+TRIANGLE_FAN                   : 0x0006,
+    
+    /* AlphaFunction (not supported in ES20) */
+    /*      NEVER */
+    /*      LESS */
+    /*      EQUAL */
+    /*      LEQUAL */
+    /*      GREATER */
+    /*      NOTEQUAL */
+    /*      GEQUAL */
+    /*      ALWAYS */
+    
+    /* BlendingFactorDest */
+ZERO                           : 0,
+ONE                            : 1,
+SRC_COLOR                      : 0x0300,
+ONE_MINUS_SRC_COLOR            : 0x0301,
+SRC_ALPHA                      : 0x0302,
+ONE_MINUS_SRC_ALPHA            : 0x0303,
+DST_ALPHA                      : 0x0304,
+ONE_MINUS_DST_ALPHA            : 0x0305,
+    
+    /* BlendingFactorSrc */
+    /*      ZERO */
+    /*      ONE */
+DST_COLOR                      : 0x0306,
+ONE_MINUS_DST_COLOR            : 0x0307,
+SRC_ALPHA_SATURATE             : 0x0308,
+    /*      SRC_ALPHA */
+    /*      ONE_MINUS_SRC_ALPHA */
+    /*      DST_ALPHA */
+    /*      ONE_MINUS_DST_ALPHA */
+    
+    /* BlendEquationSeparate */
+FUNC_ADD                       : 0x8006,
+BLEND_EQUATION                 : 0x8009,
+BLEND_EQUATION_RGB             : 0x8009,   /* same as BLEND_EQUATION */
+BLEND_EQUATION_ALPHA           : 0x883D,
+    
+    /* BlendSubtract */
+FUNC_SUBTRACT                  : 0x800A,
+FUNC_REVERSE_SUBTRACT          : 0x800B,
+    
+    /* Separate Blend Functions */
+BLEND_DST_RGB                  : 0x80C8,
+BLEND_SRC_RGB                  : 0x80C9,
+BLEND_DST_ALPHA                : 0x80CA,
+BLEND_SRC_ALPHA                : 0x80CB,
+CONSTANT_COLOR                 : 0x8001,
+ONE_MINUS_CONSTANT_COLOR       : 0x8002,
+CONSTANT_ALPHA                 : 0x8003,
+ONE_MINUS_CONSTANT_ALPHA       : 0x8004,
+BLEND_COLOR                    : 0x8005,
+    
+    /* Buffer Objects */
+ARRAY_BUFFER                   : 0x8892,
+ELEMENT_ARRAY_BUFFER           : 0x8893,
+ARRAY_BUFFER_BINDING           : 0x8894,
+ELEMENT_ARRAY_BUFFER_BINDING   : 0x8895,
+    
+STREAM_DRAW                    : 0x88E0,
+STATIC_DRAW                    : 0x88E4,
+DYNAMIC_DRAW                   : 0x88E8,
+    
+BUFFER_SIZE                    : 0x8764,
+BUFFER_USAGE                   : 0x8765,
+    
+CURRENT_VERTEX_ATTRIB          : 0x8626,
+    
+    /* CullFaceMode */
+FRONT                          : 0x0404,
+BACK                           : 0x0405,
+FRONT_AND_BACK                 : 0x0408,
+    
+    /* DepthFunction */
+    /*      NEVER */
+    /*      LESS */
+    /*      EQUAL */
+    /*      LEQUAL */
+    /*      GREATER */
+    /*      NOTEQUAL */
+    /*      GEQUAL */
+    /*      ALWAYS */
+    
+    /* EnableCap */
+    /* TEXTURE_2D */
+CULL_FACE                      : 0x0B44,
+BLEND                          : 0x0BE2,
+DITHER                         : 0x0BD0,
+STENCIL_TEST                   : 0x0B90,
+DEPTH_TEST                     : 0x0B71,
+SCISSOR_TEST                   : 0x0C11,
+POLYGON_OFFSET_FILL            : 0x8037,
+SAMPLE_ALPHA_TO_COVERAGE       : 0x809E,
+SAMPLE_COVERAGE                : 0x80A0,
+    
+    /* ErrorCode */
+NO_ERROR                       : 0,
+INVALID_ENUM                   : 0x0500,
+INVALID_VALUE                  : 0x0501,
+INVALID_OPERATION              : 0x0502,
+OUT_OF_MEMORY                  : 0x0505,
+    
+    /* FrontFaceDirection */
+CW                             : 0x0900,
+CCW                            : 0x0901,
+    
+    /* GetPName */
+LINE_WIDTH                     : 0x0B21,
+ALIASED_POINT_SIZE_RANGE       : 0x846D,
+ALIASED_LINE_WIDTH_RANGE       : 0x846E,
+CULL_FACE_MODE                 : 0x0B45,
+FRONT_FACE                     : 0x0B46,
+DEPTH_RANGE                    : 0x0B70,
+DEPTH_WRITEMASK                : 0x0B72,
+DEPTH_CLEAR_VALUE              : 0x0B73,
+DEPTH_FUNC                     : 0x0B74,
+STENCIL_CLEAR_VALUE            : 0x0B91,
+STENCIL_FUNC                   : 0x0B92,
+STENCIL_FAIL                   : 0x0B94,
+STENCIL_PASS_DEPTH_FAIL        : 0x0B95,
+STENCIL_PASS_DEPTH_PASS        : 0x0B96,
+STENCIL_REF                    : 0x0B97,
+STENCIL_VALUE_MASK             : 0x0B93,
+STENCIL_WRITEMASK              : 0x0B98,
+STENCIL_BACK_FUNC              : 0x8800,
+STENCIL_BACK_FAIL              : 0x8801,
+STENCIL_BACK_PASS_DEPTH_FAIL   : 0x8802,
+STENCIL_BACK_PASS_DEPTH_PASS   : 0x8803,
+STENCIL_BACK_REF               : 0x8CA3,
+STENCIL_BACK_VALUE_MASK        : 0x8CA4,
+STENCIL_BACK_WRITEMASK         : 0x8CA5,
+VIEWPORT                       : 0x0BA2,
+SCISSOR_BOX                    : 0x0C10,
+    /*      SCISSOR_TEST */
+COLOR_CLEAR_VALUE              : 0x0C22,
+COLOR_WRITEMASK                : 0x0C23,
+UNPACK_ALIGNMENT               : 0x0CF5,
+PACK_ALIGNMENT                 : 0x0D05,
+MAX_TEXTURE_SIZE               : 0x0D33,
+MAX_VIEWPORT_DIMS              : 0x0D3A,
+SUBPIXEL_BITS                  : 0x0D50,
+RED_BITS                       : 0x0D52,
+GREEN_BITS                     : 0x0D53,
+BLUE_BITS                      : 0x0D54,
+ALPHA_BITS                     : 0x0D55,
+DEPTH_BITS                     : 0x0D56,
+STENCIL_BITS                   : 0x0D57,
+POLYGON_OFFSET_UNITS           : 0x2A00,
+    /*      POLYGON_OFFSET_FILL */
+POLYGON_OFFSET_FACTOR          : 0x8038,
+TEXTURE_BINDING_2D             : 0x8069,
+SAMPLE_BUFFERS                 : 0x80A8,
+SAMPLES                        : 0x80A9,
+SAMPLE_COVERAGE_VALUE          : 0x80AA,
+SAMPLE_COVERAGE_INVERT         : 0x80AB,
+    
+    /* GetTextureParameter */
+    /*      TEXTURE_MAG_FILTER */
+    /*      TEXTURE_MIN_FILTER */
+    /*      TEXTURE_WRAP_S */
+    /*      TEXTURE_WRAP_T */
+    
+COMPRESSED_TEXTURE_FORMATS     : 0x86A3,
+    
+    /* HintMode */
+DONT_CARE                      : 0x1100,
+FASTEST                        : 0x1101,
+NICEST                         : 0x1102,
+    
+    /* HintTarget */
+GENERATE_MIPMAP_HINT            : 0x8192,
+    
+    /* DataType */
+BYTE                           : 0x1400,
+UNSIGNED_BYTE                  : 0x1401,
+SHORT                          : 0x1402,
+UNSIGNED_SHORT                 : 0x1403,
+INT                            : 0x1404,
+UNSIGNED_INT                   : 0x1405,
+FLOAT                          : 0x1406,
+    
+    /* PixelFormat */
+DEPTH_COMPONENT                : 0x1902,
+ALPHA                          : 0x1906,
+RGB                            : 0x1907,
+RGBA                           : 0x1908,
+LUMINANCE                      : 0x1909,
+LUMINANCE_ALPHA                : 0x190A,
+    
+    /* PixelType */
+    /*      UNSIGNED_BYTE */
+UNSIGNED_SHORT_4_4_4_4         : 0x8033,
+UNSIGNED_SHORT_5_5_5_1         : 0x8034,
+UNSIGNED_SHORT_5_6_5           : 0x8363,
+    
+    /* Shaders */
+FRAGMENT_SHADER                  : 0x8B30,
+VERTEX_SHADER                    : 0x8B31,
+MAX_VERTEX_ATTRIBS               : 0x8869,
+MAX_VERTEX_UNIFORM_VECTORS       : 0x8DFB,
+MAX_VARYING_VECTORS              : 0x8DFC,
+MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D,
+MAX_VERTEX_TEXTURE_IMAGE_UNITS   : 0x8B4C,
+MAX_TEXTURE_IMAGE_UNITS          : 0x8872,
+MAX_FRAGMENT_UNIFORM_VECTORS     : 0x8DFD,
+SHADER_TYPE                      : 0x8B4F,
+DELETE_STATUS                    : 0x8B80,
+LINK_STATUS                      : 0x8B82,
+VALIDATE_STATUS                  : 0x8B83,
+ATTACHED_SHADERS                 : 0x8B85,
+ACTIVE_UNIFORMS                  : 0x8B86,
+ACTIVE_ATTRIBUTES                : 0x8B89,
+SHADING_LANGUAGE_VERSION         : 0x8B8C,
+CURRENT_PROGRAM                  : 0x8B8D,
+    
+    /* StencilFunction */
+NEVER                          : 0x0200,
+LESS                           : 0x0201,
+EQUAL                          : 0x0202,
+LEQUAL                         : 0x0203,
+GREATER                        : 0x0204,
+NOTEQUAL                       : 0x0205,
+GEQUAL                         : 0x0206,
+ALWAYS                         : 0x0207,
+    
+    /* StencilOp */
+    /*      ZERO */
+KEEP                           : 0x1E00,
+REPLACE                        : 0x1E01,
+INCR                           : 0x1E02,
+DECR                           : 0x1E03,
+INVERT                         : 0x150A,
+INCR_WRAP                      : 0x8507,
+DECR_WRAP                      : 0x8508,
+    
+    /* StringName */
+VENDOR                         : 0x1F00,
+RENDERER                       : 0x1F01,
+VERSION                        : 0x1F02,
+    
+    /* TextureMagFilter */
+NEAREST                        : 0x2600,
+LINEAR                         : 0x2601,
+    
+    /* TextureMinFilter */
+    /*      NEAREST */
+    /*      LINEAR */
+NEAREST_MIPMAP_NEAREST         : 0x2700,
+LINEAR_MIPMAP_NEAREST          : 0x2701,
+NEAREST_MIPMAP_LINEAR          : 0x2702,
+LINEAR_MIPMAP_LINEAR           : 0x2703,
+    
+    /* TextureParameterName */
+TEXTURE_MAG_FILTER             : 0x2800,
+TEXTURE_MIN_FILTER             : 0x2801,
+TEXTURE_WRAP_S                 : 0x2802,
+TEXTURE_WRAP_T                 : 0x2803,
+    
+    /* TextureTarget */
+TEXTURE_2D                     : 0x0DE1,
+TEXTURE                        : 0x1702,
+    
+TEXTURE_CUBE_MAP               : 0x8513,
+TEXTURE_BINDING_CUBE_MAP       : 0x8514,
+TEXTURE_CUBE_MAP_POSITIVE_X    : 0x8515,
+TEXTURE_CUBE_MAP_NEGATIVE_X    : 0x8516,
+TEXTURE_CUBE_MAP_POSITIVE_Y    : 0x8517,
+TEXTURE_CUBE_MAP_NEGATIVE_Y    : 0x8518,
+TEXTURE_CUBE_MAP_POSITIVE_Z    : 0x8519,
+TEXTURE_CUBE_MAP_NEGATIVE_Z    : 0x851A,
+MAX_CUBE_MAP_TEXTURE_SIZE      : 0x851C,
+    
+    /* TextureUnit */
+TEXTURE0                       : 0x84C0,
+TEXTURE1                       : 0x84C1,
+TEXTURE2                       : 0x84C2,
+TEXTURE3                       : 0x84C3,
+TEXTURE4                       : 0x84C4,
+TEXTURE5                       : 0x84C5,
+TEXTURE6                       : 0x84C6,
+TEXTURE7                       : 0x84C7,
+TEXTURE8                       : 0x84C8,
+TEXTURE9                       : 0x84C9,
+TEXTURE10                      : 0x84CA,
+TEXTURE11                      : 0x84CB,
+TEXTURE12                      : 0x84CC,
+TEXTURE13                      : 0x84CD,
+TEXTURE14                      : 0x84CE,
+TEXTURE15                      : 0x84CF,
+TEXTURE16                      : 0x84D0,
+TEXTURE17                      : 0x84D1,
+TEXTURE18                      : 0x84D2,
+TEXTURE19                      : 0x84D3,
+TEXTURE20                      : 0x84D4,
+TEXTURE21                      : 0x84D5,
+TEXTURE22                      : 0x84D6,
+TEXTURE23                      : 0x84D7,
+TEXTURE24                      : 0x84D8,
+TEXTURE25                      : 0x84D9,
+TEXTURE26                      : 0x84DA,
+TEXTURE27                      : 0x84DB,
+TEXTURE28                      : 0x84DC,
+TEXTURE29                      : 0x84DD,
+TEXTURE30                      : 0x84DE,
+TEXTURE31                      : 0x84DF,
+ACTIVE_TEXTURE                 : 0x84E0,
+    
+    /* TextureWrapMode */
+REPEAT                         : 0x2901,
+CLAMP_TO_EDGE                  : 0x812F,
+MIRRORED_REPEAT                : 0x8370,
+    
+    /* Uniform Types */
+FLOAT_VEC2                     : 0x8B50,
+FLOAT_VEC3                     : 0x8B51,
+FLOAT_VEC4                     : 0x8B52,
+INT_VEC2                       : 0x8B53,
+INT_VEC3                       : 0x8B54,
+INT_VEC4                       : 0x8B55,
+BOOL                           : 0x8B56,
+BOOL_VEC2                      : 0x8B57,
+BOOL_VEC3                      : 0x8B58,
+BOOL_VEC4                      : 0x8B59,
+FLOAT_MAT2                     : 0x8B5A,
+FLOAT_MAT3                     : 0x8B5B,
+FLOAT_MAT4                     : 0x8B5C,
+SAMPLER_2D                     : 0x8B5E,
+SAMPLER_CUBE                   : 0x8B60,
+    
+    /* Vertex Arrays */
+VERTEX_ATTRIB_ARRAY_ENABLED        : 0x8622,
+VERTEX_ATTRIB_ARRAY_SIZE           : 0x8623,
+VERTEX_ATTRIB_ARRAY_STRIDE         : 0x8624,
+VERTEX_ATTRIB_ARRAY_TYPE           : 0x8625,
+VERTEX_ATTRIB_ARRAY_NORMALIZED     : 0x886A,
+VERTEX_ATTRIB_ARRAY_POINTER        : 0x8645,
+VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F,
+    
+    /* Shader Source */
+COMPILE_STATUS                 : 0x8B81,
+    
+    /* Shader Precision-Specified Types */
+LOW_FLOAT                      : 0x8DF0,
+MEDIUM_FLOAT                   : 0x8DF1,
+HIGH_FLOAT                     : 0x8DF2,
+LOW_INT                        : 0x8DF3,
+MEDIUM_INT                     : 0x8DF4,
+HIGH_INT                       : 0x8DF5,
+    
+    /* Framebuffer Object. */
+FRAMEBUFFER                    : 0x8D40,
+RENDERBUFFER                   : 0x8D41,
+    
+RGBA4                          : 0x8056,
+RGB5_A1                        : 0x8057,
+RGB565                         : 0x8D62,
+DEPTH_COMPONENT16              : 0x81A5,
+STENCIL_INDEX                  : 0x1901,
+STENCIL_INDEX8                 : 0x8D48,
+DEPTH_STENCIL                  : 0x84F9,
+    
+RENDERBUFFER_WIDTH             : 0x8D42,
+RENDERBUFFER_HEIGHT            : 0x8D43,
+RENDERBUFFER_INTERNAL_FORMAT   : 0x8D44,
+RENDERBUFFER_RED_SIZE          : 0x8D50,
+RENDERBUFFER_GREEN_SIZE        : 0x8D51,
+RENDERBUFFER_BLUE_SIZE         : 0x8D52,
+RENDERBUFFER_ALPHA_SIZE        : 0x8D53,
+RENDERBUFFER_DEPTH_SIZE        : 0x8D54,
+RENDERBUFFER_STENCIL_SIZE      : 0x8D55,
+    
+FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           : 0x8CD0,
+FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           : 0x8CD1,
+FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         : 0x8CD2,
+FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3,
+    
+COLOR_ATTACHMENT0              : 0x8CE0,
+DEPTH_ATTACHMENT               : 0x8D00,
+STENCIL_ATTACHMENT             : 0x8D20,
+DEPTH_STENCIL_ATTACHMENT       : 0x821A,
+    
+NONE                           : 0,
+    
+FRAMEBUFFER_COMPLETE                      : 0x8CD5,
+FRAMEBUFFER_INCOMPLETE_ATTACHMENT         : 0x8CD6,
+FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7,
+FRAMEBUFFER_INCOMPLETE_DIMENSIONS         : 0x8CD9,
+FRAMEBUFFER_UNSUPPORTED                   : 0x8CDD,
+  
+FRAMEBUFFER_BINDING            : 0x8CA6,
+RENDERBUFFER_BINDING           : 0x8CA7,
+MAX_RENDERBUFFER_SIZE          : 0x84E8,
+    
+INVALID_FRAMEBUFFER_OPERATION  : 0x0506,
+
+/* WebGL-specific enums */
+UNPACK_FLIP_Y_WEBGL                : 0x9240,
+UNPACK_PREMULTIPLY_ALPHA_WEBGL     : 0x9241,
+CONTEXT_LOST_WEBGL                 : 0x9242,
+UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243,
+BROWSER_DEFAULT_WEBGL              : 0x9244
+};
+
+// Constants removed from the WebGL spec compared to ES 2.0
+var removedConstants = {
+NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2,
+FIXED                          : 0x140C,
+ACTIVE_UNIFORM_MAX_LENGTH      : 0x8B87,
+ACTIVE_ATTRIBUTE_MAX_LENGTH    : 0x8B8A,
+EXTENSIONS                     : 0x1F03,
+INFO_LOG_LENGTH                : 0x8B84,
+SHADER_SOURCE_LENGTH           : 0x8B88,
+SHADER_COMPILER                : 0x8DFA,
+SHADER_BINARY_FORMATS          : 0x8DF8,
+NUM_SHADER_BINARY_FORMATS      : 0x8DF9,
+};
+
+function assertProperty(v, p) {
+  if (p in v) {
+    return true;
+  } else {
+    testFailed("Property does not exist: " + p)
+    return false;
+  }
+}
+
+function assertNoProperty(v, p) {
+  if (p in v) {
+    testFailed("Property is defined and should not be: " + p)
+    return false;
+  } else {
+    return true;
+  }
+}
+
+function assertMsg_(bool, msg) {
+  if (!bool) // show only failures to avoid spamming result list
+    assertMsg(bool, msg);
+  return bool;
+}
+
+debug("");
+debug("Canvas.getContext");
+
+var canvas = document.getElementById("canvas");
+var wtu = WebGLTestUtils;
+var gl = wtu.create3DContext(canvas);
+var passed = true;
+for (var i in constants) {
+  var r = assertProperty(gl, i) && assertMsg_(gl[i] == constants[i], "Property "+i+" value test "+gl[i]+" == "+constants[i]);
+  passed = passed && r;
+}
+if (passed) {
+  testPassed("All WebGL constants found to have correct values.");
+}
+passed = true;
+for (var i in removedConstants) {
+  var r = assertNoProperty(gl, i);
+  passed = passed && r;
+}
+if (passed) {
+  testPassed("All constants removed from WebGL spec were absent from WebGL context.");
+}
+var extended = false;
+for (var i in gl) {
+  if (i.match(/^[^a-z]/) && constants[i] == null) {
+    if (!extended) {
+      extended = true;
+      debug("Also found the following extra constants:");
+    }
+    debug(i);
+  }
+}
+
+debug("");
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-attributes-alpha-depth-stencil-antialias.html
new file mode 100644 (file)
index 0000000..3641e90
--- /dev/null
@@ -0,0 +1,343 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+<script id="vshader" type="x-shader/x-vertex">
+attribute vec3 pos;
+attribute vec4 colorIn;
+varying vec4 color;
+
+void main()
+{
+    color = colorIn;
+    gl_Position = vec4(pos.xyz, 1.0);
+}
+</script>
+
+<script id="fshader" type="x-shader/x-fragment">
+precision mediump float;
+
+varying vec4 color;
+
+void main()
+{
+    gl_FragColor = color;
+}
+</script>
+
+<script>
+"use strict";
+
+// These four declarations need to be global for "shouldBe" to see them
+var wtu = WebGLTestUtils;
+var gl;
+var contextAttribs = null;
+var pixel = [0, 0, 0, 1];
+var correctColor = null;
+var framebuffer;
+var fbHasColor;
+var fbHasDepth;
+var fbHasStencil;
+
+function init()
+{
+    initTestingHarnessWaitUntilDone();
+
+    description('Verify WebGLContextAttributes are working as specified, including alpha, depth, stencil, antialias, but not premultipliedAlpha');
+
+    runTest();
+}
+
+function getWebGL(canvasWidth, canvasHeight, contextAttribs, clearColor, clearDepth, clearStencil)
+{
+    var canvas = document.createElement("canvas");
+    if (!canvas)
+        return null;
+    canvas.width = canvasWidth;
+    canvas.height = canvasHeight;
+
+    gl = wtu.create3DContext(canvas, contextAttribs);
+    if (!gl)
+        return null;
+
+    var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["pos", "colorIn"]);
+    if (!program)
+        return null;
+
+    gl.enable(gl.DEPTH_TEST);
+    gl.enable(gl.STENCIL_TEST);
+
+    gl.clearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
+    gl.clearDepth(clearDepth);
+    gl.clearStencil(clearStencil);
+    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
+
+    framebuffer = gl.createFramebuffer();
+    gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+    var texture = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D, texture);
+    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.canvas.width, gl.canvas.height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
+    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
+    fbHasStencil = false;
+    fbHasDepth = false;
+    fbHasColor = gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE;
+    if (fbHasColor) {
+      var depthStencil = gl.createRenderbuffer();
+      gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencil);
+      gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, gl.canvas.width, gl.canvas.height);
+      gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencil);
+      fbHasDepth = gl.checkFramebufferStatus(gl.FRAMEBUFFER) == gl.FRAMEBUFFER_COMPLETE;
+      if (!fbHasDepth) {
+        gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, null);
+        shouldBe('gl.checkFramebufferStatus(gl.FRAMEBUFFER)', 'gl.FRAMEBUFFER_COMPLETE');
+      } else {
+        fbHasStencil = true;
+      }
+    }
+    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+    glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors");
+
+    return gl;
+}
+
+function drawAndReadPixel(gl, vertices, colors)
+{
+    var colorOffset = vertices.byteLength;
+
+    var vbo = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
+    gl.bufferData(gl.ARRAY_BUFFER, colorOffset + colors.byteLength, gl.STATIC_DRAW);
+    gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices);
+    gl.bufferSubData(gl.ARRAY_BUFFER, colorOffset, colors);
+
+    gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+    gl.enableVertexAttribArray(0);
+    gl.vertexAttribPointer(1, 4, gl.UNSIGNED_BYTE, true, 0, colorOffset);
+    gl.enableVertexAttribArray(1);
+
+    gl.drawArrays(gl.TRIANGLES, 0, vertices.length / 3);
+}
+
+function testAlpha(alpha)
+{
+    debug("Testing alpha = " + alpha);
+    if (alpha) {
+        shouldBeNonNull("gl = getWebGL(1, 1, { alpha: true, depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 0 ], 1, 0)");
+        shouldBeTrue("gl.getParameter(gl.ALPHA_BITS) >= 8");
+    } else {
+        shouldBeNonNull("gl = getWebGL(1, 1, { alpha: false, depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 0 ], 1, 0)");
+        shouldBeTrue("gl.getParameter(gl.ALPHA_BITS) == 0");
+    }
+    shouldBeTrue("gl.getParameter(gl.RED_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.GREEN_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.BLUE_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.DEPTH_BITS) == 0");
+    shouldBeTrue("gl.getParameter(gl.STENCIL_BITS) == 0");
+
+    shouldBeNonNull("contextAttribs = gl.getContextAttributes()");
+    shouldBeTrue("contextAttribs.alpha == " + alpha);
+
+    var correctColor = (contextAttribs.alpha ? [0, 0, 0, 0] : [0, 0, 0, 255]);
+    wtu.checkCanvasRect(gl, 0, 0, 1, 1, correctColor);
+
+    if (fbHasColor) {
+      gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+      gl.clearColor(0.5, 0.5, 0.5, 0.5);
+      gl.clear(gl.COLOR_BUFFER_BIT);
+      wtu.checkCanvasRect(gl, 0, 0, 1, 1, [127, 127, 127, 127], undefined, 1);
+      gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+    }
+}
+
+function testDepth(depth)
+{
+    debug("Testing depth = " + depth);
+    if (depth) {
+        shouldBeNonNull("gl = getWebGL(1, 1, { stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
+        shouldBeTrue("gl.getParameter(gl.DEPTH_BITS) >= 16");
+    } else {
+        shouldBeNonNull("gl = getWebGL(1, 1, { depth: false, stencil: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
+        shouldBeTrue("gl.getParameter(gl.DEPTH_BITS) == 0");
+    }
+    shouldBeTrue("gl.getParameter(gl.RED_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.GREEN_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.BLUE_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.ALPHA_BITS) >= 8");
+
+    shouldBeNonNull("contextAttribs = gl.getContextAttributes()");
+
+    gl.depthFunc(gl.NEVER);
+
+    var vertices = new Float32Array([
+         1.0,  1.0, 0.0,
+        -1.0,  1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0,  1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0, -1.0, 0.0]);
+    var colors = new Uint8Array([
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255]);
+
+    drawAndReadPixel(gl, vertices, colors, 0, 0);
+    correctColor = (contextAttribs.depth ? [0, 0, 0, 255] : [255, 0, 0, 255]);
+    wtu.checkCanvasRect(gl, 0, 0, 1, 1, correctColor);
+
+    if (fbHasDepth) {
+      gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+      gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+      drawAndReadPixel(gl, vertices, colors, 0, 0);
+      wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 0, 0, 255]);
+      gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+    }
+}
+
+function testStencilAndDepth(stencil, depth)
+{
+    debug("Testing stencil = " + stencil + ", depth = " + depth);
+    var creationString =
+        "gl = getWebGL(1, 1, { depth: " + depth + ", stencil: " + stencil + ", antialias: false }, [ 0, 0, 0, 1 ], 1, 0)";
+    shouldBeNonNull(creationString);
+
+    shouldBeTrue("gl.getParameter(gl.RED_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.GREEN_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.BLUE_BITS) >= 8");
+    shouldBeTrue("gl.getParameter(gl.ALPHA_BITS) >= 8");
+    if (depth)
+        shouldBeTrue("gl.getParameter(gl.DEPTH_BITS) >= 16");
+    else
+        shouldBeTrue("gl.getParameter(gl.DEPTH_BITS) == 0");
+
+    if (stencil)
+        shouldBeTrue("gl.getParameter(gl.STENCIL_BITS) >= 8");
+    else
+        shouldBeTrue("gl.getParameter(gl.STENCIL_BITS) == 0");
+
+    shouldBeNonNull("contextAttribs = gl.getContextAttributes()");
+    if (!depth && contextAttribs.depth) {
+        testFailed("WebGL implementation provided a depth buffer when it should not have");
+    }
+    if (!contextAttribs.depth)
+        depth = false;
+    if (!stencil && contextAttribs.stencil) {
+        testFailed("WebGL implementation provided a stencil buffer when it should not have");
+    }
+    if (!contextAttribs.stencil)
+        stencil = false;
+
+    gl.depthFunc(gl.ALWAYS);
+
+    gl.stencilFunc(gl.NEVER, 1, 1);
+    gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
+
+    var vertices = new Float32Array([
+         1.0, 1.0, 0.0,
+        -1.0, 1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0, 1.0, 0.0,
+        -1.0, -1.0, 0.0,
+         1.0, -1.0, 0.0]);
+    var colors = new Uint8Array([
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255]);
+
+    drawAndReadPixel(gl, vertices, colors, 0, 0);
+    correctColor = (stencil ? [0, 0, 0, 255] : [255, 0, 0, 255]);
+    wtu.checkCanvasRect(gl, 0, 0, 1, 1, correctColor)
+
+    if (fbHasStencil) {
+      gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+      gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+      drawAndReadPixel(gl, vertices, colors, 0, 0);
+      wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 0, 0, 255]);
+      gl.bindFramebuffer(gl.FRAMEBUFFER, null);
+    }
+}
+
+function testAntialias(antialias)
+{
+    debug("Testing antialias = " + antialias);
+    if (antialias)
+        shouldBeNonNull("gl = getWebGL(2, 2, { depth: false, stencil: false, alpha: false, antialias: true }, [ 0, 0, 0, 1 ], 1, 0)");
+    else
+        shouldBeNonNull("gl = getWebGL(2, 2, { depth: false, stencil: false, alpha: false, antialias: false }, [ 0, 0, 0, 1 ], 1, 0)");
+    shouldBeNonNull("contextAttribs = gl.getContextAttributes()");
+
+    var vertices = new Float32Array([
+         1.0, 1.0, 0.0,
+        -1.0, 1.0, 0.0,
+        -1.0, -1.0, 0.0]);
+    var colors = new Uint8Array([
+        255, 0, 0, 255,
+        255, 0, 0, 255,
+        255, 0, 0, 255]);
+    drawAndReadPixel(gl, vertices, colors, 0, 0);
+    var buf = new Uint8Array(1 * 1 * 4);
+    gl.readPixels(0, 0, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
+    pixel[0] = buf[0];
+    shouldBe("pixel[0] != 255 && pixel[0] != 0", "contextAttribs.antialias");
+}
+
+function runTest()
+{
+
+    testAlpha(true);
+    testAlpha(false);
+    testDepth(true);
+    testDepth(false);
+    testStencilAndDepth(true, false);
+    testStencilAndDepth(false, false);
+    testStencilAndDepth(true, true);
+    testStencilAndDepth(false, true);
+    testAntialias(true);
+    testAntialias(false);
+
+    finishTest();
+}
+
+</script>
+</head>
+<body onload="init()">
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost-restored.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost-restored.html
new file mode 100644 (file)
index 0000000..2815bd5
--- /dev/null
@@ -0,0 +1,239 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+var canvas;
+var gl;
+var shouldGenerateGLError;
+var extensionNames = [
+    "WEBKIT_WEBGL_lose_context",
+    "MOZ_WEBGL_lose_context",
+];
+var extension;
+var bufferObjects;
+var program;
+var texture;
+var texColor = [255, 10, 20, 255];
+var allowRestore;
+var contextLostEventFired;
+var contextRestoredEventFired;
+
+function init()
+{
+    initTestingHarnessWaitUntilDone();
+
+    description("Tests behavior under a restored context.");
+
+    shouldGenerateGLError = wtu.shouldGenerateGLError;
+    testLosingContext();
+}
+
+function setupTest()
+{
+    canvas = document.createElement("canvas");
+    canvas.width = 1;
+    canvas.height = 1;
+    gl = wtu.create3DContext(canvas);
+    for (var ii = 0; ii < extensionNames.length; ++ii) {
+        extension = gl.getExtension(extensionNames[ii]);
+        if (extension)
+            break;
+    }
+    if (!extension) {
+        debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
+        return false;
+    }
+    return true;
+}
+
+function testLosingContext()
+{
+    if (!setupTest())
+        finishTest();
+
+    debug("Test losing a context and inability to restore it.");
+
+    canvas.addEventListener("webglcontextlost", function(e) {
+       testLostContext(e);
+       // restore the context after this event has exited.
+       setTimeout(function() {
+         // we didn't call prevent default so we should not be able to restore the context
+         shouldGenerateGLError(gl, gl.INVALID_OPERATION, "extension.restoreContext()");
+         testLosingAndRestoringContext();
+       }, 0);
+    });
+    canvas.addEventListener("webglcontextrestored", testShouldNotRestoreContext);
+    allowRestore = false;
+    contextLostEventFired = false;
+    contextRestoredEventFired = false;
+
+    testOriginalContext();
+    extension.loseContext();
+    // The context should be lost immediately.
+    shouldBeTrue("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+    // gl methods should be no-ops
+    shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
+    // but the event should not have been fired.
+    shouldBeFalse("contextLostEventFired");
+}
+
+function testLosingAndRestoringContext()
+{
+    if (!setupTest())
+        finishTest();
+
+    debug("");
+    debug("Test losing and restoring a context.");
+
+    canvas.addEventListener("webglcontextlost", function(e) {
+      testLostContext(e);
+      // restore the context after this event has exited.
+      setTimeout(function() {
+        shouldGenerateGLError(gl, gl.NO_ERROR, "extension.restoreContext()");
+        // The context should still be lost. It will not get restored until the 
+        // webglrestorecontext event is fired.
+        shouldBeTrue("gl.isContextLost()");
+        shouldBe("gl.getError()", "gl.NO_ERROR");
+        // gl methods should still be no-ops
+        shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
+      }, 0);
+    });
+    canvas.addEventListener("webglcontextrestored", function() {
+      testRestoredContext();
+      finishTest();
+    });
+    allowRestore = true;
+    contextLostEventFired = false;
+    contextRestoredEventFired = false;
+
+    testOriginalContext();
+    extension.loseContext();
+    // The context should be lost immediately.
+    shouldBeTrue("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+    // gl methods should be no-ops
+    shouldGenerateGLError(gl, gl.NO_ERROR, "gl.blendFunc(gl.TEXTURE_2D, gl.TEXTURE_CUBE_MAP)");
+    // but the event should not have been fired.
+    shouldBeFalse("contextLostEventFired");
+}
+
+function testRendering()
+{
+    gl.clearColor(0, 0, 0, 255);
+    gl.colorMask(1, 1, 1, 0);
+    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
+    program = wtu.setupSimpleTextureProgram(gl);
+    bufferObjects = wtu.setupUnitQuad(gl);
+    texture = wtu.createColoredTexture(gl, canvas.width, canvas.height, texColor);
+
+    gl.uniform1i(gl.getUniformLocation(program, "tex"), 0);
+    wtu.drawQuad(gl, [0, 0, 0, 255]);
+
+    var compare = texColor.slice(0, 3);
+    wtu.checkCanvasRect(gl, 0, 0, canvas.width, canvas.height, compare, "shouldBe " + compare);
+
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+}
+
+function testOriginalContext()
+{
+    debug("Test valid context");
+    shouldBeFalse("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+    testRendering();
+    debug("");
+}
+
+function testLostContext(e)
+{
+    debug("Test lost context");
+    shouldBeFalse("contextLostEventFired");
+    contextLostEventFired = true;
+    shouldBeTrue("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+    debug("");
+    if (allowRestore)
+      e.preventDefault();
+}
+
+function testShouldNotRestoreContext(e)
+{
+    testFailed("Should not restore the context unless preventDefault is called on the context lost event");
+    debug("");
+}
+
+function testResources(expected)
+{
+    var tests = [
+        "gl.bindTexture(gl.TEXTURE_2D, texture)",
+        "gl.useProgram(program)",
+        "gl.bindBuffer(gl.ARRAY_BUFFER, bufferObjects[0])",
+    ];
+
+    for (var i = 0; i < tests.length; ++i)
+        shouldGenerateGLError(gl, expected, tests[i]);
+}
+
+function testRestoredContext()
+{
+    debug("Test restored context");
+    shouldBeFalse("contextRestoredEventFired");
+    contextRestoredEventFired = true;
+    shouldBeFalse("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+
+    // Validate that using old resources fails.
+    testResources(gl.INVALID_OPERATION);
+
+    testRendering();
+
+    // Validate new resources created in testRendering().
+    testResources(gl.NO_ERROR);
+    debug("");
+}
+
+
+</script>
+</head>
+<body onload="init()">
+<div id="description"></div>
+<div id="console"></div>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-lost.html
new file mode 100644 (file)
index 0000000..45fec99
--- /dev/null
@@ -0,0 +1,350 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+<script>
+"use strict";
+var wtu;
+var canvas;
+var gl;
+var shouldGenerateGLError;
+var extensionNames = [
+    "WEBKIT_WEBGL_lose_context",
+    "MOZ_WEBGL_lose_context",
+];
+var extensionName;
+var extension;
+
+var buffer;
+var framebuffer;
+var program;
+var renderbuffer;
+var shader;
+var texture;
+var uniformLocation;
+var arrayBuffer;
+var arrayBufferView
+var image;
+var video;
+var canvas2d;
+var ctx2d;
+var imageData;
+var float32array;
+var int32array;
+
+function init()
+{
+    wtu = WebGLTestUtils;
+    canvas = document.getElementById("canvas");
+    gl = wtu.create3DContext(canvas);
+    shouldGenerateGLError = wtu.shouldGenerateGLError;
+
+    description("Tests behavior under a lost context");
+
+    initTestingHarnessWaitUntilDone();
+
+    // call testValidContext() before checking for the extension, because this is where we check
+    // for the isContextLost() method, which we want to do regardless of the extension's presence.
+    testValidContext();
+
+    for (var ii = 0; ii < extensionNames.length; ++ii) {
+        extension = gl.getExtension(extensionNames[ii]);
+        if (extension) {
+            extensionName = extensionNames[ii];
+            break;
+        }
+    }
+    if (!extension) {
+        debug("Could not find lose_context extension under the following names: " + extensionNames.join(" "));
+        finishTest();
+        return false;
+    }
+
+    canvas.addEventListener("webglcontextlost", testLostContext, false);
+
+    loseContext();
+}
+
+function loseContext()
+{
+    debug("");
+    debug("Lose context");
+
+    // Note: this will cause the context to be lost, but the
+    // webglcontextlost event listener to be queued.
+    extension.loseContext();
+    debug("");
+}
+
+function testValidContext()
+{
+    debug("Test valid context");
+
+    shouldBeFalse("gl.isContextLost()");
+
+    arrayBuffer = new ArrayBuffer(4);
+    arrayBufferView = new Int8Array(arrayBuffer);
+
+    // Generate resources for testing.
+    buffer = gl.createBuffer();
+    gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
+    framebuffer = gl.createFramebuffer();
+    gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+    program = wtu.setupSimpleTextureProgram(gl);
+    renderbuffer = gl.createRenderbuffer();
+    gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer);
+    shader = gl.createShader(gl.VERTEX_SHADER);
+    texture = gl.createTexture();
+    gl.bindTexture(gl.TEXTURE_2D, texture);
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+
+    // Test is queries that will later be false
+    shouldGenerateGLError(gl, gl.NO_ERROR, "gl.enable(gl.BLEND)");
+    shouldBeTrue("gl.isBuffer(buffer)");
+    shouldBeTrue("gl.isEnabled(gl.BLEND)");
+    shouldBeTrue("gl.isFramebuffer(framebuffer)");
+    shouldBeTrue("gl.isProgram(program)");
+    shouldBeTrue("gl.isRenderbuffer(renderbuffer)");
+    shouldBeTrue("gl.isShader(shader)");
+    shouldBeTrue("gl.isTexture(texture)");
+}
+
+function testLostContext()
+{
+    debug("Test lost context");
+
+    // Functions with special return values.
+    shouldBeTrue("gl.isContextLost()");
+    shouldBe("gl.getError()", "gl.CONTEXT_LOST_WEBGL");
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+    shouldBe("gl.checkFramebufferStatus(gl.FRAMEBUFFER)", "gl.FRAMEBUFFER_UNSUPPORTED");
+    shouldBe("gl.getAttribLocation(program, 'u_modelViewProjMatrix')", "-1");
+    shouldBe("gl.getVertexAttribOffset(0, gl.VERTEX_ATTRIB_ARRAY_POINTER)", "0");
+
+    // Test the extension itself.
+    shouldGenerateGLError(gl, gl.INVALID_OPERATION, "extension.loseContext()");
+
+    image = document.createElement("img");
+    video = document.createElement("video");
+    canvas2d = document.createElement("canvas");
+    ctx2d = canvas2d.getContext("2d");
+    imageData = ctx2d.createImageData(1, 1);
+    float32array = new Float32Array(1);
+    int32array = new Int32Array(1);
+
+    // Functions returning void should return immediately.
+    // This is untestable, but we can at least be sure they cause no errors
+    // and the codepaths are exercised.
+    var voidTests = [
+        "gl.activeTexture(gl.TEXTURE0)",
+        "gl.attachShader(program, shader)",
+        "gl.bindBuffer(gl.ARRAY_BUFFER, buffer)",
+        "gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer)",
+        "gl.bindRenderbuffer(gl.RENDERBUFFER, renderbuffer)",
+        "gl.bindTexture(gl.TEXTURE_2D, texture)",
+        "gl.blendColor(1.0, 1.0, 1.0, 1.0)",
+        "gl.blendEquation(gl.FUNC_ADD)",
+        "gl.blendEquationSeparate(gl.FUNC_ADD, gl.FUNC_ADD)",
+        "gl.blendFunc(gl.ONE, gl.ONE)",
+        "gl.blendFuncSeparate(gl.ONE, gl.ONE, gl.ONE, gl.ONE)",
+        "gl.bufferData(gl.ARRAY_BUFFER, 0, gl.STATIC_DRAW)",
+        "gl.bufferData(gl.ARRAY_BUFFER, arrayBufferView, gl.STATIC_DRAW)",
+        "gl.bufferData(gl.ARRAY_BUFFER, arrayBuffer, gl.STATIC_DRAW)",
+        "gl.bufferSubData(gl.ARRAY_BUFFRE, 0, arrayBufferView)",
+        "gl.bufferSubData(gl.ARRAY_BUFFRE, 0, arrayBuffer)",
+        "gl.clear(gl.COLOR_BUFFER_BIT)",
+        "gl.clearColor(1, 1, 1, 1)",
+        "gl.clearDepth(1)",
+        "gl.clearStencil(0)",
+        "gl.colorMask(1, 1, 1, 1)",
+        "gl.compileShader(shader)",
+        "gl.copyTexImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 0, 0, 0)",
+        "gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, 0, 0)",
+        "gl.cullFace(gl.FRONT)",
+        "gl.deleteBuffer(buffer)",
+        "gl.deleteFramebuffer(framebuffer)",
+        "gl.deleteProgram(program)",
+        "gl.deleteRenderbuffer(renderbuffer)",
+        "gl.deleteShader(shader)",
+        "gl.deleteTexture(texture)",
+        "gl.depthFunc(gl.NEVER)",
+        "gl.depthMask(0)",
+        "gl.depthRange(0, 1)",
+        "gl.detachShader(program, shader)",
+        "gl.disable(gl.BLEND)",
+        "gl.disableVertexAttribArray(0)",
+        "gl.drawArrays(gl.POINTS, 0, 0)",
+        "gl.drawElements(gl.POINTS, 0, gl.UNSIGNED_SHORT, 0)",
+        "gl.enable(gl.BLEND)",
+        "gl.enableVertexAttribArray(0)",
+        "gl.finish()",
+        "gl.flush()",
+        "gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, renderbuffer)",
+        "gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0)",
+        "gl.frontFace(gl.CW)",
+        "gl.generateMipmap(gl.TEXTURE_2D)",
+        "gl.hint(gl.GENERATE_MIPMAP_HINT, gl.FASTEST)",
+        "gl.lineWidth(0)",
+        "gl.linkProgram(program)",
+        "gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 0)",
+        "gl.polygonOffset(0, 0)",
+        "gl.readPixels(0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, arrayBufferView)",
+        "gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 0, 0)",
+        "gl.sampleCoverage(0, 0)",
+        "gl.scissor(0, 0, 0, 0)",
+        "gl.shaderSource(shader, '')",
+        "gl.stencilFunc(gl.NEVER, 0, 0)",
+        "gl.stencilFuncSeparate(gl.FRONT, gl.NEVER, 0, 0)",
+        "gl.stencilMask(0)",
+        "gl.stencilMaskSeparate(gl.FRONT, 0)",
+        "gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP)",
+        "gl.stencilOpSeparate(gl.FRONT, gl.KEEP, gl.KEEP, gl.KEEP)",
+        "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, arrayBufferView)",
+        "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, imageData)",
+        "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image)",
+        "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas)",
+        "gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video)",
+        "gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)",
+        "gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)",
+        "gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, arrayBufferView)",
+        "gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, imageData)",
+        "gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, image)",
+        "gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, canvas)",
+        "gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, video)",
+        "gl.uniform1f(uniformLocation, 0)",
+        "gl.uniform1fv(uniformLocation, float32array)",
+        "gl.uniform1fv(uniformLocation, [0])",
+        "gl.uniform1i(uniformLocation, 0)",
+        "gl.uniform1iv(uniformLocation, int32array)",
+        "gl.uniform1iv(uniformLocation, [0])",
+        "gl.uniform2f(uniformLocation, 0, 0)",
+        "gl.uniform2fv(uniformLocation, float32array)",
+        "gl.uniform2fv(uniformLocation, [0, 0])",
+        "gl.uniform2i(uniformLocation, 0, 0)",
+        "gl.uniform2iv(uniformLocation, int32array)",
+        "gl.uniform2iv(uniformLocation, [0, 0])",
+        "gl.uniform3f(uniformLocation, 0, 0, 0)",
+        "gl.uniform3fv(uniformLocation, float32array)",
+        "gl.uniform3fv(uniformLocation, [0, 0, 0])",
+        "gl.uniform3i(uniformLocation, 0, 0, 0)",
+        "gl.uniform3iv(uniformLocation, int32array)",
+        "gl.uniform3iv(uniformLocation, [0, 0, 0])",
+        "gl.uniform4f(uniformLocation, 0, 0, 0, 0)",
+        "gl.uniform4fv(uniformLocation, float32array)",
+        "gl.uniform4fv(uniformLocation, [0, 0, 0, 0])",
+        "gl.uniform4i(uniformLocation, 0, 0, 0, 0)",
+        "gl.uniform4iv(uniformLocation, int32array)",
+        "gl.uniform4iv(uniformLocation, [0, 0, 0, 0])",
+        "gl.uniformMatrix2fv(uniformLocation, false, float32array)",
+        "gl.uniformMatrix2fv(uniformLocation, false, [0, 0, 0, 0])",
+        "gl.uniformMatrix3fv(uniformLocation, false, float32array)",
+        "gl.uniformMatrix3fv(uniformLocation, false, [0, 0, 0, 0, 0, 0, 0, 0, 0])",
+        "gl.uniformMatrix4fv(uniformLocation, false, float32array)",
+        "gl.uniformMatrix4fv(uniformLocation, false, [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])",
+        "gl.useProgram(program)",
+        "gl.validateProgram(program)",
+        "gl.vertexAttrib1f(0, 0)",
+        "gl.vertexAttrib1fv(0, float32array)",
+        "gl.vertexAttrib1fv(0, [0])",
+        "gl.vertexAttrib2f(0, 0, 0)",
+        "gl.vertexAttrib2fv(0, float32array)",
+        "gl.vertexAttrib2fv(0, [0, 0])",
+        "gl.vertexAttrib3f(0, 0, 0, 0)",
+        "gl.vertexAttrib3fv(0, float32array)",
+        "gl.vertexAttrib3fv(0, [0, 0, 0])",
+        "gl.vertexAttrib4f(0, 0, 0, 0, 0)",
+        "gl.vertexAttrib4fv(0, float32array)",
+        "gl.vertexAttrib4fv(0, [0, 0, 0, 0])",
+        "gl.vertexAttribPointer(0, 0, gl.FLOAT, false, 0, 0)",
+        "gl.viewport(0, 0, 0, 0)",
+    ];
+    for (var i = 0; i < voidTests.length; ++i) {
+        shouldGenerateGLError(gl, gl.NO_ERROR, voidTests[i]);
+    }
+
+    // Functions return nullable values should all return null.
+    var nullTests = [
+        "gl.createBuffer()",
+        "gl.createFramebuffer()",
+        "gl.createProgram()",
+        "gl.createRenderbuffer()",
+        "gl.createShader(gl.GL_VERTEX_SHADER)",
+        "gl.createTexture()",
+        "gl.getActiveAttrib(program, 0)",
+        "gl.getActiveUniform(program, 0)",
+        "gl.getAttachedShaders(program)",
+        "gl.getBufferParameter(gl.ARRAY_BUFFER, gl.BUFFER_SIZE)",
+        "gl.getContextAttributes()",
+        "gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME)",
+        "gl.getParameter(gl.CURRENT_PROGRAM)",
+        "gl.getProgramInfoLog(program)",
+        "gl.getProgramParameter(program, gl.LINK_STATUS)",
+        "gl.getRenderbufferParameter(gl.RENDERBUFFER, gl.RENDERBUFFER_WIDTH)",
+        "gl.getShaderInfoLog(shader)",
+        "gl.getShaderParameter(shader, gl.SHADER_TYPE)",
+        "gl.getShaderSource(shader)",
+        "gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S)",
+        "gl.getUniform(program, uniformLocation)",
+        "gl.getUniformLocation(program, 'vPosition')",
+        "gl.getVertexAttrib(0, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING)",
+        "gl.getSupportedExtensions()",
+        "gl.getExtension('" + extensionName + "')",
+    ];
+    for (var i = 0; i < nullTests.length; ++i) {
+        shouldBeNull(nullTests[i]);
+    }
+
+    // "Is" queries should all return false.
+    shouldBeFalse("gl.isBuffer(buffer)");
+    shouldBeFalse("gl.isEnabled(gl.BLEND)");
+    shouldBeFalse("gl.isFramebuffer(framebuffer)");
+    shouldBeFalse("gl.isProgram(program)");
+    shouldBeFalse("gl.isRenderbuffer(renderbuffer)");
+    shouldBeFalse("gl.isShader(shader)");
+    shouldBeFalse("gl.isTexture(texture)");
+
+    shouldBe("gl.getError()", "gl.NO_ERROR");
+
+    debug("");
+
+    finishTest();
+}
+
+</script>
+</head>
+<body onload="init()">
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas">
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-upon-reload.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-upon-reload.html
new file mode 100644 (file)
index 0000000..d9587e8
--- /dev/null
@@ -0,0 +1,92 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Context Release Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+</head>
+<body>
+<iframe id="host" style="width: 256px; height: 256px; border: 0;"></iframe>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("This test ensures that WebGL contexts are released properly upon page reload");
+
+var host = document.getElementById("host");
+var testIterations = 25;
+var currentIteration = 0;
+
+function refreshFrame() {
+  if(currentIteration < testIterations) {
+    currentIteration++;
+    debug("");
+    debug("Test " + currentIteration + " of " + testIterations);
+    host.src = "resources/context-release-upon-reload-child.html";
+  } else {
+    finishTest();
+  }
+}
+
+function testContext() {
+  var gl = host.contentWindow.glContext;
+  assertMsg(gl != null, "context was created properly");
+
+  glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
+
+  if(gl.canvas.width != gl.drawingBufferWidth ||
+    gl.canvas.height != gl.drawingBufferHeight) {
+    testFailed("Buffer was the wrong size: " +
+        gl.drawingBufferWidth + "x" + gl.drawingBufferHeight);
+  } else {
+    testPassed("Buffer was the correct size: " +
+        gl.drawingBufferWidth + "x" + gl.drawingBufferHeight);
+    refreshFrame();
+  }
+
+  gl = null;
+}
+
+window.addEventListener("message", function(event) {
+  if(event.data == "Ready") {
+    testContext();
+  }
+});
+
+refreshFrame();
+
+var successfullyParsed = true;
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-with-workers.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-release-with-workers.html
new file mode 100644 (file)
index 0000000..f2e3998
--- /dev/null
@@ -0,0 +1,92 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Context Release Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+</head>
+<body>
+<iframe id="host" style="width: 256px; height: 256px; border: 0;"></iframe>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("This test ensures that WebGL contexts are released properly when a worker is used");
+
+var host = document.getElementById("host");
+var testIterations = 25;
+var currentIteration = 0;
+
+function refreshFrame() {
+  if(currentIteration < testIterations) {
+    currentIteration++;
+    debug("");
+    debug("Test " + currentIteration + " of " + testIterations);
+    host.src = "resources/context-release-child-with-worker.html";
+  } else {
+    finishTest();
+  }
+}
+
+function testContext() {
+  var gl = host.contentWindow.glContext;
+  assertMsg(gl != null, "context was created properly");
+
+  glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors");
+
+  if(gl.canvas.width != gl.drawingBufferWidth ||
+    gl.canvas.height != gl.drawingBufferHeight) {
+    testFailed("Buffer was the wrong size: " +
+        gl.drawingBufferWidth + "x" + gl.drawingBufferHeight);
+  } else {
+    testPassed("Buffer was the correct size: " +
+        gl.drawingBufferWidth + "x" + gl.drawingBufferHeight);
+    refreshFrame();
+  }
+
+  gl = null;
+}
+
+window.addEventListener("message", function(event) {
+  if(event.data == "Ready") {
+    testContext();
+  }
+});
+
+refreshFrame();
+
+var successfullyParsed = true;
+</script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-type-test.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/context-type-test.html
new file mode 100644 (file)
index 0000000..53b26e9
--- /dev/null
@@ -0,0 +1,74 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Canvas Conformance Tests</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
+<canvas id="canvas2d" width="40" height="40"> </canvas>
+<script>
+"use strict";
+description("This test ensures WebGL implementations interact correctly with the canvas tag.");
+
+debug("");
+debug("Canvas.getContext");
+
+assertMsg(window.WebGLRenderingContext,
+          "WebGLRenderingContext should be a member of window");
+assertMsg('WebGLRenderingContext' in window,
+          "WebGLRenderingContext should be 'in' window");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = wtu.create3DContext(canvas);
+if (!gl) {
+  testFailed("context does not exist");
+} else {
+  testPassed("context exists");
+
+  debug("Checking context type");
+  assertMsg(gl instanceof WebGLRenderingContext,
+            "context type should be WebGLRenderingContext");
+}
+debug("");
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/incorrect-context-object-behaviour.html
new file mode 100644 (file)
index 0000000..1ea6830
--- /dev/null
@@ -0,0 +1,89 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script>
+"use strict";
+description("Tests calling WebGL APIs with objects from other contexts");
+
+var wtu = WebGLTestUtils;
+var contextA = wtu.create3DContext();
+var contextB = wtu.create3DContext();
+var programA = wtu.loadStandardProgram(contextA);
+var programB = wtu.loadStandardProgram(contextB);
+var shaderA = wtu.loadStandardVertexShader(contextA);
+var shaderB = wtu.loadStandardVertexShader(contextB);
+var textureA = contextA.createTexture();
+var textureB = contextB.createTexture();
+var frameBufferA = contextA.createFramebuffer();
+var frameBufferB = contextB.createFramebuffer();
+var renderBufferA = contextA.createRenderbuffer();
+var renderBufferB = contextB.createRenderbuffer();
+var locationA = contextA.getUniformLocation(programA, 'u_modelViewProjMatrix');
+var locationB = contextB.getUniformLocation(programB, 'u_modelViewProjMatrix');
+
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.compileShader(shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.linkProgram(programB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShader(programA, shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShader(programB, shaderA)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.attachShader(programB, shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShader(programA, shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShader(programB, shaderA)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.detachShader(programB, shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.shaderSource(shaderB, 'foo')");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindAttribLocation(programB, 0, 'foo')");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindFramebuffer(contextA.FRAMEBUFFER, frameBufferB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindRenderbuffer(contextA.RENDERBUFFER, renderBufferB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.bindTexture(contextA.TEXTURE_2D, textureB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.framebufferRenderbuffer(contextA.FRAMEBUFFER, contextA.DEPTH_ATTACHMENT, contextA.RENDERBUFFER, renderBufferB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.framebufferTexture2D(contextA.FRAMEBUFFER, contextA.COLOR_ATTACHMENT0, contextA.TEXTURE_2D, textureB, 0)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getProgramParameter(programB, 0)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getProgramInfoLog(programB, 0)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderParameter(shaderB, 0)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderInfoLog(shaderB, 0)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getShaderSource(shaderB)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform(programB, locationA)");
+shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniformLocation(programB, 'u_modelViewProjMatrix')");
+
+var successfullyParsed = true;
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/methods.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/methods.html
new file mode 100644 (file)
index 0000000..f30a8c8
--- /dev/null
@@ -0,0 +1,224 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>WebGL Methods Test</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"></script>
+<script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
+<script>
+"use strict";
+description("This test ensures that the WebGL context has all the methods in the specification.");
+
+var methods = [
+"canvas",
+"getContextAttributes",
+"activeTexture",
+"attachShader",
+"bindAttribLocation",
+"bindBuffer",
+"bindFramebuffer",
+"bindRenderbuffer",
+"bindTexture",
+"blendColor",
+"blendEquation",
+"blendEquationSeparate",
+"blendFunc",
+"blendFuncSeparate",
+"bufferData",
+"bufferSubData",
+"checkFramebufferStatus",
+"clear",
+"clearColor",
+"clearDepth",
+"clearStencil",
+"colorMask",
+"compileShader",
+"copyTexImage2D",
+"copyTexSubImage2D",
+"createBuffer",
+"createFramebuffer",
+"createProgram",
+"createRenderbuffer",
+"createShader",
+"createTexture",
+"cullFace",
+"deleteBuffer",
+"deleteFramebuffer",
+"deleteProgram",
+"deleteRenderbuffer",
+"deleteShader",
+"deleteTexture",
+"depthFunc",
+"depthMask",
+"depthRange",
+"detachShader",
+"disable",
+"disableVertexAttribArray",
+"drawArrays",
+"drawElements",
+"enable",
+"enableVertexAttribArray",
+"finish",
+"flush",
+"framebufferRenderbuffer",
+"framebufferTexture2D",
+"frontFace",
+"generateMipmap",
+"getActiveAttrib",
+"getActiveUniform",
+"getAttachedShaders",
+"getAttribLocation",
+"getParameter",
+"getBufferParameter",
+"getError",
+"getFramebufferAttachmentParameter",
+"getProgramParameter",
+"getProgramInfoLog",
+"getRenderbufferParameter",
+"getShaderParameter",
+"getShaderInfoLog",
+"getShaderSource",
+"getTexParameter",
+"getUniform",
+"getUniformLocation",
+"getVertexAttrib",
+"getVertexAttribOffset",
+"hint",
+"isBuffer",
+"isEnabled",
+"isFramebuffer",
+"isProgram",
+"isRenderbuffer",
+"isShader",
+"isTexture",
+"lineWidth",
+"linkProgram",
+"pixelStorei",
+"polygonOffset",
+"readPixels",
+"renderbufferStorage",
+"sampleCoverage",
+"scissor",
+"shaderSource",
+"stencilFunc",
+"stencilFuncSeparate",
+"stencilMask",
+"stencilMaskSeparate",
+"stencilOp",
+"stencilOpSeparate",
+"texImage2D",
+"texParameterf",
+"texParameteri",
+"texSubImage2D",
+"uniform1f",
+"uniform1fv",
+"uniform1i",
+"uniform1iv",
+"uniform2f",
+"uniform2fv",
+"uniform2i",
+"uniform2iv",
+"uniform3f",
+"uniform3fv",
+"uniform3i",
+"uniform3iv",
+"uniform4f",
+"uniform4fv",
+"uniform4i",
+"uniform4iv",
+"uniformMatrix2fv",
+"uniformMatrix3fv",
+"uniformMatrix4fv",
+"useProgram",
+"validateProgram",
+"vertexAttrib1f",
+"vertexAttrib1fv",
+"vertexAttrib2f",
+"vertexAttrib2fv",
+"vertexAttrib3f",
+"vertexAttrib3fv",
+"vertexAttrib4f",
+"vertexAttrib4fv",
+"vertexAttribPointer",
+"viewport"
+]
+
+function assertProperty(v, p) {
+  try {
+    if (v[p] == null) {
+      testFailed("Property does not exist: " + p)
+      return false;
+    } else {
+      return true;
+    }
+  } catch(e) {
+    testFailed("Trying to access the property '"+p+"' threw an error: "+e.toString());
+  }
+}
+
+debug("");
+debug("Canvas.getContext");
+
+var wtu = WebGLTestUtils;
+var canvas = document.getElementById("canvas");
+var gl = wtu.create3DContext(canvas);
+var passed = true;
+for (var i=0; i<methods.length; i++) {
+  var r = assertProperty(gl, methods[i]);
+  passed = passed && r;
+}
+if (passed) {
+  testPassed("All WebGL methods found.");
+}
+var extended = false;
+for (var i in gl) {
+  if (i.match(/^[a-z]/) && methods.indexOf(i) == -1) {
+    if (!extended) {
+      extended = true;
+      debug("Also found the following extra methods:");
+    }
+    debug(i);
+  }
+}
+
+debug("");
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/premultiplyalpha-test.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/premultiplyalpha-test.html
new file mode 100644 (file)
index 0000000..794a5a9
--- /dev/null
@@ -0,0 +1,192 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Test the WebGL premultipledAlpha context creation flag.</title>
+<link rel="stylesheet" href="../../resources/js-test-style.css"/>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/webgl-test.js"> </script>
+<script src="../resources/webgl-test-utils.js"> </script>
+</head>
+<body>
+<div id="description"></div><div id="console"></div>
+<script>
+"use strict";
+var wtu = WebGLTestUtils;
+
+var tests = [
+  // If premultipledAlpha is true then
+  // [texture]           [canvas]             [dataURL]
+  // 32, 64, 128, 128 -> 64, 128, 255, 128 -> 64, 128, 255, 128
+  { creationAttributes: {},
+    sentColor: [32, 64, 128, 128],
+    expectedColor: [64, 128, 255, 128],
+    errorRange: 2,
+    imageFormat: "image/png"
+  },
+  // If premultipledAlpha is true then
+  // [texture]           [canvas]             [texture]
+  // 32, 64, 128, 128 -> 64, 128, 255, 128 -> 64, 128, 255, 128
+  { creationAttributes: {},
+    sentColor: [32, 64, 128, 128],
+    expectedColor: [64, 128, 255, 128],
+    errorRange: 2,
+  },
+  // If premultipledAlpha is false then
+  // [texture]           [canvas]            [dataURL]
+  // 255, 192, 128, 1 -> 255, 192, 128, 1 -> 255, 192, 128, 1
+  { creationAttributes: {premultipliedAlpha: false},
+    sentColor: [255, 192, 128, 1],
+    expectedColor: [255, 192, 128, 1],
+    errorRange: 0,
+    imageFormat: "image/png"
+  },
+  // If premultipledAlpha is false then
+  // [texture]           [canvas]            [texture]
+  // 255, 192, 128, 1 -> 255, 192, 128, 1 -> 255, 192, 128, 1
+  { creationAttributes: {premultipliedAlpha: false},
+    sentColor: [255, 192, 128, 1],
+    expectedColor: [255, 192, 128, 1],
+    errorRange: 0,
+  },
+  // If premultipledAlpha is false then
+  // [texture]             [canvas]            [dataURL]
+  // 255, 255, 255, 128 -> 255, 255, 255, 128 -> 128, 128, 128, 255
+  { creationAttributes: {premultipliedAlpha: false},
+    sentColor: [255, 255, 255, 128],
+    expectedColor: [128, 128, 128, 255],
+    errorRange: 2,
+    imageFormat: "image/jpeg"
+  },
+  // If premultipledAlpha is true then
+  // [texture]             [canvas]            [dataURL]
+  // 128, 128, 128, 128 -> 255, 255, 255, 128 -> 128, 128, 128, 255
+  { creationAttributes: {},
+    sentColor: [128, 128, 128, 128],
+    expectedColor: [128, 128, 128, 255],
+    errorRange: 2,
+    imageFormat: "image/jpeg"
+  }
+];
+
+var g_count = 0;
+var gl;
+var canvas;
+var premultipledAlpha;
+
+description("Test the WebGL premultipledAlpha context creation flag.");
+doNextTest();
+function doNextTest() {
+  if (g_count < tests.length) {
+     var test = tests[g_count++];
+     canvas = document.createElement("canvas");
+     // Need to preserve drawing buffer to load it in a callback
+     test.creationAttributes.preserveDrawingBuffer = true;
+     gl = wtu.create3DContext(canvas, test.creationAttributes);
+     var premultipliedAlpha = test.creationAttributes.premultipliedAlpha != false;
+     debug("")
+     debug("testing: premultipliedAlpha: " + premultipliedAlpha + " imageFormat: " + test.imageFormat);
+
+     shouldBe('gl.getContextAttributes().premultipledAlpha', 'premultipledAlpha');
+     shouldBeTrue('gl.getContextAttributes().preserveDrawingBuffer');
+
+     wtu.log(gl.getContextAttributes());
+     var program = wtu.setupTexturedQuad(gl);
+
+     glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
+     var tex = gl.createTexture();
+     wtu.fillTexture(gl, tex, 2, 2, test.sentColor, 0);
+     var loc = gl.getUniformLocation(program, "tex");
+     gl.uniform1i(loc, 0);
+     gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+     gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+     gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+     gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+
+     wtu.drawQuad(gl);
+     glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from drawing.");
+
+     var loadTexture = function() {
+       var pngTex = gl.createTexture();
+       // not needed as it's the default
+       // gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
+       gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, false);
+       gl.bindTexture(gl.TEXTURE_2D, pngTex);
+       if (test.imageFormat) {
+          // create texture from image
+          gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this);
+       } else {
+          // create texture from canvas
+          gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);
+       }
+       gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
+       gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
+       gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
+       gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
+       glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from creating copy.");
+       wtu.drawQuad(gl);
+       glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from 2nd drawing.");
+       wtu.checkCanvas(
+          gl, test.expectedColor,
+          "should draw with " + test.expectedColor, test.errorRange);
+
+       doNextTest();
+     }
+
+     if (test.imageFormat) {
+        // Load canvas into string using toDataURL
+        var imageUrl = canvas.toDataURL(test.imageFormat);
+        if (test.imageFormat != "image/png" &&
+            (imageUrl.indexOf("data:image/png,") == 0 ||
+             imageUrl.indexOf("data:image/png;") == 0)) {
+          debug("Image format " + test.imageFormat + " not supported; skipping");
+          setTimeout(doNextTest, 0);
+        } else {
+          // Load string into the texture
+          var input = document.createElement("img");
+          input.onload = loadTexture;
+          input.src = imageUrl;
+        }
+     } else {
+        // Load canvas into the texture asynchronously (to prevent unbounded stack consumption)
+        setTimeout(loadTexture, 0);
+     }
+   } else {
+      var successfullyParsed = true;
+      finishTest();
+   }
+}
+
+</script>
+
+</body>
+</html>
+
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resource-sharing-test.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resource-sharing-test.html
new file mode 100644 (file)
index 0000000..33d7543
--- /dev/null
@@ -0,0 +1,65 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html>
+  <head>
+<meta charset="utf-8">
+    <title>WebGL Resource Sharing.</title>
+    <link rel="stylesheet" href="../../resources/js-test-style.css"/>
+    <script src="../../resources/js-test-pre.js"></script>
+    <script src="../resources/webgl-test.js"> </script>
+    <script src="../resources/webgl-test-utils.js"></script>
+</head>
+<body>
+<canvas id="example1" width="2" height="2" style="width: 40px; height: 40px;"></canvas>
+<canvas id="example2" width="2" height="2" style="width: 40px; height: 40px;"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<script>
+"use strict";
+description("Tests that resources can not be shared.");
+debug("");
+
+var wtu = WebGLTestUtils;
+var gl1 = wtu.create3DContext("example1");
+var gl2 = wtu.create3DContext("example2");
+assertMsg(gl1 && gl2,
+          "Got 3d context.");
+
+var vertexObject = gl1.createBuffer();
+gl2.bindBuffer(gl2.ARRAY_BUFFER, vertexObject);
+assertMsg(
+  gl2.getError() == gl2.INVALID_OPERATION,
+  "attempt to use a resource from the wrong context should fail with INVALID_OPERATION");
+
+var successfullyParsed = true;
+</script>
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
+
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-child-with-worker.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-child-with-worker.html
new file mode 100644 (file)
index 0000000..fe71e72
--- /dev/null
@@ -0,0 +1,78 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html style="margin: 0; padding: 0;">
+  <head>
+<meta charset="utf-8">
+    <title>Simple WebGL context with Worker</title>
+    <script src="../../resources/webgl-test-utils.js"> </script>
+</head>
+<body style="margin: 0; padding: 0; overflow: hidden;">
+    <canvas id="c"
+        width="1680" height="1050"
+        style="width: 256px; height: 256px;"> <!-- scaled to fit page better -->
+    <script id="vshader" type="x-shader/x-vertex">
+        attribute vec4 vPosition;
+        void main()
+        {
+            gl_Position = vPosition;
+        }
+    </script>
+
+    <script id="fshader" type="x-shader/x-fragment">
+        void main()
+        {
+            gl_FragColor = vec4(1.0,0.0,0.0,1.0);
+        }
+    </script>
+
+    <script>
+        "use strict";
+        var wtu = WebGLTestUtils;
+        var myWorker = new Worker("context-release-worker.js");
+
+        var gl = wtu.create3DContext("c", {"antialiased": false});
+        var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
+
+        var vertexObject = gl.createBuffer();
+        gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.75,0, -0.75,-0.75,0, 0.75,-0.75,0 ]), gl.STATIC_DRAW);
+        gl.enableVertexAttribArray(0);
+        gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+        gl.clearColor(0.0, 0.0, 0.0, 1.0);
+        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+        gl.drawArrays(gl.TRIANGLES, 0, 3);
+
+        if(parent) {
+            window.glContext = gl;
+            parent.postMessage("Ready", "*");
+        }
+    </script>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-upon-reload-child.html b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-upon-reload-child.html
new file mode 100644 (file)
index 0000000..c2c758c
--- /dev/null
@@ -0,0 +1,77 @@
+<!--
+
+/*
+** Copyright (c) 2012 The Khronos Group Inc.
+**
+** Permission is hereby granted, free of charge, to any person obtaining a
+** copy of this software and/or associated documentation files (the
+** "Materials"), to deal in the Materials without restriction, including
+** without limitation the rights to use, copy, modify, merge, publish,
+** distribute, sublicense, and/or sell copies of the Materials, and to
+** permit persons to whom the Materials are furnished to do so, subject to
+** the following conditions:
+**
+** The above copyright notice and this permission notice shall be included
+** in all copies or substantial portions of the Materials.
+**
+** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+*/
+
+-->
+
+<!DOCTYPE html>
+<html style="margin: 0; padding: 0;">
+  <head>
+<meta charset="utf-8">
+    <title>Simple WebGL context</title>
+    <script src="../../resources/webgl-test-utils.js"> </script>
+</head>
+<body style="margin: 0; padding: 0; overflow: hidden;">
+    <canvas id="c"
+        width="1680" height="1050"
+        style="width: 256px; height: 256px;"> <!-- scaled to fit page better -->
+    <script id="vshader" type="x-shader/x-vertex">
+        attribute vec4 vPosition;
+        void main()
+        {
+            gl_Position = vPosition;
+        }
+    </script>
+
+    <script id="fshader" type="x-shader/x-fragment">
+        void main()
+        {
+            gl_FragColor = vec4(1.0,0.0,0.0,1.0);
+        }
+    </script>
+
+    <script>
+        "use strict";
+        var wtu = WebGLTestUtils;
+
+        var gl = wtu.create3DContext("c", {"antialiased": false});
+        var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["vPosition"]);
+
+        var vertexObject = gl.createBuffer();
+        gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.75,0, -0.75,-0.75,0, 0.75,-0.75,0 ]), gl.STATIC_DRAW);
+        gl.enableVertexAttribArray(0);
+        gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
+
+        gl.clearColor(0.0, 0.0, 0.0, 1.0);
+        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+        gl.drawArrays(gl.TRIANGLES, 0, 3);
+
+        if (parent) {
+            window.glContext = gl;
+            parent.postMessage("Ready", "*");
+        }
+    </script>
+</body>
+</html>
diff --git a/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-worker.js b/LayoutTests/webgl/resources/webgl_test_files/conformance/context/resources/context-release-worker.js
new file mode 100644 (file)
index 0000000..3680117
--- /dev/null
@@ -0,0 +1,4 @@
+// Simple worker used to provoke WebGL context release bugs on Chrome
+
+postMessage("Hello World");
+close();
\ No newline at end of file