OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>setMediaKeys</title> | 4 <title>setMediaKeys</title> |
5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <video id="video"></video> | 10 <video id="video"></video> |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 // Try setting mediaKeys to the wrong type of object. | 27 // Try setting mediaKeys to the wrong type of object. |
28 return video.setMediaKeys(new Date()); | 28 return video.setMediaKeys(new Date()); |
29 }).then(function(result) { | 29 }).then(function(result) { |
30 assert_unreached('setMediaKeys did not fail when setting to
Date()'); | 30 assert_unreached('setMediaKeys did not fail when setting to
Date()'); |
31 }, function(error) { | 31 }, function(error) { |
32 // TypeError expected. | 32 // TypeError expected. |
33 assert_equals(error.name, 'TypeError'); | 33 assert_equals(error.name, 'TypeError'); |
34 | 34 |
35 // Create a MediaKeys object and assign it to video. | 35 // Create a MediaKeys object and assign it to video. |
36 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | 36 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', getSimpleConfiguration()); |
37 }).then(function(access) { | 37 }).then(function(access) { |
38 assert_equals(access.keySystem, 'org.w3.clearkey'); | 38 assert_equals(access.keySystem, 'org.w3.clearkey'); |
39 return access.createMediaKeys(); | 39 return access.createMediaKeys(); |
40 }).then(function(result) { | 40 }).then(function(result) { |
41 mediaKeys = result; | 41 mediaKeys = result; |
42 assert_not_equals(mediaKeys, null); | 42 assert_not_equals(mediaKeys, null); |
43 assert_equals(typeof mediaKeys.createSession, 'function'); | 43 assert_equals(typeof mediaKeys.createSession, 'function'); |
44 return video.setMediaKeys(mediaKeys); | 44 return video.setMediaKeys(mediaKeys); |
45 }).then(function(result) { | 45 }).then(function(result) { |
46 assert_not_equals(video.mediaKeys, null); | 46 assert_not_equals(video.mediaKeys, null); |
47 assert_true(video.mediaKeys === mediaKeys); | 47 assert_true(video.mediaKeys === mediaKeys); |
48 test.done(); | 48 test.done(); |
49 }).catch(function(error) { | 49 }).catch(function(error) { |
50 forceTestFailureFromPromise(test, error); | 50 forceTestFailureFromPromise(test, error); |
51 }); | 51 }); |
52 }, 'Setting MediaKeys on a video object.'); | 52 }, 'Setting MediaKeys on a video object.'); |
53 </script> | 53 </script> |
54 </body> | 54 </body> |
55 </html> | 55 </html> |
OLD | NEW |