зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1686372 - Migrate helper_drag_root_scrollbar.html to async/await style. r=botond
Depends on D101528 Differential Revision: https://phabricator.services.mozilla.com/D101529
This commit is contained in:
Родитель
a943137b4c
Коммит
136f7c154d
|
@ -15,12 +15,14 @@
|
|||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
function* test(testDriver) {
|
||||
window.addEventListener("scroll", () => setTimeout(testDriver, 0), {once: true});
|
||||
async function test() {
|
||||
let scrollPromise = new Promise(resolve => {
|
||||
window.addEventListener("scroll", resolve, {once: true});
|
||||
});
|
||||
|
||||
// Do the scroll in one increment so that when the scroll event fires
|
||||
// we're done all the scrolling we're going to do.
|
||||
var dragFinisher = yield* dragVerticalScrollbar(window, testDriver, 20, 20);
|
||||
var dragFinisher = await promiseVerticalScrollbarDrag(window, 20, 20);
|
||||
if (!dragFinisher) {
|
||||
ok(true, "No scrollbar, can't do this test");
|
||||
return;
|
||||
|
@ -29,12 +31,12 @@ function* test(testDriver) {
|
|||
// the events above might be stuck in APZ input queue for a bit until the
|
||||
// layer is activated, so we wait here until the scroll event listener is
|
||||
// triggered.
|
||||
yield;
|
||||
await scrollPromise;
|
||||
|
||||
yield* dragFinisher();
|
||||
await dragFinisher();
|
||||
|
||||
// Flush everything just to be safe
|
||||
yield flushApzRepaints(testDriver);
|
||||
await promiseApzRepaintsFlushed();
|
||||
|
||||
// After dragging the scrollbar 20px on a 1000px-high viewport, we should
|
||||
// have scrolled approx 2% of the 5000px high content. There might have been
|
||||
|
@ -48,7 +50,7 @@ function* test(testDriver) {
|
|||
}
|
||||
|
||||
waitUntilApzStable()
|
||||
.then(runContinuation(test))
|
||||
.then(test)
|
||||
.then(subtestDone, subtestFailed);
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче