diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /b2g/components/test/mochitest/test_permission_visibilitychange.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'b2g/components/test/mochitest/test_permission_visibilitychange.html')
-rw-r--r-- | b2g/components/test/mochitest/test_permission_visibilitychange.html | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/b2g/components/test/mochitest/test_permission_visibilitychange.html b/b2g/components/test/mochitest/test_permission_visibilitychange.html new file mode 100644 index 000000000..cd5694b42 --- /dev/null +++ b/b2g/components/test/mochitest/test_permission_visibilitychange.html @@ -0,0 +1,57 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=951997 +--> +<head> + <meta charset="utf-8"> + <title>Permission Prompt Test</title> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1020179">Permission prompt visibilitychange test</a> +<script type="application/javascript;version=1.8"> + +"use strict"; + +var gUrl = SimpleTest.getTestFileURL("permission_handler_chrome.js"); +var gScript = SpecialPowers.loadChromeScript(gUrl); + +function testDone() { + gScript.sendAsyncMessage("teardown", ""); + gScript.destroy(); + SimpleTest.finish(); + alert("setVisible::true"); +} + +function runTest() { + navigator.geolocation.getCurrentPosition( + function (pos) { + ok(false, "unexpected success, permission request should be canceled"); + testDone(); + }, function (err) { + ok(true, "success, permission request is canceled"); + testDone(); + }); +} + +gScript.addMessageListener("permission-request", function (detail) { + info("got permission-request!!!!\n"); + alert("setVisible::false"); +}); + +// Add permissions to this app. We use ALLOW_ACTION here. The ContentPermissionPrompt +// should prompt for permission, not allow it without prompt. +SpecialPowers.pushPrefEnv({"set": [["media.navigator.permission.disabled", false]]}, + function() { + SpecialPowers.addPermission("geolocation", + SpecialPowers.Ci.nsIPermissionManager.PROMPT_ACTION, document); + runTest(); + }); + +SimpleTest.waitForExplicitFinish(); +</script> +</pre> +</body> +</html> |