| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head id="myhead"> |
| <link rel="stylesheet" href="../js/resources/js-test-style.css"> |
| <script src="../js/resources/js-test-pre.js"></script> |
| <script src="../js/resources/js-test-post-function.js"></script> |
| <script> |
| if (window.layoutTestController) { |
| window.layoutTestController.waitUntilDone(); |
| } |
| |
| var count = 0; |
| var maxCount = 10; |
| var timeout = 100; |
| |
| function doTest() |
| { |
| var headElement = document.getElementById("myhead"); |
| var linkElement = document.createElement("link"); |
| linkElement.rel = "stylesheet"; |
| linkElement.media = "screen and (device-aspect-ratio: " + screen.width + "/" + screen.height + ")"; |
| linkElement.href = "resources/device-aspect-ratio.css"; |
| headElement.appendChild(linkElement); |
| description("This text is green if the device-aspect-ratio media query works properly."); |
| setTimeout("waitForStylesheetLoad()", timeout); |
| } |
| |
| function waitForStylesheetLoad() |
| { |
| count++; |
| |
| if (document.defaultView.getComputedStyle(document.getElementById('description'), null).color == "rgb(0, 128, 0)") { |
| shouldBe("document.defaultView.getComputedStyle(document.getElementById('description'), null).color", "'rgb(0, 128, 0)'"); |
| window.successfullyParsed = true; |
| isSuccessfullyParsed(); |
| if (window.layoutTestController) { |
| window.layoutTestController.notifyDone(); |
| } |
| return; |
| } |
| |
| if (count > maxCount) { |
| testFailed("Stylesheet did not load in " + (maxCount * timeout / 1000) + " second(s)."); |
| return; |
| } |
| |
| setTimeout("waitForStylesheetLoad()", timeout); |
| } |
| </script> |
| </head> |
| <body onload="doTest()"> |
| <p id="description"></p> |
| <div id="console"></div> |
| </body> |
| </html> |