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

Unified Diff: LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html

Issue 251023004: WebGL: Free temporary GPU resources held by inactive or hidden WebGL. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add a layout test Created 6 years, 5 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
Index: LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
diff --git a/LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html b/LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
similarity index 80%
copy from LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html
copy to LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
index 13d07d02efd3ac8a80ce386ca20f5d0ac19ea317..47acbf442dfa44db21b2a67ec181d931dbe779d2 100644
--- a/LayoutTests/fast/canvas/webgl/webgl-composite-modes-repaint.html
+++ b/LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching.html
@@ -2,7 +2,7 @@
<body onload="runRepaintTest()">
<span id="description" style="color: white">
This test is only useful as a pixel test. You should see two rows with 4 canvases in each. The top row of canvases should have a black background, the bottom row should have a dark blue background.
-The canvases in the first two rows should have a single triangle. The canvases on the left should have two triangles superimposed on top of each other.
+The canvases in the first two rows should have a single triangle. The canvases on the left should have three triangles superimposed on top of each other.
If multisampling is supported, the odd columns should have smooth edges instead of jagged stair-stepping.
</span>
<br>
@@ -113,21 +113,41 @@ function drawAll(offset) {
draw(ctxs[i], offset);
}
-drawAll(0);
-
-function repaintTest() {
- drawAll(50);
+function repaintOnVisiblePage() {
+ // Check if WebGL draws this frame correctly, because WebGL implementation
+ // clears temporary cache when page is hidden.
+ drawAll(60);
if (window.testRunner) {
testRunner.notifyDone();
}
}
+function SetPageVisible() {
Ken Russell (switch to Gerrit) 2014/07/08 23:18:24 Please use consistent capitalization: setPageVisib
+ if (window.testRunner) {
+ testRunner.setPageVisibility("visible");
+ testRunner.displayAsyncThen(repaintOnVisiblePage);
+ } else {
+ setTimeout(repaintOnVisiblePage, 50);
+ }
+}
+
+function repaintOnHiddenPage() {
+ if (window.testRunner) {
+ testRunner.setPageVisibility("hidden");
+ }
+ // Although page is hidden, WebGL must draw this frame.
+ drawAll(30);
+ // testRunner.displayAsyncThen doesn't work when page is hidden.
+ setTimeout(SetPageVisible, 50);
+}
+
function runRepaintTest() {
+ drawAll(0);
if (window.testRunner) {
testRunner.waitUntilDone();
- testRunner.displayAsyncThen(repaintTest);
+ testRunner.displayAsyncThen(repaintOnHiddenPage);
} else {
- setTimeout(repaintTest, 100);
+ setTimeout(repaintOnHiddenPage, 50);
}
}
</script>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/canvas/webgl/webgl-composite-modes-tabswitching-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698