OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>MediaKeys</title> | 4 <title>MediaKeys</title> |
5 <script src=../video-test.js></script> | 5 <script src=../video-test.js></script> |
6 <script> | 6 <script> |
7 var mediaKeys; | 7 var mediaKeys; |
8 var mediaKeys2; | 8 var mediaKeys2; |
9 | 9 |
10 function runTest() | 10 function runTest() |
11 { | 11 { |
12 consoleWrite("Test MediaKeys assignment."); | 12 consoleWrite("Test MediaKeys assignment."); |
13 findMediaElement(); | 13 findMediaElement(); |
14 testExpected('video', null, '!='); | 14 testExpected('video', null, '!='); |
15 testExpected('video.mediaKeys', null); | 15 testExpected('video.mediaKeys', null); |
16 testExpected('typeof video.setMediaKeys', 'function'); | 16 testExpected('typeof video.setMediaKeys', 'function'); |
17 | 17 |
18 consoleWrite("Try setting mediaKeys to null."); | 18 consoleWrite("Try setting mediaKeys to null."); |
19 run('video.setMediaKeys(null)'); | 19 run('video.setMediaKeys(null)'); |
20 testExpected('video.mediaKeys', null); | 20 testExpected('video.mediaKeys', null); |
21 | 21 |
| 22 consoleWrite("Try setting mediaKeys to the wrong type of object.
"); |
| 23 testException('video.setMediaKeys(new Date())', '"TypeError: Fai
led to execute \'setMediaKeys\' on \'HTMLMediaElement\': parameter 1 is not of t
ype \'MediaKeys\'."'); |
| 24 |
22 consoleWrite("Create a MediaKeys object and assign it to video."
); | 25 consoleWrite("Create a MediaKeys object and assign it to video."
); |
23 run('mediaKeys = new MediaKeys("org.w3.clearkey")'); | 26 run('mediaKeys = new MediaKeys("org.w3.clearkey")'); |
24 testExpected('mediaKeys', null, '!='); | 27 testExpected('mediaKeys', null, '!='); |
25 testExpected('mediaKeys.keySystem', 'org.w3.clearkey'); | 28 testExpected('mediaKeys.keySystem', 'org.w3.clearkey'); |
26 run('video.setMediaKeys(mediaKeys)'); | 29 run('video.setMediaKeys(mediaKeys)'); |
27 testExpected('video.mediaKeys', null, '!='); | 30 testExpected('video.mediaKeys', null, '!='); |
28 testExpected('video.mediaKeys', mediaKeys, '==='); | 31 testExpected('video.mediaKeys', mediaKeys, '==='); |
29 | 32 |
30 consoleWrite("Set it a second time."); | 33 consoleWrite("Set it a second time."); |
31 run('video.setMediaKeys(mediaKeys)'); | 34 run('video.setMediaKeys(mediaKeys)'); |
(...skipping 28 matching lines...) Expand all Loading... |
60 testExpected('video.mediaKeys', mediaKeys2, '!='); | 63 testExpected('video.mediaKeys', mediaKeys2, '!='); |
61 endTest(); | 64 endTest(); |
62 } | 65 } |
63 </script> | 66 </script> |
64 </head> | 67 </head> |
65 <body onload="runTest()"> | 68 <body onload="runTest()"> |
66 <p>This tests setting MediaKeys on a video object.</p> | 69 <p>This tests setting MediaKeys on a video object.</p> |
67 <video id="video"></video> | 70 <video id="video"></video> |
68 </body> | 71 </body> |
69 </html> | 72 </html> |
OLD | NEW |