| <!DOCTYPE html> |
| <html> |
| <head> |
| <style> |
| container, leaf {display: block;} |
| </style> |
| <script src="../resources/runner.js"></script> |
| </head> |
| <body> |
| </body> |
| |
| <script> |
| |
| var isDone = false; |
| var startTime; |
| |
| function runTest() { |
| if (startTime) { |
| PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime); |
| PerfTestRunner.addRunTestEndMarker(); |
| } |
| if (!isDone) { |
| PerfTestRunner.addRunTestStartMarker(); |
| startTime = PerfTestRunner.now(); |
| |
| document.body.innerHTML = ''; |
| appendManyElements(document.body, 6); // Create tree 6 levels deep. |
| |
| setTimeout(changeLeafText, 250); |
| |
| // Re-run the same test. |
| // Wait to allow the asynchronous accessibility code that's |
| // covered by traceEventsToMeasure to have a chance to run. |
| setTimeout(runTest, 2500); |
| } |
| } |
| |
| // Recursively add layers of descendants. |
| function appendManyElements(start, depth) { |
| if (depth == 0) { |
| start.innerHTML = '<leaf>A</leaf>'; |
| } |
| else { |
| // Each element receives 3 new children. |
| for (let count = 0; count < 3; count++) { |
| let newContainer = document.createElement('container'); |
| appendManyElements(start.appendChild(newContainer), depth - 1); |
| } |
| } |
| } |
| |
| function changeLeafText(text) { |
| let elements = document.querySelectorAll('leaf'); |
| let count = 0; |
| function changeSome() { |
| const end = Math.min(count + 100, elements.length); |
| for (; count < end; count ++) |
| elements[count].textContent = 'B'; |
| setTimeout(changeSome, 0); |
| } |
| |
| setTimeout(changeSome, 0); |
| } |
| |
| |
| PerfTestRunner.startMeasureValuesAsync({ |
| description: 'Test accessibility performance when changing text inside ignored blocks, with delay between each change.', |
| unit: 'ms', |
| done: function () { |
| isDone = true; |
| }, |
| run: function() { |
| runTest(); |
| }, |
| iterationCount: 6, |
| tracingCategories: 'accessibility', |
| traceEventsToMeasure: [ |
| // Measuring 'AXObjectCacheImpl::ChildrenChanged(LayoutObject)' |
| // can lead to this test timing out. |
| 'ProcessDeferredAccessibilityEvents', |
| 'RenderAccessibilityImpl::SendPendingAccessibilityEvents' |
| ] |
| }); |
| </script> |
| |
| </html> |