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

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

Issue 251443006: Adding test to ensure context restoration due to GC doesn't crash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/context_lost.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
« no previous file with comments | « no previous file | content/test/gpu/gpu_tests/context_lost.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698