Index: third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/onscroll-bouncing.html |
diff --git a/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/onscroll-bouncing.html b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/onscroll-bouncing.html |
index 902b7cdeed2fc06a438fca783d8d0dcc8984ae29..8e9fc280c1f193edb8863d962bfb27995956b6a9 100644 |
--- a/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/onscroll-bouncing.html |
+++ b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/onscroll-bouncing.html |
@@ -1,6 +1,7 @@ |
<!DOCTYPE html> |
<script src="../../../resources/testharness.js"></script> |
<script src="../../../resources/testharnessreport.js"></script> |
+<script src="resources/scroll-anchoring-test.js"></script> |
<style> |
body { margin: 80px 0; height: 5000px; } |
@@ -53,32 +54,6 @@ onscroll = function() { |
a.className = (fixed = !fixed) ? "f" : ""; |
}; |
-var frame = () => new Promise((resolve) => { requestAnimationFrame(resolve); }); |
- |
-var waitFor = function(condition, failmsg, deadline) { |
- if (!deadline) deadline = Date.now() + 1000; |
- if (condition()) return Promise.resolve(); |
- else if (Date.now() > deadline) return Promise.reject(failmsg); |
- else return frame().then(() => waitFor(condition, failmsg, deadline)); |
-}; |
- |
-var waitFrames = function(n, condition, failmsg) { |
- var p = Promise.resolve(); |
- var check = () => (!condition || condition() ? |
- Promise.resolve() : Promise.reject(failmsg)); |
- while (n--) |
- p = p.then(check).then(frame); |
- return p.then(check); |
-}; |
- |
-var scrollSettlesAt = function(expectedY) { |
- return waitFor(() => (scrollY == expectedY), |
- "scroll did not reach " + expectedY) |
- .then(() => waitFrames(3)) |
- .then(() => waitFrames(3, () => (scrollY == expectedY), |
- "scroll did not stay at " + expectedY)); |
-}; |
- |
promise_test(function() { |
return Promise.resolve() |