Chromium Code Reviews| 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..7043f52ccf27078f07ae4f3b9c255ff585b15c43 |
| --- /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("", "*"); }, |
|
foolip
2017/01/11 11:42:33
I suppose it can be assumed that the callbacks her
szager1
2017/01/23 23:18:03
Adding t.step_func to the message handler below wi
|
| + "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", handleMessage); |
|
foolip
2017/01/11 11:42:33
t.step_func(handleMessage). With that change, it s
szager1
2017/01/23 23:18:03
I'll add t.step_func, but this is a case where fai
|
| + |
| + iframe.onload = function() { |
|
foolip
2017/01/11 11:42:33
Maybe t.step_func here. It is pretty ugly, but doe
szager1
2017/01/23 23:18:03
Done.
|
| + waitForNotification(function() { iframe.contentWindow.postMessage("", "*") }, "setup"); |
| + }; |
| +}, "Intersection observer test with no explicit root and target in a cross-origin iframe."); |
| +</script> |