Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two issues were addressed in fixing these snap tests. Since the scroll timing is not accelerated, we need to be careful about how many tests we include in a single file to avoid timeouts. The subtests were split into two groups to reduce the risk of a timeout. Secondly, the key- presses are resolved when queued and not when handled, which can lead to incorrectly flagging the end of an animation before it has actually started. Bug: 878878, 1047164 Change-Id: I8cd2f1ceb52f6486ea04068f0920525869455682 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2727595 Reviewed-by: Xida Chen <xidachen@chromium.org> Commit-Queue: Kevin Ellis <kevers@chromium.org> Cr-Commit-Position: refs/heads/master@{#859055}
- Loading branch information
Kevin Ellis
authored and
Chromium LUCI CQ
committed
Mar 2, 2021
1 parent
fc692e1
commit f4db195
Showing
4 changed files
with
79 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
third_party/blink/web_tests/fast/scroll-snap/snaps-after-keyboard-scrolling-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<!DOCTYPE html> | ||
<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1" /> | ||
<link rel="stylesheet" href="resources/simple-snap.css"> | ||
<script src="../../resources/testharness.js"></script> | ||
<script src="../../resources/testharnessreport.js"></script> | ||
<script src="../../resources/gesture-util.js"></script> | ||
|
||
<div id='scroller'> | ||
<div id="space"></div> | ||
<div class="snap left top" id="top-left"></div> | ||
<div class="snap right top" id="top-right"></div> | ||
<div class="snap left bottom" id="bottom-left"></div> | ||
</div> | ||
|
||
<script> | ||
var scroller = document.getElementById("scroller"); | ||
var topLeft = document.getElementById("top-left"); | ||
var topRight = document.getElementById("top-right"); | ||
|
||
function scrollLeft() { | ||
return scroller.scrollLeft; | ||
} | ||
|
||
function scrollTop() { | ||
return scroller.scrollTop; | ||
} | ||
|
||
function keyPress(key) { | ||
return new Promise((resolve, reject) => { | ||
if (window.eventSender) { | ||
eventSender.keyDown(key); | ||
resolve(); | ||
} | ||
else { | ||
reject('This test requires window.eventSender'); | ||
} | ||
}) | ||
} | ||
|
||
promise_test (async () => { | ||
await mouseClickOn(10, 10); | ||
scroller.scrollTo(0, 0); | ||
await keyPress("ArrowDown"); | ||
await waitForScrollEnd(scroller, scrollTop, 400); | ||
}, "Snaps to bottom-left after pressing ArrowDown"); | ||
|
||
promise_test (async () => { | ||
await mouseClickOn(10, 10); | ||
scroller.scrollTo(0, 400); | ||
await keyPress("ArrowUp"); | ||
await waitForScrollEnd(scroller, scrollTop, 0); | ||
}, "Snaps to top-left after pressing ArrowUp"); | ||
|
||
promise_test (async () => { | ||
await mouseClickOn(10, 10); | ||
scroller.scrollTo(0, 0); | ||
await keyPress("ArrowRight"); | ||
await waitForScrollEnd(scroller, scrollLeft, 400); | ||
}, "Snaps to top-right after pressing ArrowRight"); | ||
|
||
promise_test (async () => { | ||
await mouseClickOn(10, 10); | ||
scroller.scrollTo(400, 0); | ||
await keyPress("ArrowLeft"); | ||
await waitForScrollEnd(scroller, scrollLeft, 0); | ||
}, "Snaps to top-left after pressing ArrowLeft"); | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters