| OLD | NEW |
| (Empty) |
| 1 <body> | |
| 2 <script src="../resources/magnitude-perf.js"></script> | |
| 3 <script> | |
| 4 document.designMode = 'on'; | |
| 5 | |
| 6 function placeSelectionAfterFirstBr() | |
| 7 { | |
| 8 var children = document.body.childNodes; | |
| 9 for (var i = 0, len = children.length; i < len; i++) { | |
| 10 if (children[i].localName == 'br') { | |
| 11 window.getSelection().setBaseAndExtent(document.body, i, document.bo
dy, i); | |
| 12 return; | |
| 13 } | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 function setupFunction(magnitude) | |
| 18 { | |
| 19 window.getSelection().collapse(); // else setting slow: crbug.com/139552 | |
| 20 document.body.innerHTML = new Array(magnitude + 1).join('a<br>'); | |
| 21 placeSelectionAfterFirstBr(); | |
| 22 } | |
| 23 | |
| 24 function test(magnitude) | |
| 25 { | |
| 26 if (window.eventSender) | |
| 27 eventSender.keyDown('z'); | |
| 28 } | |
| 29 | |
| 30 Magnitude.description("Tests that typing at the end of a line in innerHTML where
the line-breaks are all BRs is linear in the number of lines."); | |
| 31 Magnitude.numTrials = 5; // a bit noisy | |
| 32 Magnitude.successThreshold = 0.40; // 2 out of 5 | |
| 33 Magnitude.initialExponent = 10; | |
| 34 Magnitude.numPoints = 4; | |
| 35 Magnitude.tolerance = 0.30; | |
| 36 Magnitude.trim = 1; | |
| 37 Magnitude.run(setupFunction, test, Magnitude.LINEAR); | |
| 38 </script> | |
| 39 </body> | |
| OLD | NEW |