Bug 1490934 [wpt PR 12986] - Move target-in-different-window.html into wpt/, a=testonly
authorPhilip Jägenstedt <foolip@chromium.org>
Fri, 05 Oct 2018 14:20:39 +0000
changeset 488342 a9d89c01bd9856999486a9937d947554a0232489
parent 488341 bda73f529c5d3386bc683c08b6fd9d0b35aeb9be
child 488343 dec7a9d8dd15ce58b6d064b824a09789628e543b
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewerstestonly
bugs1490934, 12986, 12858, 879798, 1224010, 594690
milestone64.0a1
Bug 1490934 [wpt PR 12986] - Move target-in-different-window.html into wpt/, a=testonly Automatic update from web-platform-testsMove target-in-different-window.html into wpt/ With tweaks from this comment: https://github.com/web-platform-tests/wpt/pull/12858#issuecomment-419775438 Bug: 879798 Change-Id: I3806dffd01dcc7a1f7dd21a7fe68ce3c099df181 Reviewed-on: https://chromium-review.googlesource.com/1224010 Reviewed-by: Stefan Zager <szager@chromium.org> Commit-Queue: Philip J├Ągenstedt <foolip@chromium.org> Cr-Commit-Position: refs/heads/master@{#594690} -- wpt-commits: 1debbf994851c67238281c57df815f7b0d5f1e47 wpt-pr: 12986
testing/web-platform/tests/intersection-observer/target-in-different-window.html
testing/web-platform/tests/lint.whitelist
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/intersection-observer/target-in-different-window.html
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/intersection-observer-test-utils.js"></script>
+
+<script>
+var entries = [];
+var popup, target;
+
+function waitForPopupNotification(f) {
+  popup.requestAnimationFrame(function() {
+    popup.requestAnimationFrame(function() { popup.setTimeout(f); });
+  });
+}
+
+async_test((t) => {
+  var observer = new IntersectionObserver(function(changes) {
+    entries = entries.concat(changes);
+  });
+  popup = window.open();
+  t.add_cleanup(() => popup.close());
+  target = popup.document.createElement('div');
+  target.style.width = "100px";
+  target.style.height = "100px";
+  observer.observe(target);
+  waitForPopupNotification(t.step_func(() => {
+    assert_equals(entries.length, 1, "Initial notification for detached target.");
+    assert_equals(entries[0].isIntersecting, false, "not intersecting");
+    popup.document.body.appendChild(target);
+    waitForPopupNotification(t.step_func_done(() => {
+      assert_equals(entries.length, 2, "Notification after insertion into popup.");
+      assert_equals(entries[1].isIntersecting, true, "intersecting");
+    }));
+  }));
+}, "IntersectionObserver with target in a different window.");
+</script>
--- a/testing/web-platform/tests/lint.whitelist
+++ b/testing/web-platform/tests/lint.whitelist
@@ -164,16 +164,17 @@ SET TIMEOUT: html/semantics/scripting-1/
 SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/0*
 SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/resources/history-frame.html
 SET TIMEOUT: html/webappapis/dynamic-markup-insertion/opening-the-input-stream/tasks.window.js
 SET TIMEOUT: html/webappapis/scripting/event-loops/*
 SET TIMEOUT: html/webappapis/scripting/events/event-handler-processing-algorithm-error/*
 SET TIMEOUT: html/webappapis/scripting/processing-model-2/*
 SET TIMEOUT: IndexedDB/*
 SET TIMEOUT: infrastructure/*
+SET TIMEOUT: intersection-observer/target-in-different-window.html
 SET TIMEOUT: media-source/mediasource-util.js
 SET TIMEOUT: media-source/URL-createObjectURL-revoke.html
 SET TIMEOUT: mixed-content/generic/sanity-checker.js
 SET TIMEOUT: navigation-timing/*
 SET TIMEOUT: offscreen-canvas/the-offscreen-canvas/*
 SET TIMEOUT: old-tests/submission/Microsoft/history/history_000.htm
 SET TIMEOUT: paint-timing/resources/subframe-painting.html
 SET TIMEOUT: payment-request/allowpaymentrequest/setting-allowpaymentrequest-timing.https.sub.html