Add StyleBench
[WebKit-https.git] / PerformanceTests / StyleBench / resources / style-bench.html
1 <!doctype html>
2 <script src="style-bench.js"></script>
3 <body>
4 <div id="testroot"></div>
5 <div id="controls">
6 <select></select>
7 <button onclick="createBenchmarkFromSelect()">Initialize</button>
8 <button onclick="createBenchmarkFromSelect().runForever()">Initialize and run</button>
9 </div>
10 <script>
11 const configurations = StyleBench.predefinedConfigurations();
12
13 const select = document.querySelector("#controls select");
14 for (const configuration of configurations) {
15     const option = document.createElement("option");
16     option.innerHTML = configuration.name;
17     select.appendChild(option);
18 }
19
20 function createBenchmark(configuration)
21 {
22     controls.remove();
23
24     return new StyleBench(configuration);
25 }
26
27 function createBenchmarkFromSelect()
28 {
29     return createBenchmark(configurations[select.selectedIndex]);
30 }
31 </script>
32