Bug 1235535 - part1 : remove muted-by-default test. r=baku.
--- a/dom/browser-element/mochitest/browserElement_AudioChannel.js
+++ b/dom/browser-element/mochitest/browserElement_AudioChannel.js
@@ -177,70 +177,17 @@ function audio() {
runTests();
}
}
iframe.addEventListener('mozbrowserloadend', audio_loadend);
document.body.appendChild(iframe);
}
-function audioMutedByDefault() {
- info("Test : audio-muted-by-default");
- SpecialPowers.pushPrefEnv(
- {'set': [["dom.audiochannel.mutedByDefault", true]]}, function () {
- var iframe = document.createElement('iframe');
- iframe.setAttribute('mozbrowser', 'true');
- iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp');
- iframe.src = 'http://example.org/tests/dom/browser-element/mochitest/file_processingAudioSample.html';
-
- function audio_loadend_MutedByDefault() {
- ok("allowedAudioChannels" in iframe, "allowedAudioChannels exist");
- var channels = iframe.allowedAudioChannels;
- is(channels.length, 1, "1 audio channel by default");
-
- var ac = channels[0];
-
- ok(ac instanceof BrowserElementAudioChannel, "Correct class");
- ok("getMuted" in ac, "ac.getMuted exists");
- ok("setMuted" in ac, "ac.setMuted exists");
-
- ac.onactivestatechanged = function() {
- ok(true, "activestatechanged event received.");
- ac.onactivestatechanged = null;
-
- new Promise(function(r, rr) {
- ac.getMuted().onsuccess = function(e) {
- is(e.target.result, true, "Muted channel by default");
- r();
- }
- })
- .then(function() {
- ac.setMuted(false).onsuccess = function(e) {
- ok(true, "Unmuted the channel.");
- }
- })
- }
-
- var complete = false;
- iframe.addEventListener("mozbrowsershowmodalprompt", function (e) {
- is(e.detail.message, "playback-success", "Audio playback success!");
- if (!complete) {
- document.body.removeChild(iframe);
- SpecialPowers.popPrefEnv(runTests);
- complete = true;
- }
- });
- }
-
- iframe.addEventListener('mozbrowserloadend', audio_loadend_MutedByDefault);
- document.body.appendChild(iframe);
- });
-}
-
-var tests = [ noaudio, audio, audioMutedByDefault ];
+var tests = [ noaudio, audio ];
function runTests() {
if (tests.length == 0) {
SimpleTest.finish();
return;
}
var test = tests.shift();
deleted file mode 100644
--- a/dom/browser-element/mochitest/file_processingAudioSample.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<html>
-<body>
-<script>
-var audio = new Audio("audio.ogg");
-var context = new AudioContext();
-var node = context.createMediaElementSource(audio);
-var sp = context.createScriptProcessor(2048, 1);
-node.connect(sp);
-var expectedSamplesCount;
-var nonzeroSamplesCount = 0;
-var complete = false;
-var iterationCount = 0;
-
-function processSamples(e) {
- if (complete) {
- return;
- }
-
- // Start playing the audio until the AudioContext is connected and running.
- if (iterationCount++ == 0) {
- audio.play();
- }
-
- var buf = e.inputBuffer.getChannelData(0);
- for (var i = 0; i < buf.length; ++i) {
- if (buf[i] != 0) {
- nonzeroSamplesCount++;
- }
- }
-
- if (nonzeroSamplesCount >= expectedSamplesCount && !complete) {
- alert("playback-success");
- complete = true;
- }
-}
-
-audio.oncanplaythrough = function() {
- var testDuration = audio.duration > 2.0 ? 2.0 : audio.duration;
- expectedSamplesCount = Math.floor(testDuration * context.sampleRate) ;
- sp.onaudioprocess = processSamples;
-};
-
-</script>
-</body>
-</html>
--- a/dom/browser-element/mochitest/mochitest.ini
+++ b/dom/browser-element/mochitest/mochitest.ini
@@ -138,17 +138,16 @@ support-files =
file_microformats.html
file_post_request.html
file_wyciwyg.html
file_audio.html
iframe_file_audio.html
file_web_manifest.html
file_web_manifest.json
file_illegal_web_manifest.html
- file_processingAudioSample.html
noaudio.webm
# Note: browserElementTestHelpers.js looks at the test's filename to determine
# whether the test should be OOP. "_oop_" signals OOP, "_inproc_" signals in
# process. Default is OOP.
[test_browserElement_inproc_getWebManifest.html]
[test_browserElement_NoAttr.html]
[test_browserElement_NoPref.html]