Index: content/test/data/gpu/webgl.html |
diff --git a/content/test/data/gpu/webgl.html b/content/test/data/gpu/webgl.html |
index 001c569a0f457b979187f97d3bfab811261d58d1..fc444d94ab9078a9714993b8f1fe6dacf3cf72b7 100644 |
--- a/content/test/data/gpu/webgl.html |
+++ b/content/test/data/gpu/webgl.html |
@@ -59,6 +59,35 @@ function testContextRestored() { |
window.domAutomationController.send("FAILED"); |
} |
+function testQuantityLoss() { |
+ var count = 0; |
+ var iterations = 128; |
+ |
+ function createAndDiscardContext() { |
+ count++; |
+ |
+ var c = document.createElement("canvas"); |
+ c.width = 1; |
+ c.height = 1; |
+ |
+ var ctx = c.getContext("experimental-webgl"); |
+ if (!ctx) { |
+ return false; |
+ } |
+ ctx.clear(gl.COLOR_BUFFER_BIT); |
+ |
+ if (count < iterations) { |
+ window.requestAnimationFrame(createAndDiscardContext); |
+ } else { |
+ window.domAutomationController.setAutomationId(1); |
+ alreadySetAutomationId = true; |
+ window.domAutomationController.send("LOADED"); |
+ } |
+ }; |
+ |
+ createAndDiscardContext(); |
+} |
+ |
function contextLostTest(kind) |
{ |
switch (kind) { |
@@ -79,6 +108,12 @@ function contextLostTest(kind) |
alreadySetAutomationId = true; |
window.domAutomationController.send("LOADED"); |
break; |
+ case "forced_quantity_loss": |
+ // Test creates many new contexts, forcing the original context to be |
+ // lost. Then a garbage collect is triggered and the original context is |
+ // watched to ensure it restores properly. |
+ testQuantityLoss(); |
+ break; |
} |
} |