Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../resources/testharness.js"></script> | |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 4 <script src="./resources/intersection-observer-test-utils.js"></script> | |
| 5 | |
| 6 <style> | |
| 7 pre, #log { | |
| 8 position: absolute; | |
| 9 top: 0; | |
| 10 left: 200px; | |
| 11 } | |
| 12 iframe { | |
| 13 width: 160px; | |
| 14 height: 100px; | |
| 15 overflow-y: scroll; | |
| 16 } | |
| 17 .spacer { | |
| 18 height: 700px; | |
| 19 } | |
| 20 </style> | |
| 21 | |
| 22 <div class="spacer"></div> | |
| 23 <iframe src="resources/cross-origin-subframe.html" sandbox="allow-scripts"></ifr ame> | |
| 24 <div class="spacer"></div> | |
| 25 | |
| 26 <script> | |
| 27 async_test(function(t) { | |
| 28 var iframe = document.querySelector("iframe"); | |
| 29 | |
| 30 assert_equals(window.innerWidth, 800, "Window must be 800 pixels wide."); | |
| 31 assert_equals(window.innerHeight, 600, "Window must be 600 pixels high."); | |
| 32 | |
| 33 function handleMessage(event) { | |
| 34 if (event.data.hasOwnProperty('scrollTo')) { | |
| 35 document.scrollingElement.scrollTop = event.data.scrollTo; | |
| 36 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
| |
| 37 "document.scrollingElement.scrollTop = " + event.data. scrollTo); | |
| 38 } else if (event.data.hasOwnProperty('actual')) { | |
| 39 checkJsonEntries(event.data.actual, event.data.expected, event.data.descri ption); | |
| 40 } else if (event.data.hasOwnProperty('DONE')) { | |
| 41 document.scrollingElement.scrollTop = 0; | |
| 42 t.done(); | |
| 43 } else { | |
| 44 var description = event.data.description; | |
| 45 waitForNotification(function() { iframe.contentWindow.postMessage("", "*") ; }, description); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 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
| |
| 50 | |
| 51 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.
| |
| 52 waitForNotification(function() { iframe.contentWindow.postMessage("", "*") } , "setup"); | |
| 53 }; | |
| 54 }, "Intersection observer test with no explicit root and target in a cross-origi n iframe."); | |
| 55 </script> | |
| OLD | NEW |