Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html

Issue 1983383002: Convert IntersectionObserver tests to use testRunner.runIdleTasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html b/third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html
index 3c4cfe76f50915b1c25ed89b2da7874e1312f455..990be02ebb9ed4b0aecff01da1ca13eb64b19df7 100644
--- a/third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html
+++ b/third_party/WebKit/LayoutTests/intersection-observer/same-document-root.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<script src="../resources/js-test.js"></script>
-<script src="helper-functions.js"></script>
+<script src="../resources/intersection-observer-helper-functions.js"></script>
<div style="width:100%; height:700px;"></div>
<div id="root" style="display: inline-block; overflow-y: scroll; height: 200px; border: 3px solid black">
<div style="width:100px; height: 300px;"></div>
@@ -22,26 +22,23 @@ onload = function() {
observer.observe(target);
entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 0);
- requestAnimationFrame(() => { requestAnimationFrame(step0) });
+ waitForNotification(step0);
}
// Test that notifications are not generated when the target is overflow clipped by the root.
function step0() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 0);
document.scrollingElement.scrollTop = 600;
- requestAnimationFrame(step1);
+ waitForNotification(step1);
}
function step1() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 0);
root.scrollTop = 150;
- requestAnimationFrame(step2);
+ waitForNotification(step2);
}
function step2() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 1);
if (entries.length > 0) {
shouldBeEqualToNumber("entries[0].boundingClientRect.left", 11);
@@ -59,18 +56,16 @@ function step2() {
shouldEvaluateToSameObject("entries[0].target", target);
}
document.scrollingElement.scrollTop = 0;
- requestAnimationFrame(step3);
+ waitForNotification(step3);
}
function step3() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 1);
root.scrollTop = 0;
- requestAnimationFrame(step4);
+ waitForNotification(step4);
}
function step4() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 2);
if (entries.length > 1) {
shouldBeEqualToNumber("entries[1].boundingClientRect.left", 11);
@@ -88,12 +83,11 @@ function step4() {
shouldEvaluateToSameObject("entries[1].target", target);
}
root.scrollTop = 150;
- requestAnimationFrame(step5);
+ waitForNotification(step5);
}
// This tests that notifications are generated even when the root element is off screen.
function step5() {
- entries = entries.concat(observer.takeRecords());
shouldBeEqualToNumber("entries.length", 3);
if (entries.length > 2) {
shouldBeEqualToNumber("entries[2].boundingClientRect.left", 11);

Powered by Google App Engine
This is Rietveld 408576698