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

Unified Diff: third_party/WebKit/LayoutTests/intersection-observer/helper-functions.js

Issue 1449623002: IntersectionObserver: second cut. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Add RuntimeEnabled flags to all idl's, fix test expectations. Created 4 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/helper-functions.js
diff --git a/third_party/WebKit/LayoutTests/intersection-observer/helper-functions.js b/third_party/WebKit/LayoutTests/intersection-observer/helper-functions.js
new file mode 100644
index 0000000000000000000000000000000000000000..ba3a14aa673a7f8c310b950c4972efd8a3ca6948
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/intersection-observer/helper-functions.js
@@ -0,0 +1,37 @@
+// Some of the js-test.js boilerplate will add stuff to the top of the document early
+// enough to screw with frame offsets that are measured by the test. Delay all that
+// jazz until the actual test code is finished.
+setPrintTestResultsLazily();
+var delayDescription = description;
+var descriptionString = "";
+var delayIsSuccessfullyParsed = isSuccessfullyParsed;
+var isSuccessfullyParsed = function() {}
+var description = function(msg) { descriptionString = msg }
+
+if (window.testRunner)
+ testRunner.waitUntilDone();
+
+function rectToString(rect) {
+ return "[" + rect.left + ", " + rect.right + ", " + rect.top + ", " + rect.bottom + "]";
+}
+
+function entryToString(entry) {
+ var ratio = ((entry.intersectionRect.width * entry.intersectionRect.height) /
+ (entry.boundingClientRect.width * entry.boundingClientRect.height));
+ return (
+ "boundingClientRect=" + rectToString(entry.boundingClientRect) + "\n" +
+ "intersectionRect=" + rectToString(entry.intersectionRect) + "\n" +
+ "visibleRatio=" + ratio + "\n" +
+ "rootBounds=" + rectToString(entry.rootBounds) + "\n" +
+ "target=" + entry.target + "\n" +
+ "time=" + entry.time);
+}
+
+function finishTest() {
+ if (descriptionString)
+ delayDescription(descriptionString);
+ delayIsSuccessfullyParsed();
+ finishJSTest();
+ if (window.testRunner)
+ testRunner.notifyDone();
+}

Powered by Google App Engine
This is Rietveld 408576698