Bug 1302632: P5. Update mochitests. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 16 Sep 2016 11:14:07 +1000
changeset 357712 3c4a5256eff7fea7dd49b13917b34ba0fcf80402
parent 357711 7442beabc15302b60421f4c545caa5007ff2757d
child 357713 e92048c87179fabe99746cf95b259315d73c6aa2
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1302632
milestone51.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 1302632: P5. Update mochitests. r=gerald The tests expected that the error code would be MEDIA_ERR_DECODE whenever we fail to open a video. However, MEDIA_ERR_DECODE is to be used only when "An error of some description occurred while decoding the media resource, after the resource was established to be usable." All those files have errors in their metadata. Which makes the resource unusable to start with. Similarly, networkState would be set to NETWORK_NO_SOURCE if the metadata couldn't be read. MozReview-Commit-ID: KXVJmD3ZQlT
dom/media/test/test_decode_error.html
dom/media/test/test_error_in_video_document.html
dom/media/test/test_invalid_reject.html
--- a/dom/media/test/test_decode_error.html
+++ b/dom/media/test/test_decode_error.html
@@ -21,17 +21,21 @@ function startTest(test, token) {
 
   var v = document.createElement("video");
   manager.started(token);
   v.addEventListener("error", function (event) {
     var el = event.currentTarget;
     is(event.type, "error", "Expected event of type 'error'");
     ok(el.error, "Element 'error' attr expected to have a value");
     ok(el.error instanceof MediaError, "Element 'error' attr expected to be MediaError");
-    is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error");
+    if (v.readyState == v.HAVE_NOTHING) {
+      is(el.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, "Expected media not supported error");
+    } else {
+      is(el.error.code, MediaError.MEDIA_ERR_DECODE, "Expected a decode error");
+    }
     ok(typeof el.error.message === 'string' || el.error.essage instanceof String, "Element 'message' attr expected to be a string");
     ok(el.error.message.length > 0, "Element 'message' attr has content");
     el._sawError = true;
     manager.finished(token);
   }, false);
 
   v.addEventListener("loadeddata", function () {
     ok(false, "Unexpected loadeddata event");
--- a/dom/media/test/test_error_in_video_document.html
+++ b/dom/media/test/test_error_in_video_document.html
@@ -26,23 +26,21 @@ function documentVideo() {
                  .contentDocument.body.getElementsByTagName("video")[0];
 }
 
 function check() {
   var v = documentVideo();
 
   // Debug info for Bug 608634
   ok(true, "iframe src=" + document.body.getElementsByTagName("iframe")[0].src);
-  is(v.readyState, 0, "Ready state");
+  is(v.readyState, v.HAVE_NOTHING, "Ready state");
 
-  is(v.networkState, 0, "Network state");
   isnot(v.error, null, "Error object");
-  if (v.error)
-    is(v.error.code, MediaError.MEDIA_ERR_DECODE, "Error code");
-
+  is(v.networkState, v.NETWORK_NO_SOURCE, "Network state");
+  is(v.error.code, MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED, "Expected media not supported error");
   SimpleTest.finish();
 }
 
 // Find an error test that we'd think we should be able to play (if it
 // wasn't already known to fail).
 var t = getPlayableVideo(gErrorTests);
 if (!t) {
   todo(false, "No types supported");
--- a/dom/media/test/test_invalid_reject.html
+++ b/dom/media/test/test_invalid_reject.html
@@ -27,18 +27,23 @@ function startTest(test, token) {
       'playing'
   ];
   events.forEach( function(e) {
     v.addEventListener(e, badEvent(e));
   });
 
   // Seeing a decoder error is a success.
   v.addEventListener("error", function onerror(e) {
-    is(v.error.code, v.error.MEDIA_ERR_DECODE,
-      "decoder should reject " + test.name);
+    if (v.readyState == v.HAVE_NOTHING) {
+      is(v.error.code, v.error.MEDIA_ERR_SRC_NOT_SUPPORTED,
+         "decoder should reject " + test.name);
+    } else {
+      is(v.error.code, v.error.MEDIA_ERR_DECODE,
+         "decoder should reject " + test.name);
+    }
     v.removeEventListener('error', onerror, false);
     manager.finished(token);
   });
 
   // Now try to load and play the file, which should result in the
   // error event handler above being called, terminating the test.
   document.body.appendChild(v);
   v.src = test.name;