mobile/android/base/tests/test_viewport.sjs

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/tests/test_viewport.sjs	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,33 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 + function decodeQuery(query) {
     1.9 +   let result = {};
    1.10 +   query.split("&").forEach(function(pair) {
    1.11 +     let [key, val] = pair.split("=");
    1.12 +     result[key] = decodeURIComponent(val);
    1.13 +   });
    1.14 +   return result;
    1.15 + }
    1.16 +
    1.17 +function handleRequest(request, response) {
    1.18 +  response.setStatusLine(request.httpVersion, 200, "OK");
    1.19 +  response.setHeader("Content-Type", "text/html", false);
    1.20 +
    1.21 +  let params = decodeQuery(request.queryString || "");
    1.22 +
    1.23 +  response.write('<html>\n' +
    1.24 +    '<head>\n' +
    1.25 +      '<title>Browser VKB Overlapping content</title>  <meta charset="utf-8">');
    1.26 +
    1.27 +  if (params.metadata)
    1.28 +    response.write("<meta name=\"viewport\" content=\"" + params.metadata + "\"/>");
    1.29 +
    1.30 +  /* Write a spacer div into the document, above an input element*/
    1.31 +  response.write('</head>\n' +
    1.32 +    '<body style="margin: 0; padding: 0">\n' +
    1.33 +      '<div style="width: 100%; height: 100%"></div>\n' +
    1.34 +      '<input type="text" style="background-color: green">\n' +
    1.35 +    '</body>\n</html>');
    1.36 +}

mercurial