gecko/dom/audiochannel/tests/test_telephonyPolicy.html
Andrea Marchesini 75b6d5042c Bug 1016277 - Telephony AudioChannel policy: LIFO r=mchen
--HG--
rename : dom/base/test/audio.ogg => dom/audiochannel/tests/audio.ogg
2014-07-10 15:06:23 +02:00

86 lines
2.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test the Telephony Channel Policy</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="container"></div>
<script type="application/javascript;version=1.7">
function mainApp() {
var audio = new Audio();
audio.mozAudioChannelType = 'telephony';
audio.src = "audio.ogg";
audio.loop = true;
audio.play();
audio.addEventListener('mozinterruptbegin', function() {
ok(true, "This element has been muted!");
}, false);
audio.addEventListener('mozinterruptend', function() {
ok(true, "This element has been unmuted!");
audio.pause();
runTest();
}, false);
setTimeout(runTest, 600);
}
function newApp() {
var iframe = document.createElement('iframe');
iframe.setAttribute('mozbrowser', true);
// That needs to be an app.
iframe.setAttribute('mozapp', 'https://acertified.com/manifest.webapp');
iframe.src = "file_telephonyPolicy.html";
document.body.appendChild(iframe);
}
var tests = [
// Permissions
function() {
SpecialPowers.pushPermissions(
[{ "type": "browser", "allow": 1, "context": document },
{ "type": "embed-apps", "allow": 1, "context": document },
{ "type": "webapps-manage", "allow": 1, "context": document },
{ "type": "audio-channel-telephony", "allow": 1, "context": document }], runTest);
},
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.browser_frames.oop_by_default", true],
["media.useAudioChannelService", true],
["media.defaultAudioChannel", "telephony"],
["dom.mozBrowserFramesEnabled", true],
["network.disable.ipc.security", true]]}, runTest);
},
// Run 2 apps
mainApp,
newApp,
];
function runTest() {
if (!tests.length) {
finish();
return;
}
var test = tests.shift();
test();
}
function finish() {
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
runTest();
</script>
</body>
</html>