Commit 7a38396e authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

Cleanup non-fast-scrollable-region web tests

donot-compute-non-fast-scrollable-region-for-hidden-frames.html did not
use "t.step" which made the test difficult to debug if there were
failures, so "t.step" has been added. This test has also been changed to
print the actual region instead of just the count.

plugin-with-wheel-handler.html has also been changed to print the actual
region instead of just the count. This required using
"setPrintTestResultsLazily" to prevent cross-platform differences due to
text height.

Bug: 864567
Change-Id: Ibf19cd12d4f40a14a037d72eb076b50ff7aa3f0f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1711489
Commit-Queue: David Bokan <bokan@chromium.org>
Auto-Submit: Philip Rogers <pdr@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#680014}
parent d5c88f6e
...@@ -22,15 +22,21 @@ ...@@ -22,15 +22,21 @@
async_test((t) => { async_test((t) => {
var iframeWindow = document.querySelector("iframe").contentWindow; var iframeWindow = document.querySelector("iframe").contentWindow;
iframeWindow.addEventListener("load", () => { iframeWindow.addEventListener("load", () => {
nonFastScrollableRects = internals.nonFastScrollableRects(document); t.step(function() {
assert_equals(nonFastScrollableRects.length, 3); nonFastScrollableRects = internals.nonFastScrollableRects(document);
assert_equals(nonFastScrollableRects.length, 3);
var iframeElement = document.querySelector("iframe"); assert_equals(rectToString(nonFastScrollableRects[0]), '[51, 102, 200, 200]');
iframeElement.style.visibility = 'hidden'; assert_equals(rectToString(nonFastScrollableRects[1]), '[51, 402, 211, 211]');
assert_equals(rectToString(nonFastScrollableRects[2]), '[51, 702, 222, 222]');
var iframeElement = document.querySelector("iframe");
iframeElement.style.visibility = 'hidden';
});
runAfterLayoutAndPaint(() => { runAfterLayoutAndPaint(() => {
nonFastScrollableRects = internals.nonFastScrollableRects(document); t.step(function() {
assert_equals(nonFastScrollableRects.length, 0); nonFastScrollableRects = internals.nonFastScrollableRects(document);
assert_equals(nonFastScrollableRects.length, 0);
});
t.done(); t.done();
}); });
}); });
......
...@@ -2,8 +2,10 @@ This test ensures that a plugin which wants to receive wheel events is included ...@@ -2,8 +2,10 @@ This test ensures that a plugin which wants to receive wheel events is included
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS internals.nonFastScrollableRects(document).length is 1 PASS nonFastScrollableRects.length is 1
PASS rectToString(nonFastScrollableRects[0]) is "[8, 8, 300, 150]"
PASS successfullyParsed is true PASS successfullyParsed is true
TEST COMPLETE TEST COMPLETE
<!DOCTYPE html> <!DOCTYPE html>
<script src="../resources/js-test.js"></script> <script src="../resources/js-test.js"></script>
<script src="../resources/run-after-layout-and-paint.js"></script> <script src="../resources/run-after-layout-and-paint.js"></script>
<script src="resources/non-fast-scrollable-region-testing.js"></script>
<script> <script>
// Perform the test without any description text (with the plugin at the top
// left) so the non-fast rect is not affected by platform-specific differences
// in text height.
setPrintTestResultsLazily();
description('This test ensures that a plugin which wants to receive wheel ' + description('This test ensures that a plugin which wants to receive wheel ' +
'events is included in the non-fast scrollable region.'); 'events is included in the non-fast scrollable region.');
window.jsTestIsAsync = true; window.jsTestIsAsync = true;
onload = function() { onload = function() {
runAfterLayoutAndPaint(function() { runAfterLayoutAndPaint(function() {
nonFastScrollableRects = internals.nonFastScrollableRects(document);
if (window.internals) { if (window.internals) {
shouldBe('internals.nonFastScrollableRects(document).length', '1'); shouldBe('nonFastScrollableRects.length', '1');
shouldBeEqualToString('rectToString(nonFastScrollableRects[0])', '[8, 8, 300, 150]');
} else { } else {
debug('This test requires access to internals.nonFastScrollableRects.'); debug('This test requires access to internals.nonFastScrollableRects.');
} }
finishJSTest(); finishJSTest();
......
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