| 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..1cdc0841165b875597b2f7277c4c0fe3e3ebd1e8 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,53 @@
|
| <!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>
|
| -<div id="target" style="background-color: green; width:100px; height:100px"></div>
|
| -<div style="width:100%; height:700px;"></div>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script src="./resources/intersection-observer-test-utils.js"></script>
|
| +
|
| +<style>
|
| +pre, #log {
|
| + position: absolute;
|
| + top: 0;
|
| + left: 200px;
|
| +}
|
| +.spacer {
|
| + height: 700px;
|
| +}
|
| +#target {
|
| + width: 100px;
|
| + height: 100px;
|
| + background-color: green;
|
| +}
|
| +</style>
|
| +<div class="spacer"></div>
|
| +<div id="target"></div>
|
| +<div class="spacer"></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();
|
| -});
|
| +
|
| +runTestCycle(function() {
|
| + assert_equals(window.innerWidth, 800, "Window must be 800 pixels wide.");
|
| + assert_equals(window.innerHeight, 600, "Window must be 600 pixels high.");
|
| +
|
| + var target = document.getElementById("target");
|
| + assert_true(!!target, "Target exists");
|
| + function createObserver() {
|
| + new IntersectionObserver(function(changes) {
|
| + entries = entries.concat(changes)
|
| + }).observe(target);
|
| + }
|
| + createObserver();
|
| + runTestCycle(step0, "First rAF");
|
| +}, "IntersectionObserver that is unreachable in js should still generate notifications.");
|
| +
|
| +function step0() {
|
| + document.scrollingElement.scrollTop = 300;
|
| + runTestCycle(step1, "document.scrollingElement.scrollTop = 300");
|
| + assert_equals(entries.length, 0, "No notifications after first rAF.");
|
| +}
|
| +
|
| +function step1() {
|
| + document.scrollingElement.scrollTop = 0;
|
| + assert_equals(entries.length, 1, "One notification.");
|
| +}
|
| </script>
|
|
|