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

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

Issue 2560253004: IntersectionObserver: convert tests to testharness.js (Closed)
Patch Set: Address comments Created 3 years, 10 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/intersection-observer/iframe-cross-origin-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="/js-test-resources/js-test.js"></script>
3 <script src="/js-test-resources/intersection-observer-helper-functions.js"></scr ipt>
4 <div style="width:100%; height:700px;"></div>
5 <iframe id="target-iframe" src="http://localhost:8080/intersection-observer/reso urces/cross-origin-subframe.html" style="height: 100px; overflow-y: scroll"></if rame>
6 <div style="width:100%; height:700px;"></div>
7
8 <script>
9 description("Simple intersection observer test with no explicit root and target in a cross-origin iframe.");
10
11 var iframe = document.getElementById("target-iframe");
12 var actual;
13
14 function checkData(actualData, expected) {
15 actual = actualData;
16 shouldBeEqualToNumber("actual.length", expected.length);
17 for (var i = 0; i < actualData.length && i < expected.length; i++) {
18 actual = actualData[i];
19 shouldBeEqualToNumber("actual.boundingClientRect.left", expected[i].bounding ClientRect.left);
20 shouldBeEqualToNumber("actual.boundingClientRect.top", expected[i].boundingC lientRect.top);
21 shouldBeEqualToNumber("actual.boundingClientRect.right", expected[i].boundin gClientRect.right);
22 shouldBeEqualToNumber("actual.boundingClientRect.bottom", expected[i].boundi ngClientRect.bottom);
23 shouldBeEqualToNumber("actual.boundingClientRect.width", expected[i].boundin gClientRect.width);
24 shouldBeEqualToNumber("actual.boundingClientRect.height", expected[i].boundi ngClientRect.height);
25 shouldBeEqualToNumber("actual.intersectionRect.left", expected[i].intersecti onRect.left);
26 shouldBeEqualToNumber("actual.intersectionRect.top", expected[i].intersectio nRect.top);
27 shouldBeEqualToNumber("actual.intersectionRect.right", expected[i].intersect ionRect.right);
28 shouldBeEqualToNumber("actual.intersectionRect.bottom", expected[i].intersec tionRect.bottom);
29 shouldBeEqualToNumber("actual.intersectionRect.width", expected[i].intersect ionRect.width);
30 shouldBeEqualToNumber("actual.intersectionRect.height", expected[i].intersec tionRect.height);
31 if (expected[i].rootBounds == "null") {
32 shouldBe("actual.rootBounds", "null");
33 } else if (actual.rootBounds == "null") {
34 shouldNotBe("actual.rootBounds", "null");
35 } else {
36 shouldBeEqualToNumber("actual.rootBounds.left", expected[i].rootBounds.lef t);
37 shouldBeEqualToNumber("actual.rootBounds.top", expected[i].rootBounds.top) ;
38 shouldBeEqualToNumber("actual.rootBounds.right", expected[i].rootBounds.ri ght);
39 shouldBeEqualToNumber("actual.rootBounds.bottom", expected[i].rootBounds.b ottom);
40 shouldBeEqualToNumber("actual.rootBounds.width", expected[i].rootBounds.wi dth);
41 shouldBeEqualToNumber("actual.rootBounds.height", expected[i].rootBounds.h eight);
42 }
43 shouldBeEqualToString("actual.target", expected[i].target);
44 }
45 }
46
47 function handleMessage(event) {
48 if (event.data.hasOwnProperty('scrollTo')) {
49 document.scrollingElement.scrollTop = event.data.scrollTo;
50 waitForNotification(() => { iframe.contentWindow.postMessage("", "*") });
51 } else if (event.data.hasOwnProperty('actual')) {
52 checkData(event.data.actual, event.data.expected);
53 } else if (event.data.hasOwnProperty('DONE')) {
54 finishJSTest();
55 document.scrollingElement.scrollTop = 0;
56 } else {
57 waitForNotification(() => { iframe.contentWindow.postMessage("", "*") });
58 }
59 }
60
61 window.addEventListener("message", handleMessage);
62
63 iframe.onload = (() => {
64 waitForNotification(() => { iframe.contentWindow.postMessage("", "*") });
65 });
66 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/intersection-observer/iframe-cross-origin-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698