Bug 1270738 - don't need to check the playing state for 'test_audioNotificationSilent_audioFile.html'.
The reason to check the playing state is because we want to make sure the non-audible event is not due to
media element ended. However, in
bug 1240423, we introduced the different inactive state (inactive-pause and
inactive-nonaudible), so we don't need to check the playing state anymore, we can just check whether the event
is 'inactive-nonaudible', but not 'inactive-pause'.
MozReview-Commit-ID: 6slOhb68Qp5
--- a/dom/base/test/test_audioNotificationSilent_audioFile.html
+++ b/dom/base/test/test_audioNotificationSilent_audioFile.html
@@ -7,29 +7,27 @@
</head>
<body>
<script type="application/javascript;version=1.7">
SimpleTest.waitForExplicitFinish();
var generator = runTest();
var expectedPlaybackActive = null;
-var expectedPlaying = 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");
- is(!audio.ended, expectedPlaying, "Corrrect playing state");
continueTest();
}
};
function continueTest() {
try {
generator.next();
} catch (e if e instanceof StopIteration) {
@@ -37,27 +35,25 @@ function continueTest() {
}
}
function audioPlayingStart() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
expectedPlaybackActive = 'active';
- expectedPlaying = true;
info("Audio playing start");
audio.play();
}
function audioBecomeSilentDuringPlaying() {
info("Audio would become silent during playing");
expectedPlaybackActive = 'inactive-nonaudible';
- expectedPlaying = true;
}
function finish() {
observerService.removeObserver(observer, "audio-playback");
ok(true, "Observer removed");
SimpleTest.finish();
}