OLD | NEW |
(Empty) | |
| 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 |
| 3 // jazz until the actual test code is finished. |
| 4 setPrintTestResultsLazily(); |
| 5 var delayDescription = description; |
| 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 |
| 14 function rectToString(rect) { |
| 15 return "[" + rect.left + ", " + rect.right + ", " + rect.top + ", " + rect.bot
tom + "]"; |
| 16 } |
| 17 |
| 18 function entryToString(entry) { |
| 19 var ratio = ((entry.intersectionRect.width * entry.intersectionRect.height) / |
| 20 (entry.boundingClientRect.width * entry.boundingClientRect.height
)); |
| 21 return ( |
| 22 "boundingClientRect=" + rectToString(entry.boundingClientRect) + "\n" + |
| 23 "intersectionRect=" + rectToString(entry.intersectionRect) + "\n" + |
| 24 "visibleRatio=" + ratio + "\n" + |
| 25 "rootBounds=" + rectToString(entry.rootBounds) + "\n" + |
| 26 "target=" + entry.target + "\n" + |
| 27 "time=" + entry.time); |
| 28 } |
| 29 |
| 30 function finishTest() { |
| 31 if (descriptionString) |
| 32 delayDescription(descriptionString); |
| 33 delayIsSuccessfullyParsed(); |
| 34 finishJSTest(); |
| 35 if (window.testRunner) |
| 36 testRunner.notifyDone(); |
| 37 } |
OLD | NEW |