Bug 1382780 - part4 : modify tests. r=cpearce
authorAlastor Wu <alwu@mozilla.com>
Thu, 24 Aug 2017 17:41:15 +0800
changeset 376685 7985d03d93db4d310089aa70dce94089c087f392
parent 376684 1a458c01415793f9060cd369a133682baa5a39c6
child 376686 556e8de56fb24a3d73ac51ecdef578e76982ff4e
push id94144
push userryanvm@gmail.com
push dateFri, 25 Aug 2017 00:21:50 +0000
treeherdermozilla-inbound@942d868646cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1382780
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382780 - part4 : modify tests. r=cpearce * test_playback_rate.html In the patch2, we would honestly return the value of playback rate. * test_info_leak.html/test_load.html According to [1], we should only dispatch event "ratechange" when playbackRate or defaultPlaybackRate attribute has just been updated. In these tests, they didn't change the playbackRate or defaultPlaybackRate, we should not expect for the "ratechange" event. [1] https://html.spec.whatwg.org/multipage/media.html#event-media-ratechange MozReview-Commit-ID: LjVDNnf4YX4
dom/media/test/test_info_leak.html
dom/media/test/test_load.html
dom/media/test/test_playback_rate.html
--- a/dom/media/test/test_info_leak.html
+++ b/dom/media/test/test_info_leak.html
@@ -24,17 +24,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug 478957 **/
 
 // Tests whether we leak events and state change info when loading stuff from local files from a webserver.
 
 var manager = new MediaTestManager;
 
 var gEventTypes = [ 'loadstart', 'progress', 'suspend', 'abort', 'error', 'emptied', 'stalled', 'play', 'pause', 'loadedmetadata', 'loadeddata', 'waiting', 'playing', 'canplay', 'canplaythrough', 'seeking', 'seeked', 'timeupdate', 'ended', 'ratechange', 'durationchange', 'volumechange' ];
 
-var gExpectedEvents = ['ratechange', 'loadstart', 'error'];
+var gExpectedEvents = ['loadstart', 'error'];
 
 function createTestArray() {
   var tests = [];
   var tmpVid = document.createElement("video");
 
   for (var testNum=0; testNum<gInfoLeakTests.length; testNum++) {
     var test = gInfoLeakTests[testNum];
     if (!tmpVid.canPlayType(test.type)) {
--- a/dom/media/test/test_load.html
+++ b/dom/media/test/test_load.html
@@ -89,17 +89,17 @@ function prependSource(src, type) {
 var gTests = [
   {
     // Test 0: adding video to doc, then setting src should load implicitly.
     create:
       function(src, type) {
         document.body.appendChild(gMedia);
         gMedia.src = src;
       },
-    expectedEvents: ['ratechange',  'loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
+    expectedEvents: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
   }, {
     // Test 1: adding video to doc, then adding source.
     create:
       function(src, type) {
         document.body.appendChild(gMedia);
         addSource(src, type);
       },
     expectedEvents: ['loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
@@ -117,17 +117,17 @@ var gTests = [
   }, {
     // Test 3:  video with bad src, good <source>, ensure that <source> aren't used.
     create:
       function(src, type) {
         gMedia.src = "404a";
         addSource(src, type);
         document.body.appendChild(gMedia);
       },
-    expectedEvents: ['ratechange', 'loadstart', 'error']
+    expectedEvents: ['loadstart', 'error']
   }, {
     // Test 4:  video with only bad source, loading, then adding a good source
     // -  should resume load.
     create:
       function(src, type) {
         addSource("404a", type);
         var s2 = addSource("404b", type);
         s2.addEventListener("error",
@@ -165,17 +165,17 @@ var gTests = [
     create:
       function(src, type) {
         gMedia.preload = "none";
         gMedia.src = src;
         document.body.appendChild(gMedia);
         addSource(src, type);
         gMedia.load();
       },
-    expectedEvents: ['emptied', 'ratechange',  'loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
+    expectedEvents: ['emptied',  'loadstart', 'durationchange', 'loadedmetadata', 'loadeddata']
   }
 ];
 
 function nextTest() {
   if (gMedia) {
     for (var i=0; i<gEventTypes.length; i++) {
       gMedia.removeEventListener(gEventTypes[i], listener);
     }
--- a/dom/media/test/test_playback_rate.html
+++ b/dom/media/test/test_playback_rate.html
@@ -81,17 +81,17 @@ function afterNullPlaybackRate(e) {
 
   ok(t.currentTime == t.oldCurrentTime, t.name + ": Current time should not change when playbackRate is null (" + t.currentTime + " " + t.oldCurrentTime + ").");
   ok(!t.paused, t.name + ": The element should not be in paused state.");
   t.removeEventListener("paused", onpaused);
   is(t.pausedReceived, undefined, t.name + ": Paused event should not have been received.");
   t.timestamp = Date.now();
   t.oldCurrentTime = t.currentTime;
   t.playbackRate = VERY_FAST_RATE;
-  is(t.playbackRate, FAST_RATE, t.name + ": Playback rate should be clamped to " + FAST_RATE + ".");
+  is(t.playbackRate, VERY_FAST_RATE, t.name + ": Playback rate should be clamped to " + VERY_FAST_RATE + ".");
 }
 
 function onended(e) {
   var t = e.target;
   t.gotEnded = true;
 
   t.bufferingTime = 0;
   // If we got "ended" too early, skip these tests.
@@ -154,17 +154,17 @@ function startTest(test, token) {
   element.addEventListener("volumechange", onvolumechange);
   manager.started(token);
   element.startTimestamp = Date.now();
   is(element.mozPreservesPitch, true, test.name + ": Pitch preservation should be enabled by default.");
   element.addEventListener("loadedmetadata", function() {
     is(element.playbackRate, 1.0, test.name + ": playbackRate should be initially 1.0");
     is(element.defaultPlaybackRate, 1.0, test.name + ": defaultPlaybackRate should be initially 1.0");
     element.playbackRate = VERY_SLOW_RATE;
-    is(element.playbackRate, SLOW_RATE, test.name + ": PlaybackRate should be clamped to " + SLOW_RATE + ".");
+    is(element.playbackRate, VERY_SLOW_RATE, test.name + ": PlaybackRate should be " + VERY_SLOW_RATE + ".");
     element.play();
     element.playbackRate = SLOW_RATE;
   });
 }
 
 manager.runTests(gPlayedTests, startTest);
 
 </script>