blob: 4a12af16de92bc429a087850dcd769914a07cf96 [file] [log] [blame]
<body>
<script src="../resources/magnitude-perf.js"></script>
<script>
document.designMode = 'on';
function placeSelectionAfterFirstBr()
{
var children = document.body.childNodes;
for (var i = 0, len = children.length; i < len; i++) {
if (children[i].localName == 'br') {
window.getSelection().setBaseAndExtent(document.body, i, document.body, i);
return;
}
}
}
function setupFunction(magnitude)
{
window.getSelection().collapse(); // else setting slow: crbug.com/139552
document.body.innerHTML = new Array(magnitude + 1).join('a<br>');
placeSelectionAfterFirstBr();
}
function test(magnitude)
{
if (window.eventSender)
eventSender.keyDown('z');
}
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.");
Magnitude.numTrials = 5; // a bit noisy
Magnitude.successThreshold = 0.40; // 2 out of 5
Magnitude.initialExponent = 10;
Magnitude.numPoints = 4;
Magnitude.tolerance = 0.30;
Magnitude.trim = 1;
Magnitude.run(setupFunction, test, Magnitude.LINEAR);
</script>
</body>