dom/tests/mochitest/chrome/test_MozEnteredDomFullscreen_event.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/mochitest/chrome/test_MozEnteredDomFullscreen_event.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
     1.7 +<!--
     1.8 +  Test that "MozShowFullScreenWarning" is dispatched to chrome on restricted keypress.
     1.9 +  -->
    1.10 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="400" height="400">
    1.11 +
    1.12 +  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>      
    1.13 +
    1.14 +<script>
    1.15 +SimpleTest.waitForExplicitFinish();
    1.16 +
    1.17 +// Ensure the full-screen api is enabled, and will be disabled on test exit.
    1.18 +var gPrevEnabled = SpecialPowers.getBoolPref("full-screen-api.enabled");
    1.19 +SpecialPowers.setBoolPref("full-screen-api.enabled", true);
    1.20 +
    1.21 +var gPrevTrusted = SpecialPowers.getBoolPref("full-screen-api.allow-trusted-requests-only");
    1.22 +SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", false);
    1.23 +
    1.24 +const Cc = Components.classes;
    1.25 +const Ci = Components.interfaces;
    1.26 +
    1.27 +function make_uri(url) {
    1.28 +  var ios = Cc["@mozilla.org/network/io-service;1"].
    1.29 +            getService(Ci.nsIIOService);
    1.30 +  return ios.newURI(url, null, null);
    1.31 +}
    1.32 +
    1.33 +// Ensure "fullscreen" permissions are not present on the test URI.
    1.34 +var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
    1.35 +var uri = make_uri("http://mochi.test:8888");
    1.36 +var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
    1.37 +                  .getService(Ci.nsIScriptSecurityManager)
    1.38 +                  .getNoAppCodebasePrincipal(uri);
    1.39 +pm.removeFromPrincipal(principal, "fullscreen");
    1.40 +
    1.41 +newwindow = window.open("MozEnteredDomFullscreen_chrome.xul", "_blank","chrome,resizable=yes,width=400,height=400");
    1.42 +
    1.43 +function done()
    1.44 +{
    1.45 +  newwindow.close();
    1.46 +  SpecialPowers.setBoolPref("full-screen-api.enabled", gPrevEnabled);
    1.47 +  SpecialPowers.setBoolPref("full-screen-api.allow-trusted-requests-only", gPrevTrusted);
    1.48 +  SimpleTest.finish();
    1.49 +}
    1.50 +
    1.51 +</script>
    1.52 +
    1.53 +<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
    1.54 +
    1.55 +</window>

mercurial