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

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

Issue 188073002: Added pixel test that ensures WebGL content can render properly after a context loss and restore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/page_sets/pixel_tests.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/gpu/pixel_webgl_context_restore.html
diff --git a/content/test/data/gpu/pixel_webgl.html b/content/test/data/gpu/pixel_webgl_context_restore.html
similarity index 81%
copy from content/test/data/gpu/pixel_webgl.html
copy to content/test/data/gpu/pixel_webgl_context_restore.html
index b82fa81e55d69c4afd1618aacc43fd0316e6274c..0bb4ed641bb55bc2450824b7ea878d5f96d6fc62 100644
--- a/content/test/data/gpu/pixel_webgl.html
+++ b/content/test/data/gpu/pixel_webgl_context_restore.html
@@ -8,7 +8,7 @@ that the baseline images are regenerated on the next run.
<html>
<head>
-<title>WebGL Test: Green Triangle over Black Background</title>
+<title>WebGL Test: Yellow Triangle over Black Background with context loss and restore</title>
<style type="text/css">
.nomargin {
margin: 0px auto;
@@ -27,20 +27,39 @@ void main(void)
precision mediump float;
void main(void)
{
- gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
+ gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
</script>
<script>
var g_swapsBeforeAck = 15;
var gl;
+var lose_context_ext;
function main()
{
var canvas = document.getElementById("c");
gl = initGL(canvas);
+
+ canvas.addEventListener("webglcontextlost", function(ev) {
+ ev.preventDefault();
+ }, false);
+ canvas.addEventListener("webglcontextrestored", function(ev) {
+ if (setup(gl)) {
+ drawSomeFrames();
+ } else {
+ domAutomationController.setAutomationId(1);
+ domAutomationController.send("FAILURE");
+ }
+ }, false);
+
if (gl && setup(gl)) {
- drawSomeFrames();
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+
+ lose_context_ext.loseContext();
+ setTimeout(function() {
+ lose_context_ext.restoreContext();
+ }, 3000);
} else {
domAutomationController.setAutomationId(1);
domAutomationController.send("FAILURE");
@@ -77,6 +96,9 @@ function setupShader(gl, source, type) {
var shader = gl.createShader(type);
gl.shaderSource(shader, source);
gl.compileShader(shader);
+ lose_context_ext = gl.getExtension("WEBGL_lose_context");
+ if (!lose_context_ext)
+ return null;
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS))
return null;
return shader;
« no previous file with comments | « no previous file | content/test/gpu/page_sets/pixel_tests.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698