blob: 667af85cf69b97867105f4bd47933bc1d3febbe4 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test-pre.js"></script>
<script src="resources/gesture-helpers.js"></script>
<style type="text/css">
#touchtarget {
width: 200px;
height: 200px;
position: relative;
background: white;
}
::-webkit-scrollbar {
width: 0px;
height: 0px;
}
</style>
</head>
<body>
<iframe id="touchtarget" src="resources/scroll-inside-iframe.html" scrolling="no"></iframe>
<p id="description"></p>
<div id="console"></div>
<script type="text/javascript">
var touchtarget;
var expectedGesturesTotal = 2;
var gesturesOccurred = 0;
var scrollAmountX = ['0', '0'];
var scrollAmountY = ['0', '0'];
var wheelEventsOccurred = 0;
var expectedWheelEventsOccurred = ['0', '0'];
var scrollEventsOccurred = 0;
var expectedScrollEventsOccurred = '0';
var scrolledElement = 'touchtarget.contentDocument.body'
function firstGestureScroll()
{
debug("first gesture");
eventSender.gestureScrollBegin(12, 150);
eventSender.gestureScrollUpdate(0, -140);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
}
function secondGestureScroll()
{
debug("second gesture");
eventSender.gestureScrollBegin(12, 110);
eventSender.gestureScrollUpdate(0, -60);
eventSender.gestureScrollEnd(0, 0);
// Wait for layout.
checkScrollOffset();
// In this test we do not expect any scroll events to
// be received by the event listener, so we signal
// the end of the test by calling this function instead
// of relying on recordScroll() to do it.
finishTest();
}
if (window.testRunner)
testRunner.waitUntilDone();
function runTest()
{
touchtarget = document.getElementById('touchtarget');
touchtarget.contentDocument.addEventListener("scroll", recordScroll);
touchtarget.contentDocument.body.addEventListener("mousewheel", recordWheel);
if (window.eventSender) {
description('This tests that non-scrollable iframes cannot be scrolled with touch.');
if (checkTestDependencies())
firstGestureScroll();
else
exitIfNecessary();
} else {
debug("This test requires DumpRenderTree . Touch-scroll the red/green strip.");
}
}
function finishTest()
{
if (window.eventSender) {
if (gesturesOccurred == expectedGesturesTotal) {
shouldBe('scrollEventsOccurred', expectedScrollEventsOccurred);
successfullyParsed = true;
isSuccessfullyParsed();
if (window.testRunner)
testRunner.notifyDone();
}
}
}
</script>
</body>
</html>