Add a performance tests for selecting all content in a document
[WebKit-https.git] / PerformanceTests / Interactive / SelectAll.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/runner.js"></script>
5 <script>
6
7 PerfTestRunner.prepareToMeasureValuesAsync({
8     unit: 'ms',
9     done: function () {
10         var iframe = document.querySelector('iframe');
11         iframe.parentNode.removeChild(iframe);
12     }
13 });
14
15 function runTest() {
16     var iframe = document.querySelector('iframe');
17     iframe.contentWindow.getSelection().removeAllRanges();
18     iframe.contentDocument.body.offsetTop;
19
20     setTimeout(function () {
21         var startTime = PerfTestRunner.now();
22         iframe.contentDocument.execCommand('SelectAll');
23         iframe.contentDocument.body.offsetTop;
24         setTimeout(function () {
25             PerfTestRunner.measureValueAsync(PerfTestRunner.now() - startTime);
26             PerfTestRunner.gc();
27             setTimeout(runTest, 0);
28         }, 0);        
29     }, 0);
30 }
31
32 </script>
33 <iframe src="../Parser/resources/html5.html" onload="runTest()" width="800" height="600">
34 </body>
35 </html>