4 <script src=
"../../../resources/js-test.js"></script>
8 description("This test verifies behavior of the ReportScreenSizeInPhysicalPixelsQuirk setting.");
11 window
.internals
.setDeviceScaleFactor(2);
13 debug("WARN: This test depends on availability of window.internals.");
15 var scalableInputs
= [
16 "screen.width", "screen.height",
17 "screen.availWidth", "screen.availHeight",
18 "screen.availLeft", "screen.availTop",
19 "outerWidth", "outerHeight",
22 var unscalableInputs
= [ "innerWidth", "innerHeight" ];
24 var initialScalableValues
= getWindowValues(scalableInputs
);
25 var initialUnscalableValues
= getWindowValues(unscalableInputs
);
26 var expectedValues
= initialScalableValues
.map(function(x
) { return x
* window
.devicePixelRatio
; });
27 expectedValues
= expectedValues
.concat(initialUnscalableValues
);
30 window
.internals
.settings
.setReportScreenSizeInPhysicalPixelsQuirk(true);
32 debug("WARN: This test depends on the ReportScreenSizeInPhysicalPixelsQuirk setting to be true.");
34 var actualValues
= getWindowValues(scalableInputs
).concat(getWindowValues(unscalableInputs
));
35 var allInputs
= scalableInputs
.concat(unscalableInputs
);
36 for (var i
= 0; i
< allInputs
.length
; ++i
) {
37 if (expectedValues
[i
] == actualValues
[i
])
38 testPassed(allInputs
[i
]);
40 testFailed(actualValues
[i
] + " is not " + expectedValues
[i
] + " for " + allInputs
[i
]);
43 function getWindowValues(inputs
) {
45 for (var i
= 0; i
< inputs
.length
; ++i
)
46 result
[i
] = eval("window." + inputs
[i
]);