Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / device-aspect-ratio.html
blob7cf9a11daa57e219f1b3ca7f981eaa6e9f9c0ad5
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head id="myhead">
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 if (window.testRunner) {
7 window.testRunner.waitUntilDone();
10 var count = 0;
11 var maxCount = 10;
12 var timeout = 100;
14 function doTest()
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);
26 function waitForStylesheetLoad()
28 count++;
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();
36 return;
39 if (count > maxCount) {
40 testFailed("Stylesheet did not load in " + (maxCount * timeout / 1000) + " second(s).");
41 return;
44 setTimeout("waitForStylesheetLoad()", timeout);
46 </script>
47 </head>
48 <body onload="doTest()">
49 </body>
50 </html>