content/base/test/test_meta_viewport5.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/content/base/test/test_meta_viewport5.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<head>
     1.7 +  <meta charset="utf-8">
     1.8 +  <title>meta viewport test</title>
     1.9 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.10 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.11 +  <meta name="viewport" content="user-scalable=NO">
    1.12 +  <script src="viewport_helpers.js"></script>
    1.13 +</head>
    1.14 +<body>
    1.15 +  <p>user-scalable=NO</p>
    1.16 +  <script type="application/javascript;version=1.7">
    1.17 +    "use strict";
    1.18 +
    1.19 +    SimpleTest.waitForExplicitFinish();
    1.20 +
    1.21 +    let tests = [];
    1.22 +
    1.23 +    tests.push(function test1() {
    1.24 +      let info = getViewportInfo(800, 480);
    1.25 +      is(info.allowZoom, true, "user-scalable values are case-sensitive; 'NO' is not valid");
    1.26 +
    1.27 +      nextTest();
    1.28 +    });
    1.29 +
    1.30 +    function getViewportInfo(aDisplayWidth, aDisplayHeight) {
    1.31 +      let defaultZoom = {}, allowZoom = {}, minZoom = {}, maxZoom = {},
    1.32 +          width = {}, height = {}, autoSize = {};
    1.33 +
    1.34 +      let cwu = SpecialPowers.getDOMWindowUtils(window);
    1.35 +      cwu.getViewportInfo(aDisplayWidth, aDisplayHeight, defaultZoom, allowZoom,
    1.36 +                          minZoom, maxZoom, width, height, autoSize);
    1.37 +      return {
    1.38 +        defaultZoom: defaultZoom.value,
    1.39 +        minZoom: minZoom.value,
    1.40 +        maxZoom: maxZoom.value,
    1.41 +        width: width.value,
    1.42 +        height: height.value,
    1.43 +        autoSize: autoSize.value,
    1.44 +        allowZoom: allowZoom.value
    1.45 +      };
    1.46 +    }
    1.47 +
    1.48 +    function nextTest() {
    1.49 +      if (tests.length)
    1.50 +        (tests.shift())();
    1.51 +      else
    1.52 +        SimpleTest.finish();
    1.53 +    }
    1.54 +    addEventListener("load", nextTest);
    1.55 +  </script>
    1.56 +</body>
    1.57 +</html>

mercurial