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

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

Issue 1648123004: Fix lazy test result printing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 4 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
OLDNEW
1 // Some of the js-test.js boilerplate will add stuff to the top of the document early 1 // Some of the js-test.js boilerplate will add stuff to the top of the document early
2 // enough to screw with frame offsets that are measured by the test. Delay all that 2 // enough to screw with frame offsets that are measured by the test. Delay all that
3 // jazz until the actual test code is finished. 3 // jazz until the actual test code is finished.
4 setPrintTestResultsLazily(); 4 setPrintTestResultsLazily();
5 var delayDescription = description; 5 self.jsTestIsAsync = true;
6 var descriptionString = "";
7 var delayIsSuccessfullyParsed = isSuccessfullyParsed;
8 var isSuccessfullyParsed = function() {}
9 var description = function(msg) { descriptionString = msg }
10
11 if (window.testRunner)
12 testRunner.waitUntilDone();
13 6
14 function rectToString(rect) { 7 function rectToString(rect) {
15 return "[" + rect.left + ", " + rect.right + ", " + rect.top + ", " + rect.bot tom + "]"; 8 return "[" + rect.left + ", " + rect.right + ", " + rect.top + ", " + rect.bot tom + "]";
16 } 9 }
17 10
18 function entryToString(entry) { 11 function entryToString(entry) {
19 var ratio = ((entry.intersectionRect.width * entry.intersectionRect.height) / 12 var ratio = ((entry.intersectionRect.width * entry.intersectionRect.height) /
20 (entry.boundingClientRect.width * entry.boundingClientRect.height )); 13 (entry.boundingClientRect.width * entry.boundingClientRect.height ));
21 return ( 14 return (
22 "boundingClientRect=" + rectToString(entry.boundingClientRect) + "\n" + 15 "boundingClientRect=" + rectToString(entry.boundingClientRect) + "\n" +
23 "intersectionRect=" + rectToString(entry.intersectionRect) + "\n" + 16 "intersectionRect=" + rectToString(entry.intersectionRect) + "\n" +
24 "visibleRatio=" + ratio + "\n" + 17 "visibleRatio=" + ratio + "\n" +
25 "rootBounds=" + rectToString(entry.rootBounds) + "\n" + 18 "rootBounds=" + rectToString(entry.rootBounds) + "\n" +
26 "target=" + entry.target + "\n" + 19 "target=" + entry.target + "\n" +
27 "time=" + entry.time); 20 "time=" + entry.time);
28 } 21 }
29
30 function finishTest() {
31 if (descriptionString)
32 delayDescription(descriptionString);
33 delayIsSuccessfullyParsed();
34 finishJSTest();
35 if (window.testRunner)
36 testRunner.notifyDone();
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698