diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:25:10 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-03 06:25:10 -0500 |
commit | 8b8c65072aedef94610748ce92c2ed3a19fd5517 (patch) | |
tree | 8614d386acf5db7a77b08d19a5854a7d75dab015 /b2g/components/test/mochitest/test_permission_deny.html | |
parent | 8c3a46bd13a0660a3ff1e0379dbf515873a852d2 (diff) | |
download | UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.gz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.lz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.tar.xz UXP-8b8c65072aedef94610748ce92c2ed3a19fd5517.zip |
Purge b2g/
Diffstat (limited to 'b2g/components/test/mochitest/test_permission_deny.html')
-rw-r--r-- | b2g/components/test/mochitest/test_permission_deny.html | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/b2g/components/test/mochitest/test_permission_deny.html b/b2g/components/test/mochitest/test_permission_deny.html deleted file mode 100644 index 29c35bdec..000000000 --- a/b2g/components/test/mochitest/test_permission_deny.html +++ /dev/null @@ -1,83 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=981113 ---> -<head> - <meta charset="utf-8"> - <title>Permission Deny 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=981113">Test Permission Deny</a> -<script type="application/javascript;version=1.8"> - -'use strict'; - -SimpleTest.waitForExplicitFinish(); - -const PROMPT_ACTION = SpecialPowers.Ci.nsIPermissionManager.PROMPT_ACTION; - -var gUrl = SimpleTest.getTestFileURL('permission_handler_chrome.js'); -var gScript = SpecialPowers.loadChromeScript(gUrl); -var gTests = [ - { - 'video': true, - }, - { - 'audio': true, - 'video': true, - }, - { - 'audio': true, - }, -]; - -function runNext() { - if (gTests.length > 0) { - // Put the requested permission in query string - let requestedType = gTests.shift(); - info('getUserMedia for ' + JSON.stringify(requestedType)); - navigator.mozGetUserMedia(requestedType, function success() { - ok(false, 'unexpected success, permission request should be denied'); - runNext(); - }, function failure(err) { - is(err.name, 'SecurityError', 'expected permission denied'); - runNext(); - }); - } else { - info('test finished, teardown'); - gScript.sendAsyncMessage('teardown', ''); - gScript.destroy(); - SimpleTest.finish(); - } -} - -gScript.addMessageListener('permission-request', function(detail) { - let response = { - id: detail.id, - type: 'permission-deny', - remember: false, - }; - gScript.sendAsyncMessage('permission-response', response); -}); - -// Need to change camera permission from ALLOW to PROMPT, otherwise -// MediaManager will automatically allow video-only gUM request. -SpecialPowers.pushPermissions([ - {type: 'video-capture', allow: PROMPT_ACTION, context: document}, - {type: 'audio-capture', allow: PROMPT_ACTION, context: document}, - {type: 'camera', allow: PROMPT_ACTION, context: document}, - ], function() { - SpecialPowers.pushPrefEnv({ - 'set': [ - ['media.navigator.permission.disabled', false], - ] - }, runNext); - } -); -</script> -</pre> -</body> -</html> |