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

Unified 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698