зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1549041 - Test that documents receive the right audio notification events when playback is done using the Web Audio API. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D30657 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
cadd6ec6ca
Коммит
ee6b47dd24
|
@ -0,0 +1,7 @@
|
|||
<meta charset=utf-8>
|
||||
<script>
|
||||
var ac = new AudioContext();
|
||||
var osc = ac.createOscillator();
|
||||
osc.connect(ac.destination);
|
||||
osc.start();
|
||||
</script>
|
|
@ -197,6 +197,7 @@ support-files =
|
|||
file_webaudioLoop.html
|
||||
file_webaudioLoop2.html
|
||||
file_webaudio_startstop.html
|
||||
file_webAudioAudible.html
|
||||
file_pluginAudio.html
|
||||
file_pluginAudioNonAutoStart.html
|
||||
noaudio.webm
|
||||
|
@ -272,6 +273,9 @@ skip-if = (os == "win" && processor == "aarch64") # bug 1535775
|
|||
[test_audioNotificationStopOnNavigation.html]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # bug 1535775
|
||||
[test_audioNotificationNavigationWebAudio.html]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # bug 1535775
|
||||
[test_audioNotificationWithEarlyPlay.html]
|
||||
tags = audiochannel
|
||||
skip-if = (os == "win" && processor == "aarch64") # bug 1535775
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for audio controller in windows, when using the Web Audio API</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<iframe></iframe>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// playback starts, stops when the page is reloaded, and starts again.
|
||||
var expectedNotification = ["active", "inactive-pause", "active"];
|
||||
var iframe = null;
|
||||
|
||||
var observer = {
|
||||
observe: function(subject, topic, data) {
|
||||
is(topic, "audio-playback", "audio-playback received");
|
||||
var expected = expectedNotification.shift();
|
||||
is(data, expected, "This is the right notification");
|
||||
if (expected != "inactive-pause") {
|
||||
runTest();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
||||
.getService(SpecialPowers.Ci.nsIObserverService);
|
||||
|
||||
var tests = [
|
||||
function() {
|
||||
iframe = document.querySelector("iframe");
|
||||
observerService.addObserver(observer, "audio-playback");
|
||||
ok(true, "Observer set");
|
||||
runTest();
|
||||
},
|
||||
|
||||
function() {
|
||||
iframe.src = "file_webAudioAudible.html";
|
||||
},
|
||||
|
||||
function() {
|
||||
// Reload
|
||||
iframe.src = "file_webAudioAudible.html";
|
||||
},
|
||||
function() {
|
||||
// Wait for the "active" notification, that is expected after the previous
|
||||
// load of "file_webAudioAudible.html".
|
||||
runTest();
|
||||
}
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
if (!tests.length) {
|
||||
observerService.removeObserver(observer, "audio-playback");
|
||||
ok(true, "Observer removed");
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
onload = runTest;
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Загрузка…
Ссылка в новой задаче