Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / screen-size-in-physical-pixels-quirk.html
blob03771e2cdd234331d2949a52ae18ff16472ffb56
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("This test verifies behavior of the ReportScreenSizeInPhysicalPixelsQuirk setting.");
10 if (window.internals)
11 window.internals.setDeviceScaleFactor(2);
12 else
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",
20 "screenX", "screenY"
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);
29 if (window.internals)
30 window.internals.settings.setReportScreenSizeInPhysicalPixelsQuirk(true);
31 else
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]);
39 else
40 testFailed(actualValues[i] + " is not " + expectedValues[i] + " for " + allInputs[i]);
43 function getWindowValues(inputs) {
44 var result = [];
45 for (var i = 0; i < inputs.length; ++i)
46 result[i] = eval("window." + inputs[i]);
47 return result;
49 </script>
50 </body>
51 </html>