| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <script> |
| description("This test verifies behavior of the ReportScreenSizeInPhysicalPixelsQuirk setting."); |
| |
| if (window.testRunner) |
| testRunner.setBackingScaleFactor(2, function() {}); |
| else |
| debug("WARN: This test depends on availability of window.testRunner."); |
| |
| var scalableInputs = [ |
| "screen.width", "screen.height", |
| "screen.availWidth", "screen.availHeight", |
| "screen.availLeft", "screen.availTop", |
| "outerWidth", "outerHeight", |
| "screenX", "screenY" |
| ]; |
| var unscalableInputs = [ "innerWidth", "innerHeight" ]; |
| |
| var initialScalableValues = getWindowValues(scalableInputs); |
| var initialUnscalableValues = getWindowValues(unscalableInputs); |
| var expectedValues = initialScalableValues.map(function(x) { return x * window.devicePixelRatio; }); |
| expectedValues = expectedValues.concat(initialUnscalableValues); |
| |
| if (window.internals) |
| internals.settings.setReportScreenSizeInPhysicalPixelsQuirk(true); |
| else |
| debug("WARN: This test depends on the ReportScreenSizeInPhysicalPixelsQuirk setting to be true."); |
| |
| var actualValues = getWindowValues(scalableInputs).concat(getWindowValues(unscalableInputs)); |
| var allInputs = scalableInputs.concat(unscalableInputs); |
| for (var i = 0; i < allInputs.length; ++i) { |
| if (expectedValues[i] == actualValues[i]) |
| testPassed(allInputs[i]); |
| else |
| testFailed(actualValues[i] + " is not " + expectedValues[i] + " for " + allInputs[i]); |
| } |
| |
| function getWindowValues(inputs) { |
| var result = []; |
| for (var i = 0; i < inputs.length; ++i) |
| result[i] = eval("window." + inputs[i]); |
| return result; |
| } |
| </script> |
| </body> |
| </html> |