Commit 3437aff4 authored by David Bokan's avatar David Bokan Committed by Commit Bot

Modernize scale-and-scroll-iframe-window.html test

This CL converts this test to use testharness.js assertions rather than
js-test.js and a pixel test. The impetus for this is the pixel diff when
root layer scrolling is turned on. The difference it not related to what
this test is checking (and is actually correct when RLS is turned on).
See the bug (comment #7) for more details.

Bug: 781431
Change-Id: Ida7c287b616b4fd166b436e9957f28bf794098d4
Reviewed-on: https://chromium-review.googlesource.com/894365Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533170}
parent f8c029b4
PASS successfullyParsed is true
TEST COMPLETE
PASS frame.contentDocument.scrollingElement.scrollTop is 100
PASS frame.contentDocument.scrollingElement.scrollLeft is 100
PASS frame.contentWindow.scrollX is 100
PASS frame.contentWindow.scrollY is 100
<html> <script src="../../resources/testharness.js"></script>
<head> <script src="../../resources/testharnessreport.js"></script>
<script> <script>
window.enablePixelTesting = true; const mainTest = async_test(
'window.scrollTo while zoomed causes correct amount of scroll', {});
const frameTest = async_test(
'window.scrollTo while zoomed causes correct amount of scroll in '
+ 'iframe', {});
function runTest() {
var scaleFactor = 2;
if (window.internals)
internals.setPageScaleFactor(scaleFactor);
function scroll() {
window.scrollTo(0, 100); window.scrollTo(0, 100);
mainTest.step(function() {
assert_equals(document.scrollingElement.scrollLeft, 0,
"scrollingElement has correct scrollLeft");
assert_equals(document.scrollingElement.scrollTop, 100,
"scrollingElement has correct scrollTop");
assert_equals(window.scrollX, 0,
"window has correct scrollX");
assert_equals(window.scrollY, 100,
"window has correct scrollY");
});
mainTest.done();
var frame = document.getElementById('frame'); var frame = document.getElementById('frame');
frame.contentWindow.scrollTo(100,100); frame.contentWindow.scrollTo(100,100);
shouldBe("frame.contentDocument.scrollingElement.scrollTop", "100"); frameTest.step(function() {
shouldBe("frame.contentDocument.scrollingElement.scrollLeft", "100"); assert_equals(frame.contentDocument.scrollingElement.scrollLeft,
shouldBe("frame.contentWindow.scrollX", "100"); 100,
shouldBe("frame.contentWindow.scrollY", "100"); "IFrame ScrollingElement has correct scrollLeft");
assert_equals(frame.contentDocument.scrollingElement.scrollTop,
100,
"IFrame ScrollingElement has correct scrollTop");
assert_equals(frame.contentWindow.scrollX, 100,
"IFrame window has correct scrollX");
assert_equals(frame.contentWindow.scrollY, 100,
"IFrame window has correct scrollY");
});
frameTest.done();
} }
function scaleWithEventSender() { addEventListener('load', runTest);
var scaleFactor = 0.5; </script>
if (window.internals) { <style>
internals.setPageScaleFactorLimits(scaleFactor, scaleFactor); body {
internals.setPageScaleFactor(scaleFactor); width: 4000px;
} height: 4000px;
} }
</style>
function test() { <div id="console"></div>
scaleWithEventSender(); <iframe id="frame" style="width:400px; height: 400px; position: absolute; top: 100px;"></iframe>
scroll(); <script>
}
</script>
<script src="../../resources/js-test.js"></script>
</head>
<body onload="test();" style="width: 4000px; height: 4000px">
<div id="console"></div>
<iframe id="frame" style="width:400px; height: 400px; position: absolute; top: 100px;"></iframe>
<script>
var frame = document.getElementById('frame'); var frame = document.getElementById('frame');
var doc = frame.contentDocument.open(); var doc = frame.contentDocument.open();
doc.write("<html><style>::-webkit-scrollbar {width: 0px;height: 0px;}</style></html>"); doc.write("<html><style>::-webkit-scrollbar {width: 0px;height: 0px;}</style></html>");
...@@ -51,6 +73,4 @@ ...@@ -51,6 +73,4 @@
doc.close(); doc.close();
frame.contentDocument.body.style.width = "2000px"; frame.contentDocument.body.style.width = "2000px";
frame.contentDocument.body.style.height = "2000px"; frame.contentDocument.body.style.height = "2000px";
</script> </script>
</body>
</html>
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