Regression(r188105): Seems to have caused crashes during PLT on some iPads
[WebKit-https.git] / LayoutTests / fast / css / device-aspect-ratio.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head id="myhead">
4 <script src="../../resources/js-test-pre.js"></script>
5 <script>
6 if (window.testRunner) {
7     window.testRunner.waitUntilDone();
8 }
9
10 var count = 0;
11 var maxCount = 10;
12 var timeout = 100;
13
14 function doTest()
15 {
16     var headElement = document.getElementById("myhead");
17     var linkElement = document.createElement("link");
18     linkElement.rel = "stylesheet";
19     linkElement.media = "screen and (device-aspect-ratio: " + screen.width + "/" + screen.height + ")";
20     linkElement.href = "resources/device-aspect-ratio.css";
21     headElement.appendChild(linkElement);
22     description("This text is green if the device-aspect-ratio media query works properly.");
23     setTimeout("waitForStylesheetLoad()", timeout);
24 }
25
26 function waitForStylesheetLoad()
27 {
28     count++;
29
30     if (document.defaultView.getComputedStyle(document.getElementById('description'), null).color == "rgb(0, 128, 0)") {
31         shouldBe("document.defaultView.getComputedStyle(document.getElementById('description'), null).color", "'rgb(0, 128, 0)'");
32         isSuccessfullyParsed();
33         if (window.testRunner) {
34             window.testRunner.notifyDone();
35         }
36         return;
37     }
38
39     if (count > maxCount) {
40         testFailed("Stylesheet did not load in " + (maxCount * timeout / 1000) + " second(s).");
41         return;
42     }
43
44     setTimeout("waitForStylesheetLoad()", timeout);
45 }
46 </script>
47 </head>
48 <body onload="doTest()">
49 </body>
50 </html>