Commit 4256304e authored by enne@chromium.org's avatar enne@chromium.org

Convert some repaint tests to not call display()

BUG=345027

Review URL: https://codereview.chromium.org/196353013

git-svn-id: svn://svn.chromium.org/blink/trunk@169508 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 6dda82f2
......@@ -875,6 +875,22 @@ crbug.com/339778 [ Debug ] fast/dom/timer-throttling-hidden-page.html [ Failure
crbug.com/347365 [ Linux ] dom/xhtml/level3/core/canonicalform08.xhtml [ Crash Pass ]
crbug.com/347365 [ Linux ] dom/xhtml/level3/core/canonicalform09.xhtml [ Crash Pass ]
crbug.com/345027 compositing/webgl/webgl-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 virtual/threaded/compositing/webgl/webgl-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 css3/flexbox/repaint-column-reverse.html [ NeedsRebaseline Failure ]
crbug.com/345027 css3/flexbox/repaint-during-resize-no-flex.html [ NeedsRebaseline Failure ]
crbug.com/345027 css3/flexbox/repaint-rtl-column.html [ NeedsRebaseline Failure ]
crbug.com/345027 css3/flexbox/repaint.html [ NeedsRebaseline Failure ]
crbug.com/345027 fast/canvas/canvas-as-image-incremental-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 virtual/gpu/fast/canvas/canvas-as-image-incremental-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 fast/canvas/canvas-composite-fill-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 fast/canvas/canvas-incremental-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 fast/canvas/canvas-incremental-repaint-2.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 fast/canvas/canvas-resize-after-paint-without-layout.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 fast/canvas/setWidthResetAfterForcedRender.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 media/audio-repaint.html [ NeedsRebaseline ImageOnlyFailure ]
crbug.com/345027 media/media-document-audio-repaint.html [ NeedsRebaseline Failure ]
# Flaky since being added
crbug.com/340277 http/tests/navigation/back-to-get-after-post.php [ Failure Pass ]
......
......@@ -12,6 +12,7 @@ canvas {
border: 1px solid black;
}
</style>
<script src="../../resources/run-after-display.js"></script>
<script>
if (window.testRunner)
testRunner.overridePreference("WebKitWebGLEnabled", "1");
......@@ -37,11 +38,10 @@ function init()
gl.clearColor(1, 0, 0, 1); // red
gl.clear(gl.COLOR_BUFFER_BIT);
if (window.testRunner) {
testRunner.display();
testRunner.waitUntilDone();
testRunner.dumpAsTextWithPixelResults();
drawGreen();
} else
window.setTimeout(drawGreen, 50);
}
runAfterDisplay(drawGreen);
}
function drawGreen()
......@@ -49,8 +49,7 @@ function drawGreen()
gl.clearColor(0, 1, 0, 1); // green
gl.clear(gl.COLOR_BUFFER_BIT);
if (window.testRunner) {
testRunner.display();
testRunner.display();
testRunner.notifyDone();
} else
window.setInterval(function() {
document.getElementById('canvas').classList.toggle('border');
......
<!DOCTYPE html>
<script src="../../resources/run-after-display.js"></script>
<script src="../../fast/repaint/resources/text-based-repaint.js"></script>
<style>
#flexbox {
display: -webkit-flex;
......@@ -10,25 +12,29 @@
}
</style>
<script>
function changeChildMargin()
function repaintTest()
{
document.getElementById("blue").style.margin = "1px";
if (window.testRunner)
testRunner.notifyDone();
}
function changeChildMargin()
{
runRepaintTest();
finishRepaintTest();
}
window.onload = function() {
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
testRunner.display();
} else {
document.body.appendChild(document.createTextNode(
"This test checks that for flex items that are moved multiple times during the layout "
+ "only the initial and final positions are repainted. Only the blue flex item should be repainted "
+ "after changing its position. If the other flex items are repainted, this test fails."));
}
setTimeout(changeChildMargin, 0);
window.enablePixelTesting = true;
window.testIsAsync = true;
runAfterDisplay(changeChildMargin)
};
</script>
<div id="flexbox">
......
......@@ -2,6 +2,8 @@
<html>
<head>
<link rel="stylesheet" href="resources/flexbox.css">
<script src="../../resources/run-after-display.js"></script>
<script src="../../fast/repaint/resources/text-based-repaint.js"></script>
<style>
body {
margin: 0;
......@@ -28,23 +30,26 @@ body {
<div class="flex-item"></div>
</div>
<script>
function resizeFlexItem() {
function repaintTest() {
var div = document.getElementById("flex-item-1");
div.classList.add("width");
if (window.testRunner)
testRunner.notifyDone();
}
function resizeFlexItem() {
runRepaintTest();
finishRepaintTest();
};
window.onload = function() {
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.display();
} else {
document.body.appendChild(document.createTextNode(
"Tests to make sure that when changing the size of one flex item changes the "
+ "location of another flex item, we properly repaint. The repaint rect should "
+ "include the three flex items."));
}
setTimeout(resizeFlexItem, 0);
window.enablePixelTesting = true;
window.testIsAsync = true;
runAfterDisplay(resizeFlexItem)
};
</script>
</body></html>
......@@ -33,17 +33,25 @@ function setFlex(value)
window.onload = function() {
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.dumpAsText();
document.body.offsetTop;
testRunner.display();
window.internals.startTrackingRepaints(document);
testRunner.waitUntilDone();
}
setTimeout(function() {
setFlex(4.6);
setTimeout(function() {
setFlex(5);
if (window.testRunner)
if (window.testRunner) {
document.body.offsetTop;
var repaintRects = window.internals.repaintRectsAsText(document);
window.internals.stopTrackingRepaints(document);
var pre = document.createElement('pre');
document.body.appendChild(pre);
pre.textContent += repaintRects;
testRunner.notifyDone();
}
})
})
};
......
......@@ -33,18 +33,23 @@ function step(count) {
if (!count)
setTimeout(step.bind(null, 1));
else {
if (window.testRunner)
testRunner.notifyDone();
else if (window.testRunner) {
var repaintRects = window.internals.repaintRectsAsText(document);
window.internals.stopTrackingRepaints(document);
var pre = document.createElement('pre');
document.body.appendChild(pre);
pre.textContent += repaintRects;
testRunner.notifyDone();
}
}
window.onload = function() {
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
document.body.offsetTop;
testRunner.display();
testRunner.dumpAsText();
testRunner.waitUntilDone();
document.body.offsetTop;
window.internals.startTrackingRepaints(document);
}
window.startTime = Date.now();
......
......@@ -8,33 +8,11 @@
content: -webkit-canvas(squares);
}
</style>
<script src="resources/repaint.js"></script>
<script type="application/x-javascript">
if (window.testRunner)
testRunner.waitUntilDone();
var canvasContext;
function runRepaintTest()
{
canvasContext = document.getCSSCanvasContext("2d", "squares", 300, 300);
if (window.testRunner) {
document.body.offsetTop;
testRunner.display();
repaintTest();
testRunner.notifyDone();
} else {
setTimeout(repaintTest, 2000);
}
}
function repaintTest()
{
draw();
}
function draw()
{
var ctx = canvasContext;
var ctx = document.getCSSCanvasContext("2d", "squares", 300, 300);
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 100, 100);
......@@ -47,4 +25,4 @@
<body onload="runRepaintTest()">
<div></div>
</body>
</html>
\ No newline at end of file
</html>
......@@ -10,25 +10,13 @@
border: 20px solid black;
}
</style>
<script src="resources/repaint.js"></script>
<script type="text/javascript" charset="utf-8">
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
function runRepaintTest()
{
if (window.testRunner) {
document.body.offsetTop;
testRunner.display();
repaintTest();
testRunner.notifyDone();
} else {
setTimeout(repaintTest, 0);
}
}
function repaintTest()
{
var canvas = document.getElementById('canvas1');
......
......@@ -10,25 +10,14 @@
border: 20px solid black;
}
</style>
<script src="resources/repaint.js"></script>
<script type="text/javascript" charset="utf-8">
if (window.testRunner) {
testRunner.dumpAsTextWithPixelResults();
testRunner.waitUntilDone();
}
var appleImage;
function runRepaintTest()
{
if (window.testRunner) {
document.body.offsetTop;
testRunner.display();
repaintTest();
testRunner.notifyDone();
} else {
setTimeout(repaintTest, 0);
}
}
function initializeCanvas()
{
......
if (window.testRunner)
testRunner.waitUntilDone();
function runRepaintTest()
{
if (window.testRunner) {
document.body.offsetTop;
testRunner.display();
repaintTest();
} else {
setTimeout(repaintTest, 100);
}
window.requestAnimationFrame(function() {
window.setTimeout(function() {
repaintTest();
if (window.testRunner)
testRunner.notifyDone();
}, 0);
});
}
......@@ -23,49 +23,33 @@ function draw()
function testResult() {
debug("Test that the image is not filtered");
left_of_center_pixel = dstCtx.getImageData(149, 150, 1, 1);
shouldBe("left_of_center_pixel.data[0]", "255");
shouldBe("left_of_center_pixel.data[1]", "0");
shouldBe("left_of_center_pixel.data[2]", "0");
right_of_center_pixel = dstCtx.getImageData(150, 150, 1, 1);
shouldBe("right_of_center_pixel.data[0]", "0");
shouldBe("right_of_center_pixel.data[1]", "255");
shouldBe("right_of_center_pixel.data[2]", "0");
left_of_center_pixel = dstCtx.getImageData(149, 150, 1, 1);
shouldBe("left_of_center_pixel.data[0]", "255");
shouldBe("left_of_center_pixel.data[1]", "0");
shouldBe("left_of_center_pixel.data[2]", "0");
right_of_center_pixel = dstCtx.getImageData(150, 150, 1, 1);
shouldBe("right_of_center_pixel.data[0]", "0");
shouldBe("right_of_center_pixel.data[1]", "255");
shouldBe("right_of_center_pixel.data[2]", "0");
finishJSTest();
}
// Bug 89018 requires 2 draw iteration in order to manifest itself.
var drawIterations = 2;
// Unrolled repaint loop for running the test in DumpRenderTree
function TestControllerPaint() {
while (drawIterations > 0) {
draw();
testRunner.display();
drawIterations = drawIterations - 1;
}
draw();
testResult();
}
// Repaint loop for running the test in the browser
function BrowserPaint(){
draw();
if (drawIterations > 0) {
drawIterations = drawIterations - 1;
window.requestAnimationFrame(BrowserPaint);
if (drawIterations > 0) {
drawIterations = drawIterations - 1;
window.requestAnimationFrame(BrowserPaint);
} else {
testResult();
}
testResult();
}
}
function onLoadHandler()
{
if (window.testRunner) {
TestControllerPaint();
} else {
BrowserPaint();
}
BrowserPaint();
}
window.jsTestIsAsync = true;
......
......@@ -33,7 +33,7 @@ function start() {
return;
window.internals.startTrackingRepaints(document);
window.testRunner.display();
var dummy = document.body.offsetTop;
}
function logRepaints() {
......@@ -54,4 +54,4 @@ function logRepaints() {
</div>
</div>
</body>
</html>
\ No newline at end of file
</html>
......@@ -33,7 +33,7 @@ function start() {
return;
window.internals.startTrackingRepaints(document);
window.testRunner.display();
var dummy = document.body.offsetTop;
}
function logRepaints() {
......
......@@ -7,8 +7,6 @@
function repaintTest()
{
document.body.style.backgroundImage='url(resources/apple.jpg)';
if (window.testRunner)
testRunner.display();
}
</script>
<style>
......
......@@ -2,6 +2,7 @@
<head>
<script>jsTestIsAsync = true;</script>
<script src="../../resources/js-test.js"></script>
<script src="../../resources/run-after-display.js"></script>
<style type="text/css">
#test1 div {
height: 100px;
......@@ -50,12 +51,10 @@
{
document.body.offsetTop;
window.internals.startTrackingRepaints(document);
testRunner.display();
setTimeout(logRepaints, 200);
runAfterDisplay(logRepaints);
}
function logRepaints()
{
function logRepaints() {
repaintRects = window.internals.repaintRectsAsText(document);
window.internals.stopTrackingRepaints(document);
......
......@@ -7,12 +7,12 @@
<audio controls autoplay onplaying="playing(1)" src="content/silence.wav" style="margin-bottom:25px; -webkit-box-reflect:below;"></audio><br/>
<audio controls autoplay onplaying="playing(2)" src="content/silence.wav" style="margin:27px 0; -webkit-transform: rotate(15deg);"></audio><br>
<script>
// Note: can't dump repaint rects here (yet) because this is trying to
// test autoplaying and window.internals doesn't exist at the right time
// to start tracking repaint rects.
if (window.testRunner)
testRunner.waitUntilDone();
if (window.testRunner)
testRunner.display();
var count = 3;
var audioElements = document.getElementsByTagName('audio');
......
<style>
body {
overflow: hidden
}
pre {
position: absolute;
top: 10000px;
}
</style>
<script src="../resources/run-after-display.js"></script>
<script>
if (window.testRunner)
testRunner.waitUntilDone();
......@@ -5,13 +15,20 @@
function onPause()
{
var videoElement = document.getElementById("fr").contentDocument.querySelector("video");
if (window.testRunner)
testRunner.display();
videoElement.currentTime = videoElement.duration * 0.50;
window.internals.startTrackingRepaints(document);
runAfterDisplay(function() {
videoElement.currentTime = videoElement.duration * 0.50;
});
}
function onSeeked()
{
var repaintRects = window.internals.repaintRectsAsText(document);
var pre = document.createElement('pre');
document.body.appendChild(pre);
pre.textContent += repaintRects;
window.internals.stopTrackingRepaints(document);
if (window.testRunner)
testRunner.notifyDone();
}
......
......@@ -21,20 +21,20 @@
function runTest() {
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.display();
}
setTimeout(function() {
document.getElementById('div').style.backgroundColor = 'green';
document.getElementById('div').style.width = '100px';
window.requestAnimationFrame(function() {
setTimeout(function() {
document.getElementById('div').style.backgroundColor = 'green';
document.getElementById('div').style.width = '100px';
// Force a full redraw to get rid of the display() shade and make ref-testing feasible.
document.getElementById('r').setAttribute('fill', 'none');
if (window.testRunner)
testRunner.notifyDone();
}, 0);
// Force a full redraw to get rid of the display() shade and make ref-testing feasible.
document.getElementById('r').setAttribute('fill', 'none');
if (window.testRunner)
testRunner.notifyDone();
}, 0);
});
}
</script>
</svg>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment