Bug 1270738 - don't need to check the playing state for 'test_audioNotificationSilent_audioFile.html'. draft
authorAlastor Wu <alwu@mozilla.com>
Mon, 21 Nov 2016 11:25:10 +0800
changeset 441713 e72c39c1238f2b4f910f7d581f7adc62810fa731
parent 438362 1196bf3032e1bce1fb07a01fd9082a767426c5fb
child 537624 882ed4abbd42a4fad6a2df3ba8c9c03447deaf4b
push id36507
push useralwu@mozilla.com
push dateMon, 21 Nov 2016 03:30:18 +0000
bugs1270738, 1240423
milestone52.0a1
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
dom/base/test/test_audioNotificationSilent_audioFile.html
--- 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();
 }