| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Prefixed and unprefixed EME API</title> |
| <script src="encrypted-media-utils.js"></script> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <video id="testVideo"></video> |
| <div id="log"></div> |
| <script> |
| async_test(function(test) |
| { |
| var video = document.getElementById('testVideo'); |
| assert_not_equals(video, null); |
| |
| function loadStarted() |
| { |
| video.webkitGenerateKeyRequest('webkit-org.w3.clearkey'); |
| navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) { |
| assert_equals(access.keySystem, 'org.w3.clearkey'); |
| return access.createMediaKeys(); |
| }).then(function(mediaKeys) { |
| assert_not_equals(mediaKeys, null); |
| assert_equals(typeof mediaKeys.createSession, 'function'); |
| video.setMediaKeys(mediaKeys).then(function(result) { |
| assert_unreached('setMediaKeys should have failed.'); |
| }, function(error) { |
| assert_equals(error.name, 'InvalidStateError'); |
| assert_not_equals(error.message, ''); |
| test.done(); |
| }); |
| }).catch(function(error) { |
| forceTestFailureFromPromise(test, error); |
| }); |
| } |
| |
| video.src = '../content/test-encrypted.webm'; |
| waitForEventAndRunStep('loadstart', video, loadStarted, test); |
| }, 'Call unprefixed EME API after prefixed EME API.'); |
| </script> |
| </body> |
| </html> |