| Index: third_party/WebKit/LayoutTests/intersection-observer/observer-without-js-reference.html
|
| diff --git a/third_party/WebKit/LayoutTests/intersection-observer/observer-without-js-reference.html b/third_party/WebKit/LayoutTests/intersection-observer/observer-without-js-reference.html
|
| index 27dffb04168f6371e29fd1d219bb56484daf0b9b..6015cde44c87fb48bc0162bbac57e1a21bc9235b 100644
|
| --- a/third_party/WebKit/LayoutTests/intersection-observer/observer-without-js-reference.html
|
| +++ b/third_party/WebKit/LayoutTests/intersection-observer/observer-without-js-reference.html
|
| @@ -1,22 +1,47 @@
|
| <!DOCTYPE html>
|
| -<script src="../resources/js-test.js"></script>
|
| -<script src="../resources/gc.js"></script>
|
| -<script src="../resources/intersection-observer-helper-functions.js"></script>
|
| -<div style="width:100%; height:700px;"></div>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<div id="leading-space" style="width:100%; height:700px;"></div>
|
| <div id="target" style="background-color: green; width:100px; height:100px"></div>
|
| -<div style="width:100%; height:700px;"></div>
|
| +<div id="trailing-space" style="width:100%; height:700px;"></div>
|
|
|
| <script>
|
| -description("IntersectionObserver continues to produce notifications when it has no javascript references.");
|
| -var target = document.getElementById("target");
|
| -var entries = [];
|
| -new IntersectionObserver(function(changes) {
|
| - entries.push(...changes);
|
| -}).observe(target);
|
| -gc();
|
| -document.scrollingElement.scrollTop = 300;
|
| -waitForNotification(() => {
|
| - shouldBeEqualToNumber("entries.length", 1);
|
| - finishJSTest();
|
| -});
|
| +function waitForNotification(f) {
|
| + requestAnimationFrame(() => {
|
| + setTimeout(() => {
|
| + setTimeout(f);
|
| + });
|
| + });
|
| +}
|
| +
|
| +onload = function() {
|
| + var t = async_test("IntersectionObserver continues to produce notifications when it has no javascript references.");
|
| +
|
| + test(function() { assert_equals(window.innerWidth, 800) }, "Window must be 800 pixels wide.");
|
| + test(function() { assert_equals(window.innerHeight, 600) }, "Window must be 600 pixels high.");
|
| +
|
| + var target = document.getElementById("target");
|
| + var entries = [];
|
| + function createObserver() {
|
| + new IntersectionObserver(function(changes) {
|
| + entries = entries.concat(changes)
|
| + }).observe(target);
|
| + }
|
| +
|
| + createObserver();
|
| + waitForNotification(step0);
|
| +
|
| + function step0() {
|
| + test(function() { assert_equals(entries.length, 0) }, "No notifications.");
|
| + document.scrollingElement.scrollTop = 300;
|
| + waitForNotification(step1);
|
| + }
|
| +
|
| + function step1() {
|
| + test(function() { assert_equals(entries.length, 1) }, "One notification.");
|
| + document.getElementById("leading-space").style.height = "";
|
| + document.getElementById("trailing-space").style.height = "";
|
| + t.done();
|
| + }
|
| +};
|
| </script>
|
|
|