Bug 1124491 - Test HTMLMediaElement.isEncrypted attribute - r=cpearce a=lmandel
authorEdwin Flores <eflores@mozilla.com>
Tue, 27 Jan 2015 19:10:11 +1300
changeset 250177 dccbd236f4f8
parent 250176 5525ed289797
child 250178 894e85d470e3
push id4521
push usercpearce@mozilla.com
push date2015-03-04 01:22 +0000
treeherdermozilla-beta@8abdbdecd2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lmandel
bugs1124491
milestone37.0
Bug 1124491 - Test HTMLMediaElement.isEncrypted attribute - r=cpearce a=lmandel
dom/media/test/manifest.js
dom/media/test/test_eme_playback.html
--- a/dom/media/test/manifest.js
+++ b/dom/media/test/manifest.js
@@ -670,16 +670,18 @@ function checkMetadata(msg, e, test) {
   }
   if (test.height) {
     is(e.videoHeight, test.height, msg + " video height");
   }
   if (test.duration) {
     ok(Math.abs(e.duration - test.duration) < 0.1,
        msg + " duration (" + e.duration + ") should be around " + test.duration);
   }
+  is(!!test.keys, SpecialPowers.do_lookupGetter(e, "isEncrypted").apply(e),
+     msg + " isEncrypted should be true if we have decryption keys");
 }
 
 // Returns the first test from candidates array which we can play with the
 // installed video backends.
 function getPlayableVideo(candidates) {
   var resources = getPlayableVideos(candidates);
   if (resources.length > 0)
     return resources[0];
--- a/dom/media/test/test_eme_playback.html
+++ b/dom/media/test/test_eme_playback.html
@@ -51,16 +51,22 @@ function startTest(test, token)
   var gotPlaying = false;
 
   v.addEventListener("encrypted", function(ev) {
     gotEncrypted = true;
   });
 
   v.addEventListener("playing", function () { gotPlaying = true; });
 
+  v.addEventListener("loadedmetadata", function() {
+    ok(SpecialPowers.do_lookupGetter(v, "isEncrypted").apply(v),
+       TimeStamp(token) + " isEncrypted should be true");
+    is(v.isEncrypted, undefined, "isEncrypted should not be accessible from content");
+  });
+
   v.addEventListener("ended", function(ev) {
     ok(true, TimeStamp(token) + " got ended event");
 
     ok(gotEncrypted, TimeStamp(token) + " encrypted event should have fired");
     ok(gotPlaying, TimeStamp(token) + " playing event should have fired");
 
     ok(Math.abs(test.duration - v.duration) < 0.1,
        TimeStamp(token) + " Duration of video should be corrrect");