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