Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / media / encrypted-media / encrypted-media-prefixed-after-unprefixed.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <title>Prefixed and unprefixed EME API</title>
5         <script src="encrypted-media-utils.js"></script>
6         <script src="../../resources/testharness.js"></script>
7         <script src="../../resources/testharnessreport.js"></script>
8     </head>
9     <body>
10         <video id="testVideo"></video>
11         <div id="log"></div>
12         <p>Call prefixed EME API after unprefixed EME API.</p>
13         <script>
14             async_test(function(test)
15             {
16                 var video = document.getElementById('testVideo');
17                 assert_not_equals(video, null);
18
19                 function loadStarted()
20                 {
21                     navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(function(access) {
22                         assert_equals(access.keySystem, 'org.w3.clearkey');
23                         return access.createMediaKeys();
24                     }).then(function(mediaKeys) {
25                         assert_not_equals(mediaKeys, null);
26                         return video.setMediaKeys(mediaKeys);
27                     }).then(function(result) {
28                         assert_throws('InvalidStateError',
29                                       function () { video.webkitGenerateKeyRequest('webkit-org.w3.clearkey'); });
30                         test.done();
31                     }).catch(function(error) {
32                         forceTestFailureFromPromise(test, error);
33                     });
34                 }
35
36                 video.src = '../content/test-encrypted.webm';
37                 waitForEventAndRunStep('loadstart', video, loadStarted, test);
38             }, 'Call prefixed EME API after unprefixed EME API.');
39         </script>
40     </body>
41 </html>