Bug 1134434 - Change test_eme_non_fragmented to expect a `loadedmetadata' event instead of `encrypted' - r=cpearce
authorEdwin Flores <eflores@mozilla.com>
Mon, 23 Mar 2015 15:31:15 +1300
changeset 235019 b7e5ddf82a1abe1d1b2840b86992f5653ac92676
parent 235018 587c4a3c4c6b34e17823d762b6427a049f2c3353
child 235020 706ee8458ffb6f06da7874cb870d02c3f5696f54
push id28462
push usercbook@mozilla.com
push dateMon, 23 Mar 2015 12:19:34 +0000
treeherdermozilla-central@bc85c479668a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1134434
milestone39.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 1134434 - Change test_eme_non_fragmented to expect a `loadedmetadata' event instead of `encrypted' - r=cpearce
dom/media/test/mochitest.ini
dom/media/test/test_eme_access_control.html
dom/media/test/test_eme_non_mse_fails.html
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -365,18 +365,16 @@ skip-if = (toolkit == 'android' && proce
 [test_currentTime.html]
 [test_decode_error.html]
 [test_decoder_disable.html]
 [test_defaultMuted.html]
 [test_delay_load.html]
 skip-if = buildapp == 'b2g' && toolkit != 'gonk' # bug 1082984
 [test_dormant_playback.html]
 skip-if = (os == 'win' && os_version == '5.1') || (os != 'win' && toolkit != 'gonk')
-[test_eme_access_control.html]
-skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 [test_eme_canvas_blocked.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s || (os == 'win' && !debug) # bug 1043403, bug 1057908, bug 1140675
 [test_eme_non_mse_fails.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 #[test_eme_obs_notification.html]
 #skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 # Disabled (bug 1140778) since this test fails and we don't want to remove the
 # functionality being tested by this test. We should still test other observers
deleted file mode 100644
--- a/dom/media/test/test_eme_access_control.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
-  <title>Test EME blocked cross-origin</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-  <script type="text/javascript" src="manifest.js"></script>
-  <script type="text/javascript" src="eme.js"></script>
-</head>
-<body>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-var manager = new MediaTestManager;
-
-function TestNoCORS(test, token)
-{
-  var token = token + "_nocors";
-
-  manager.started(token);
-
-  var v = document.createElement("video");
-
-  v.addEventListener("encrypted", function(ev) {
-    is(ev.initDataType, "", "initDataType should be empty for CORS cross-origin media");
-    is(ev.initData, null, "initData should be null for CORS cross-origin media");
-
-    manager.finished(token);
-  });
-
-  v.addEventListener("error", function() {
-    ok(false, "Should not receive error loading cross-origin media without crossorigin attribute");
-  });
-
-  v.src = test.uri;
-}
-
-function TestCORSFailure(test, token)
-{
-  var token = token + "_corsfail";
-
-  manager.started(token);
-
-  var v = document.createElement("video");
-  v.crossOrigin = true;
-
-  v.addEventListener("error", function(ev) {
-    ok(true, "Should get error loading cross-origin media");
-    manager.finished(token);
-  });
-
-  v.addEventListener("encrypted", function() {
-    ok(false, "Should not receive encrypted event loading cross-origin media");
-  });
-
-  v.src = test.uri;
-}
-
-function TestCORSSuccess(test, token)
-{
-  var token = token + "_corsok";
-
-  manager.started(token);
-
-  var v = document.createElement("video");
-  v.crossOrigin = true;
-
-  v.addEventListener("error", function(ev) {
-    ok(false, "Should not get error loading cross-origin media");
-  });
-
-  v.addEventListener("encrypted", function(ev) {
-    ok(ev.initData.byteLength > 0, "Should get encryption initData loading cross-origin media");
-    is(ev.initDataType, "cenc", "Should get correct encryption initDataType loading cross-origin media");
-    manager.finished(token);
-  });
-
-  v.src = test.uri;
-}
-
-function startTest(test, token)
-{
-  test.uri = "http://test1.mochi.test:8888/tests/dom/media/test/" + test.name;
-  TestNoCORS(test, token);
-  TestCORSFailure(test, token);
-
-  test.uri = "http://test1.mochi.test:8888/tests/dom/media/test/allowed.sjs?" + test.name;
-  TestCORSSuccess(test, token);
-}
-
-function beginTest() {
-  manager.runTests(gEMETests.filter(t => t.crossOrigin), startTest);
-}
-
-var prefs = [
-  [ "media.mediasource.enabled", true ],
-  [ "media.mediasource.whitelist", false ],
-  [ "media.mediasource.mp4.enabled", true ],
-];
-
-if (/Linux/.test(navigator.userAgent) ||
-    !document.createElement('video').canPlayType("video/mp4")) {
-  // XXX remove once we have mp4 PlatformDecoderModules on all platforms.
-  prefs.push([ "media.fragmented-mp4.exposed", true ]);
-  prefs.push([ "media.fragmented-mp4.use-blank-decoder", true ]);
-}
-
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({ "set" : prefs }, beginTest);
-</script>
-</pre>
-</body>
-</html>
--- a/dom/media/test/test_eme_non_mse_fails.html
+++ b/dom/media/test/test_eme_non_mse_fails.html
@@ -35,27 +35,29 @@ function DoSetMediaKeys(v)
 }
 
 function TestSetMediaKeys(test, token)
 {
   manager.started(token);
 
   var v = document.createElement("video");
 
-  // XXX the encrypted event should never fire here after bug 1134434
   v.addEventListener("encrypted", function() {
-    DoSetMediaKeys(v)
+    ok(false, token + " should not fire encrypted event");
+  });
 
-    .then(function() {
-      ok(false, token + " expected setMediaKeys to fail.");
-      manager.finished(token);
-    }, function(err) {
-      is(err.name, "NotSupportedError", token + " should return correct error");
-      manager.finished(token);
-    });
+  var loadedMetadata = false;
+  v.addEventListener("loadedmetadata", function() {
+    loadedMetadata = true;
+  });
+
+  v.addEventListener("error", function() {
+    ok(true, token + " expected error event");
+    ok(loadedMetadata, token + " expected loadedmetadata to have fired");
+    manager.finished(token);
   });
 
   v.src = test.name;
 }
 
 function TestSetSrc(test, token)
 {
   manager.started(token);