summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/media/mq-with-screen-size-in-physical-pixels-quirk.html
blob: d85c8880361a14d6781096529f3ed0bc75fed3ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!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)
        window.testRunner.setBackingScaleFactor(2, function() {});
    else
        debug("WARN: This test depends on availability of window.testRunner.");

    // Hide the actual screen dimensions from the test output.
    deviceWidthIsSameAsScreenWidth = matchMedia("screen and (device-width:" + screen.width + "px)").matches;
    deviceHeightIsSameAsScreenHeight = matchMedia("screen and (device-height:" + screen.height + "px)").matches;
    shouldBeTrue("deviceWidthIsSameAsScreenWidth");
    shouldBeTrue("deviceHeightIsSameAsScreenHeight");

    if (window.internals)
        window.internals.settings.setReportScreenSizeInPhysicalPixelsQuirk(true);
    else
        debug("WARN: This test depends on the ReportScreenSizeInPhysicalPixelsQuirk setting to be true.");

    // screen.width and .height will be scaled by the scale factor (tested independently).
    deviceWidthIsSameAsScreenWidth = matchMedia("screen and (device-width:" + screen.width + "px)").matches;
    deviceHeightIsSameAsScreenHeight = matchMedia("screen and (device-height:" + screen.height + "px)").matches;
    shouldBeTrue("deviceWidthIsSameAsScreenWidth");
    shouldBeTrue("deviceHeightIsSameAsScreenHeight");
</script>
</body>
</html>