Minor improvements to reftests.

1. If notifyTestComplete is called before the first paint,
give a clear assert instead of a confusing crash.

2. Add runAfterDisplay. This is a copy of the equivalent
file in Blink. Avoids the incorrect 100ms setTimeout. I had
thought there was a deeper bug here, but it appears to just
be the issue from #1 now that we properly pump frames
in testing mode by using a face Surfaces application.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/826343003
This commit is contained in:
Ojan Vafai
2015-01-06 15:41:14 -08:00
parent 5096b17cc6
commit 276d94fb56
5 changed files with 17 additions and 28 deletions

View File

@@ -1,12 +1,9 @@
<foo>
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
This is a reftest.
<script>
window.addEventListener('load', function() {
// TODO(ojan): requestAnimationFrame once we properly pump frames.
// https://github.com/domokit/mojo/issues/32
setTimeout(function() {
internals.notifyTestComplete("");
}, 100);
})
runAfterDisplay(function() {
internals.notifyTestComplete("");
});
</script>
</foo>

View File

@@ -1,12 +1,9 @@
<foo>
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
This is a mismatch reftest.
<script>
window.addEventListener('load', function() {
// TODO(ojan): requestAnimationFrame once we properly pump frames.
// https://github.com/domokit/mojo/issues/32
setTimeout(function() {
internals.notifyTestComplete("");
}, 100);
})
runAfterDisplay(function() {
internals.notifyTestComplete("");
});
</script>
</foo>

View File

@@ -1,12 +1,9 @@
<foo>
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
This is a mismatch reftest. Should not match.
<script>
window.addEventListener('load', function() {
// TODO(ojan): requestAnimationFrame once we properly pump frames.
// https://github.com/domokit/mojo/issues/32
setTimeout(function() {
internals.notifyTestComplete("");
}, 100);
})
runAfterDisplay(function() {
internals.notifyTestComplete("");
});
</script>
</foo>

View File

@@ -1,12 +1,9 @@
<foo>
<import src="../resources/run-after-display.sky" as="runAfterDisplay" />
This is a reftest.
<script>
window.addEventListener('load', function() {
// TODO(ojan): requestAnimationFrame once we properly pump frames.
// https://github.com/domokit/mojo/issues/32
setTimeout(function() {
internals.notifyTestComplete("");
}, 100);
})
runAfterDisplay(function() {
internals.notifyTestComplete("");
});
</script>
</foo>

View File

@@ -55,6 +55,7 @@ void TestRunner::OnTestComplete(const std::string& test_result,
std::cout << "\nActualHash: FAKEHASHSTUB\n";
std::cout << "Content-Type: image/png\n";
std::cout << "Content-Length: " << pixels.size() << "\n";
CHECK(pixels.size()) << "Could not dump pixels. Did you call notifyTestComplete before the first paint?";
std::cout.write(
reinterpret_cast<const char*>(&pixels[0]), pixels.size());
}