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 /dom/html/test/file_mozaudiochannel.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 'dom/html/test/file_mozaudiochannel.html')
-rw-r--r-- | dom/html/test/file_mozaudiochannel.html | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/dom/html/test/file_mozaudiochannel.html b/dom/html/test/file_mozaudiochannel.html new file mode 100644 index 000000000..588ae338b --- /dev/null +++ b/dom/html/test/file_mozaudiochannel.html @@ -0,0 +1,91 @@ +<!DOCTYPE HTML> +<html> +<body> +<div id="content" style="display: none"> + <audio id="audio1" /> + <audio id="audio2" mozaudiochannel="foo" /> +</div> + +<script type="application/javascript"> + +function is(a, b, msg) { + parent.postMessage({ status: a === b, msg: msg }, '*'); +} + +function ok(a, msg) { + parent.postMessage({ status: !!a, msg: msg }, '*'); +} + +function finish() { + parent.postMessage({ finish: true }, '*'); +} + +function test_basic() { + var audio1 = document.getElementById("audio1"); + ok(audio1, "Audio Element exists"); + is(audio1.mozAudioChannelType, "normal", "Default audio1 channel == 'normal'"); + try { + audio1.mozAudioChannelType = "foo"; + } catch(e) {} + is(audio1.mozAudioChannelType, "normal", "Default audio1 channel == 'normal'"); + + var audio2 = document.getElementById("audio2"); + ok(audio2, "Audio Element exists"); + is(audio2.mozAudioChannelType, "normal", "Default audio2 channel == 'normal'"); + try { + audio2.mozAudioChannelType = "foo"; + } catch(e) {} + is(audio2.mozAudioChannelType, "normal", "Default audio2 channel == 'normal'"); + + runTest(); +} + +function test_preferences(aChannel) { + SpecialPowers.pushPrefEnv({"set": [["media.defaultAudioChannel", aChannel ]]}, + function() { + var audio = document.createElement('audio'); + ok(audio, "Audio Element created"); + is(audio.mozAudioChannelType, aChannel, "Default audio channel == '" + aChannel + "'"); + runTest(); + } + ); +} + +function test_wrong_preferences() { + SpecialPowers.pushPrefEnv({"set": [["media.defaultAudioChannel", 'foobar' ]]}, + function() { + var audio = document.createElement('audio'); + ok(audio, "Audio Element created"); + is(audio.mozAudioChannelType, 'normal', "Default audio channel == 'normal'"); + runTest(); + } + ); +} +var tests = [ + test_basic, + + function() { test_preferences("content"); }, + function() { test_preferences("notification"); }, + function() { test_preferences("alarm"); }, + function() { test_preferences("telephony"); }, + function() { test_preferences("ringer"); }, + function() { test_preferences("publicnotification"); }, + + test_wrong_preferences, +]; + +function runTest() { + if (!tests.length) { + finish(); + return; + } + + var test = tests.shift(); + test(); +} + +runTest(); + +</script> +</body> +</html> |