summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_audioNotificationSilent_audioFile.html
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/base/test/test_audioNotificationSilent_audioFile.html
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/base/test/test_audioNotificationSilent_audioFile.html')
-rw-r--r--dom/base/test/test_audioNotificationSilent_audioFile.html73
1 files changed, 73 insertions, 0 deletions
diff --git a/dom/base/test/test_audioNotificationSilent_audioFile.html b/dom/base/test/test_audioNotificationSilent_audioFile.html
new file mode 100644
index 000000000..0b3b89580
--- /dev/null
+++ b/dom/base/test/test_audioNotificationSilent_audioFile.html
@@ -0,0 +1,73 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Audio-playback should be inactive when input file is silent</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script type="application/javascript;version=1.7">
+
+SimpleTest.waitForExplicitFinish();
+
+var generator = runTest();
+var expectedPlaybackActive = null;
+
+var audio = new Audio();
+audio.src = "audioEndedDuringPlaying.webm";
+
+var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
+ .getService(SpecialPowers.Ci.nsIObserverService);
+
+var observer = {
+ observe: function(subject, topic, data) {
+ is(topic, "audio-playback", "audio-playback received");
+ is(data, expectedPlaybackActive, "Corrrect audible state");
+ continueTest();
+ }
+};
+
+function continueTest() {
+ try {
+ generator.next();
+ } catch (e if e instanceof StopIteration) {
+ error("Stop test because of exception!");
+ }
+}
+
+function audioPlayingStart() {
+ observerService.addObserver(observer, "audio-playback", false);
+ ok(true, "Observer set");
+
+ expectedPlaybackActive = 'active';
+
+ info("Audio playing start");
+ audio.play();
+}
+
+function audioBecomeSilentDuringPlaying() {
+ info("Audio would become silent during playing");
+
+ expectedPlaybackActive = 'inactive-nonaudible';
+}
+
+function finish() {
+ observerService.removeObserver(observer, "audio-playback");
+ ok(true, "Observer removed");
+
+ SimpleTest.finish();
+}
+
+function runTest() {
+ yield audioPlayingStart();
+
+ yield audioBecomeSilentDuringPlaying();
+
+ yield finish();
+}
+
+continueTest();
+
+</script>
+</body>
+</html> \ No newline at end of file