Bug 1188487 - Tests for BrowserElement mute / set volume. r=fabrice

This commit is contained in:
Brian R. Bondy 2015-07-31 13:21:25 -04:00
parent a5d6ef7cd4
commit 8b7c257d54

View File

@ -18,6 +18,12 @@ function noaudio() {
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_empty.html';
function noaudio_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, 1, "1 audio channel by default");
@ -40,6 +46,42 @@ function noaudio() {
}
})
.then(function() {
return new Promise(function(resolve) {
iframe.mute();
iframe.getMuted()
.then(result => is(result, true, "iframe.getMuted should be true."))
.then(resolve);
});
})
.then(function() {
return new Promise(function(resolve) {
iframe.unmute();
iframe.getMuted()
.then(result => is(result, false, "iframe.getMuted should be false."))
.then(resolve);
});
})
.then(function() {
return new Promise(function(resolve) {
iframe.setVolume(0);
iframe.getVolume()
.then(result => is(result, 0, "iframe.getVolume should be 0."))
.then(resolve);
});
})
.then(function() {
return new Promise(function(resolve) {
iframe.setVolume(1);
iframe.getVolume()
.then(result => is(result, 1, "iframe.getVolume should be 1."))
.then(resolve);
});
})
.then(function() {
return new Promise(function(r, rr) {
ac.getMuted().onsuccess = function(e) {
@ -109,6 +151,12 @@ function audio() {
iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/iframe_file_audio.html';
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, 1, "1 audio channel by default");