<!DOCTYPE html>
<html>
<body>
<script src="../resources/runner.js"></script>
<p id="testElement" spellcheck=false style="height:90vh"></p>
<script>
var isDone = false;
var startTime;
function randomString() {
return '' + Math.floor(1000000 * Math.random());
}
function runTest() {
if (startTime) {
PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
PerfTestRunner.addRunTestEndMarker();
}
if (!isDone) {
PerfTestRunner.addRunTestStartMarker();
startTime = PerfTestRunner.now();
// Fill the paragraph with 200 lines of text with <br> elements
// in-between.
setTimeout(() => {
var testElement = document.getElementById('testElement');
var html = '';
for (var i = 0; i < 200; i++) {
html += randomString() + ' ' + randomString() + '<br>';
}
testElement.innerHTML = html;
}, 0);
// Wait to allow the asynchronous accessibility code that's
// covered by traceEventsToMeasure to have a chance to run.
setTimeout(runTest, 2500);
}
}
PerfTestRunner.startMeasureValuesAsync({
description: 'Test accessibility performance of many line breaks in one paragraph.',
unit: 'ms',
done: function () {
isDone = true;
},
run: function() {
runTest();
},
iterationCount: 6,
tracingCategories: 'accessibility',
traceEventsToMeasure: [
'TotalAccessibilityCleanLayoutLifecycleStages',
'ProcessDeferredUpdatesLifecycleStage',
'FinalizingTreeLifecycleStage',
'SerializeLifecycleStage',
'RenderAccessibilityImpl::SendPendingAccessibilityEvents',
'BrowserAccessibilityManager::OnAccessibilityEvents',
'SerializeLocationChanges',
"BrowserAccessibilityManager::OnLocationChanges"
]
});
</script>
</html>