Bug 1494440 - Add a mochitest. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D11269

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2018-11-08 22:25:07 +00:00
Родитель adb8d185d6
Коммит 8dee3ff754
2 изменённых файлов: 53 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,52 @@
<head>
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Inactive iframe with overscroll-behavior</title>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
</head>
<body>
<iframe id="scroll" srcdoc="<html style='overscroll-behavior:none;'><div style='width:100px;height:2000px;'>">
</iframe>
<div style="height: 5000px;"></div><!-- So the page is scrollable as well -->
<script type="application/javascript">
function* test(testDriver) {
var iframe = document.getElementById('scroll');
var iframeWindow = iframe.contentWindow;
var iframeContent = iframeWindow.document.documentElement;
// scroll the iframe to the bottom, such that a subsequent scroll on it
// _would_ hand off to the page if overscroll-behavior allowed it
iframeWindow.scrollTo(0, iframeWindow.scrollMaxY);
yield waitForApzFlushedRepaints(testDriver);
is(iframeWindow.scrollY, iframeWindow.scrollMaxY, "iframe has scrolled to the bottom");
// Scroll over the iframe, and make sure that the page
// does not scroll.
// We can't wait for a "scroll" event unconditionally, since if the platform
// behaviour we are testing is correct (overscroll-behavior is respected),
// one will never arrive.
var waitForScroll = false;
yield moveMouseAndScrollWheelOver(iframeWindow, 100, 100, testDriver, waitForScroll);
// However, we need to give a potential "scroll" event a chance to be dispatched,
// so that if the platform behaviour we are testing is incorrect (overscroll-behavior)
// is not respected, we catch it.
yield waitForApzFlushedRepaints(testDriver);
is(window.scrollY, 0, "overscroll-behavior was respected");
}
waitUntilApzStable()
.then(runContinuation(test))
.then(subtestDone);
</script>
<style>
#scroll {
width: 200px;
height: 500px;
}
</style>
</body>
</head>

Просмотреть файл

@ -36,6 +36,7 @@ var subtests = [
{'file': 'helper_bug1271432.html', 'prefs': prefs},
{'file': 'helper_overscroll_behavior_bug1425573.html', 'prefs': timeout_prefs},
{'file': 'helper_overscroll_behavior_bug1425603.html', 'prefs': prefs},
{'file': 'helper_overscroll_behavior_bug1494440.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_perspective.html', 'prefs': prefs},
{'file': 'helper_scroll_inactive_zindex.html', 'prefs': prefs},
{'file': 'helper_scroll_over_scrollbar.html', 'prefs': scrollbar_prefs},