Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: third_party/WebKit/LayoutTests/intersection-observer/cross-origin-iframe.html

Issue 2560253004: IntersectionObserver: convert tests to testharness.js (Closed)
Patch Set: Address comments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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("", "*") ; },
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", t.step_func(handleMessage));
50
51 iframe.onload = t.step_func(function() {
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698