45e8c53691a414fe71d7916e0d5b533789f3c79d
[WebKit-https.git] / PerformanceTests / StyleBench / resources / tests.js
1 function makeSteps(count)
2 {
3     const steps = [];
4     for (i = 1; i <= count; ++i) {
5         steps.push(new BenchmarkTestStep(`Adding classes - ${i}`, (bench, contentWindow, contentDocument) => {
6             bench.addClasses(25);
7         }));
8         steps.push(new BenchmarkTestStep(`Removing classes - ${i}`, (bench, contentWindow, contentDocument) => {
9             bench.removeClasses(25);
10         }));
11         steps.push(new BenchmarkTestStep(`Adding leaf elements - ${i}`, (bench, contentWindow, contentDocument) => {
12             bench.addLeafElements(25);
13         }));
14         steps.push(new BenchmarkTestStep(`Removing leaf elements - ${i}`, (bench, contentWindow, contentDocument) => {
15             bench.removeLeafElements(25);
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(10),
32     };
33 }
34
35 var Suites = [];
36 for (const configuration of StyleBench.predefinedConfigurations())
37     Suites.push(makeSuite(configuration));