summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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/browser-element/mochitest/browserElement_AudioChannel_nested.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_AudioChannel_nested.js69
1 files changed, 69 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
new file mode 100644
index 000000000..2ed432b2a
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel_nested.js
@@ -0,0 +1,69 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 1113086 - tests for AudioChannel API into BrowserElement
+
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+
+function runTests() {
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', 'true');
+
+ var listener = function(e) {
+ var message = e.detail.message;
+ if (/^OK/.exec(message)) {
+ ok(true, "Message from app: " + message);
+ } else if (/^KO/.exec(message)) {
+ ok(false, "Message from app: " + message);
+ } else if (/DONE/.exec(message)) {
+ ok(true, "Messaging from app complete");
+ iframe.removeEventListener('mozbrowsershowmodalprompt', listener);
+ SimpleTest.finish();
+ }
+ }
+
+ function audio_loadend() {
+ ok("mute" in iframe, "iframe.mute exists");
+ ok("unmute" in iframe, "iframe.unmute exists");
+ ok("getMuted" in iframe, "iframe.getMuted exists");
+ ok("getVolume" in iframe, "iframe.getVolume exists");
+ ok("setVolume" in iframe, "iframe.setVolume exists");
+
+ ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
+ var channels = iframe.allowedAudioChannels;
+ is(channels.length, 9, "9 audio channel by default");
+
+ var ac = channels[0];
+
+ ok(ac instanceof BrowserElementAudioChannel, "Correct class");
+ ok("getVolume" in ac, "ac.getVolume exists");
+ ok("setVolume" in ac, "ac.setVolume exists");
+ ok("getMuted" in ac, "ac.getMuted exists");
+ ok("setMuted" in ac, "ac.setMuted exists");
+ ok("isActive" in ac, "ac.isActive exists");
+
+ info("Setting the volume...");
+ ac.setVolume(0.5);
+
+ ac.onactivestatechanged = function() {
+ ok(true, "activestatechanged event received.");
+ ac.onactivestatechanged = null;
+ }
+ }
+
+ iframe.addEventListener('mozbrowserloadend', audio_loadend);
+ iframe.addEventListener('mozbrowsershowmodalprompt', listener, false);
+ document.body.appendChild(iframe);
+
+ iframe.src = 'chrome://mochitests/content/chrome/dom/browser-element/mochitest/file_browserElement_AudioChannel_nested.html';
+}
+
+addEventListener('testready', function() {
+ SpecialPowers.pushPrefEnv({'set': [["b2g.system_startup_url", window.location.href]]},
+ function() {
+ SimpleTest.executeSoon(runTests);
+ });
+});