blob: 3f87a039ee7a93cb64a2f0e65d50cba097046cc0 [file] [log] [blame]
<head>
<style>
html {
font-size: 32pt;
}
</style>
<script src="resources/swipe-test.js"></script>
<script>
function runTest()
{
playEventStream(`[{
"relativeTimeMS" : 0,
"kCGEventScrollGestureFlagBits" : 1,
"kCGEventGestureHIDType" : 6,
"kCGSEventTypeField" : 29,
"kCGEventGesturePhase" : 128,
"windowLocation" : "{400, 300}"
},
{
"relativeTimeMS" : 8,
"kCGEventGestureHIDType" : 61,
"kCGSEventTypeField" : 29,
"kCGEventGestureStartEndSeriesType" : 6,
"windowLocation" : "{0, 0}"
},
{
"kCGEventGestureHIDType" : 6,
"relativeTimeMS" : 8,
"windowLocation" : "{400, 300}",
"kCGEventGesturePhase" : 1,
"kCGEventScrollGestureFlagBits" : 1,
"kCGSEventTypeField" : 29,
"kCGEventGestureScrollX" : 2
},
{
"relativeTimeMS" : 8,
"windowLocation" : "{400, 300}",
"kCGScrollWheelEventScrollPhase" : 1,
"kCGScrollWheelEventIsContinuous" : 1,
"kCGScrollWheelEventPointDeltaAxis2" : 1,
"kCGSEventTypeField" : 22
}]`, goBack);
}
function goBack()
{
window.history.back();
setTimeout(continueTest, 0);
}
function continueTest()
{
playEventStream(`[
{
"relativeTimeMS" : 0,
"windowLocation" : "{400, 300}",
"kCGScrollWheelEventScrollPhase" : 1,
"kCGScrollWheelEventIsContinuous" : 1,
"kCGScrollWheelEventPointDeltaAxis2" : 20,
"kCGSEventTypeField" : 22
}]`, function () {
completeTest();
});
}
function completeTest()
{
completeSwipeGesture(testComplete);
}
function didBeginSwipeCallback()
{
log("Failed. Should not begin swipe; we've already navigated away from the item where the swipe started, and there is no other back item.");
}
function isFirstPage()
{
return window.location.href.indexOf("second") == -1;
}
function updateContent()
{
document.body.innerHTML = isFirstPage() ? "first" : "second";
}
window.onload = function () {
if (!window.eventSender || !window.testRunner) {
document.body.innerHTML = "This test must be run in WebKitTestRunner.";
return;
}
updateContent();
initializeSwipeTest();
testRunner.installDidBeginSwipeCallback(didBeginSwipeCallback);
testRunner.overridePreference("WebKitUsesPageCachePreferenceKey", 1);
testRunner.dumpAsText();
testRunner.waitUntilDone();
window.addEventListener("popstate", function(e) {
updateContent();
});
setTimeout(function () {
history.pushState(null, null, "/second");
updateContent();
setTimeout(function () {
runTest();
}, 0);
}, 0);
};
</script>
</head>
<body>
</body>