Index: third_party/WebKit/LayoutTests/intersection-observer/cross-origin-iframe.html |
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/cross-origin-iframe.html b/third_party/WebKit/LayoutTests/intersection-observer/cross-origin-iframe.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..aba75b1a8d5832595bdffc354b103a3d74d80200 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/intersection-observer/cross-origin-iframe.html |
@@ -0,0 +1,55 @@ |
+<!DOCTYPE html> |
+<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; |
+} |
+iframe { |
+ width: 160px; |
+ height: 100px; |
+ overflow-y: scroll; |
+} |
+.spacer { |
+ height: 700px; |
+} |
+</style> |
+ |
+<div class="spacer"></div> |
+<iframe src="resources/cross-origin-subframe.html" sandbox="allow-scripts"></iframe> |
+<div class="spacer"></div> |
+ |
+<script> |
+async_test(function(t) { |
+ var iframe = document.querySelector("iframe"); |
+ |
+ assert_equals(window.innerWidth, 800, "Window must be 800 pixels wide."); |
+ assert_equals(window.innerHeight, 600, "Window must be 600 pixels high."); |
+ |
+ function handleMessage(event) { |
+ if (event.data.hasOwnProperty('scrollTo')) { |
+ document.scrollingElement.scrollTop = event.data.scrollTo; |
+ waitForNotification(function() { iframe.contentWindow.postMessage("", "*"); }, |
+ "document.scrollingElement.scrollTop = " + event.data.scrollTo); |
+ } else if (event.data.hasOwnProperty('actual')) { |
+ checkJsonEntries(event.data.actual, event.data.expected, event.data.description); |
+ } else if (event.data.hasOwnProperty('DONE')) { |
+ document.scrollingElement.scrollTop = 0; |
+ t.done(); |
+ } else { |
+ var description = event.data.description; |
+ waitForNotification(function() { iframe.contentWindow.postMessage("", "*"); }, description); |
+ } |
+ } |
+ |
+ window.addEventListener("message", t.step_func(handleMessage)); |
+ |
+ iframe.onload = t.step_func(function() { |
+ waitForNotification(function() { iframe.contentWindow.postMessage("", "*") }, "setup"); |
+ }); |
+}, "Intersection observer test with no explicit root and target in a cross-origin iframe."); |
+</script> |