1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../resources/js-test.js"></script>
6 if (window
.testRunner
) {
7 window
.testRunner
.waitUntilDone();
16 var headElement
= document
.getElementById("myhead");
17 var linkElement
= document
.createElement("link");
18 linkElement
.rel
= "stylesheet";
21 if (screen
.width
> screen
.height
) {
22 // For a landscape screen, a ratio of 1/1 will always be less than the screen (e.g., 16/9)
26 // For a portrait screen, a ratio of 1/100 should always be less than the screen (e.g., 9/16)
27 // For a square screen, a ratio of 1/100 will always be less than the screen (e.g., 9/9)
31 linkElement
.media
= "screen and (min-device-aspect-ratio: " + width
+ "/" + height
+ ")";
32 linkElement
.href
= "resources/device-aspect-ratio.css";
33 headElement
.appendChild(linkElement
);
34 description("This text is green if the min-device-aspect-ratio media query works properly.");
35 setTimeout("waitForStylesheetLoad()", timeout
);
38 function waitForStylesheetLoad()
42 if (document
.defaultView
.getComputedStyle(document
.getElementById('description'), null).color
== "rgb(0, 128, 0)") {
43 shouldBe("document.defaultView.getComputedStyle(document.getElementById('description'), null).color", "'rgb(0, 128, 0)'");
44 isSuccessfullyParsed();
45 if (window
.testRunner
) {
46 window
.testRunner
.notifyDone();
51 if (count
> maxCount
) {
52 testFailed("Stylesheet did not load in " + (maxCount
* timeout
/ 1000) + " second(s).");
56 setTimeout("waitForStylesheetLoad()", timeout
);
60 <body onload=
"doTest()">