Add window resize benchmark
[WebKit-https.git] / PerformanceTests / Interactive / resources / window-resize.js
1 if (window.testRunner)
2     testRunner.dumpAsText();
3
4 (function() {
5     var portrait = { width: window.innerWidth, height: window.innerHeight };
6     var landscape = { width: window.innerHeight, height: window.innerWidth };
7
8     var run = function() {
9         window.resizeTo(portrait.width, portrait.height);
10         document.body.offsetTop;
11         window.resizeTo(landscape.width, landscape.height);
12         document.body.offsetTop;
13     };
14
15     function onTestDone() {
16         var logNode = document.getElementById("log");
17         logNode.parentNode.removeChild(logNode);
18         document.body.innerHTML = "";
19         document.body.appendChild(logNode);
20     };
21
22     function startTest() {
23         PerfTestRunner.runPerSecond({
24             description: "Exercising window resize and following relayout",
25             run: run,
26             done: onTestDone
27         });
28     }
29
30     document.addEventListener("DOMContentLoaded", startTest);
31 })();