Make StyleBench compatible with run-benchmark and run-perf-tests
[WebKit-https.git] / PerformanceTests / StyleBench / resources / tests.js
1 function makeSteps(count)
2 {
3     const steps = [];
4     steps.push(new BenchmarkTestStep('Adding classes', (bench, contentWindow, contentDocument) => {
5         bench.addClasses(100);
6     }));
7     steps.push(new BenchmarkTestStep('Removing classes', (bench, contentWindow, contentDocument) => {
8         bench.removeClasses(100);
9     }));
10     steps.push(new BenchmarkTestStep('Adding leaf elements', (bench, contentWindow, contentDocument) => {
11         bench.addLeafElements(100);
12     }));
13     steps.push(new BenchmarkTestStep('Removing leaf elements', (bench, contentWindow, contentDocument) => {
14         bench.removeLeafElements(100);
15     }));
16     return steps;
17 }
18
19 function makeSuite(configuration)
20 {
21     return {
22         name: configuration.name,
23         url: 'style-bench.html',
24         prepare: (runner, contentWindow, contentDocument) => {
25             return runner.waitForElement('#testroot').then((element) => {
26                 return contentWindow.createBenchmark(configuration);
27             });
28         },
29         tests: makeSteps(),
30     };
31 }
32
33 var Suites = [];
34 for (const configuration of StyleBench.predefinedConfigurations())
35     Suites.push(makeSuite(configuration));