4 <title>Bug
1131392 - Test that EME does not work for non-MSE media
</title>
5 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
6 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
7 <script type=
"text/javascript" src=
"manifest.js"></script>
8 <script type=
"text/javascript" src=
"eme.js"></script>
12 <script class=
"testbody" type=
"text/javascript">
13 /* import-globals-from eme.js */
14 var manager = new MediaTestManager;
16 function DoSetMediaKeys(v, test, token)
19 initDataTypes: [
"cenc"],
20 audioCapabilities: [{contentType: test.audioType}],
21 videoCapabilities: [{contentType: test.videoType}],
24 return navigator.requestMediaKeySystemAccess(CLEARKEY_KEYSYSTEM, options)
26 .then(function(keySystemAccess) {
27 return keySystemAccess.createMediaKeys();
31 ok(false, token +
" was not expecting failure (yet)");
34 .then(function(mediaKeys) {
35 return v.setMediaKeys(mediaKeys);
39 function TestSetMediaKeys(test, token)
41 manager.started(token);
43 var v = document.createElement(
"video");
45 v.addEventListener(
"encrypted", function() {
46 ok(false, token +
" should not fire encrypted event");
49 var loadedMetadata = false;
50 v.addEventListener(
"loadedmetadata", function() {
51 loadedMetadata = true;
54 v.addEventListener(
"error", function() {
55 ok(true, token +
" expected error event");
56 ok(loadedMetadata, token +
" expected loadedmetadata to have fired");
57 manager.finished(token);
63 function TestSetSrc(test, token)
65 manager.started(token);
67 var v = document.createElement(
"video");
68 v.addEventListener(
"error", function(err) {
69 ok(true, token +
" got error setting src on video element, as expected");
70 manager.finished(token);
73 DoSetMediaKeys(v, test, token)
80 ok(false, token +
" got error setting media keys");
84 function startTest(test, token)
86 TestSetMediaKeys(test, token +
"_setMediaKeys");
87 TestSetSrc(test, token +
"_setSrc");
90 SimpleTest.waitForExplicitFinish();
91 manager.runTests(gEMENonMSEFailTests, startTest);