Chromium Code Reviews| 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 if (window.setPrintTestResultsLazily) | |
| 5 setPrintTestResultsLazily(); | |
| 6 var delayDescription = description || null; | |
| 7 var descriptionString = ""; | |
| 8 var delayIsSuccessfullyParsed = isSuccessfullyParsed || null; | |
| 9 var isSuccessfullyParsed = function() {} | |
| 10 var description = function(msg) { descriptionString = msg } | |
|
ojan
2016/01/21 23:56:43
I don't think you need to do all this monkey patch
szager1
2016/01/22 00:23:39
I tried that; didn't work :)
| |
| 11 | |
| 12 if (window.testRunner) | |
| 13 testRunner.waitUntilDone(); | |
| 14 | |
| 15 function clientRectToJson(rect) { | |
| 16 if (!rect) | |
| 17 return null; | |
| 18 return { | |
| 19 top: rect.top, | |
| 20 right: rect.right, | |
| 21 bottom: rect.bottom, | |
| 22 left: rect.left, | |
| 23 width: rect.width, | |
| 24 height: rect.height | |
| 25 }; | |
| 26 } | |
| 27 | |
| 28 function coordinatesToClientRectJson(top, right, bottom, left) { | |
| 29 return { | |
| 30 top: top, | |
| 31 right: right, | |
| 32 bottom: bottom, | |
| 33 left: left, | |
| 34 width: right - left, | |
| 35 height: bottom - top | |
| 36 }; | |
| 37 } | |
| 38 | |
| 39 function entryToJson(entry) { | |
| 40 return { | |
| 41 boundingClientRect: clientRectToJson(entry.boundingClientRect), | |
| 42 intersectionRect: clientRectToJson(entry.intersectionRect), | |
| 43 rootBounds: clientRectToJson(entry.rootBounds), | |
| 44 time: entry.time, | |
| 45 target: entry.target.id | |
| 46 }; | |
| 47 } | |
| 48 | |
| 49 function finishTest() { | |
| 50 if (descriptionString) | |
| 51 delayDescription(descriptionString); | |
| 52 delayIsSuccessfullyParsed(); | |
| 53 finishJSTest(); | |
| 54 if (window.testRunner) | |
| 55 testRunner.notifyDone(); | |
| 56 } | |
| OLD | NEW |