OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test EME syntax</title> | 4 <title>Test EME syntax</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 <script> | 10 <script> |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 return access.createMediaKeys('extra'); | 159 return access.createMediaKeys('extra'); |
160 }).then(function(mediaKeys) { | 160 }).then(function(mediaKeys) { |
161 assert_not_equals(mediaKeys, null); | 161 assert_not_equals(mediaKeys, null); |
162 assert_equals(typeof mediaKeys, 'object'); | 162 assert_equals(typeof mediaKeys, 'object'); |
163 assert_equals(typeof mediaKeys.createSession, 'function'); | 163 assert_equals(typeof mediaKeys.createSession, 'function'); |
164 assert_equals(typeof mediaKeys.setServerCertificate, 'functi
on'); | 164 assert_equals(typeof mediaKeys.setServerCertificate, 'functi
on'); |
165 test.done(); | 165 test.done(); |
166 }).catch(function(error) { | 166 }).catch(function(error) { |
167 forceTestFailureFromPromise(test, error, 'create() tests fai
led'); | 167 forceTestFailureFromPromise(test, error, 'create() tests fai
led'); |
168 }); | 168 }); |
169 }, 'Test MediaKeys create().'); | 169 }, 'Test MediaKeySystemAccess createMediaKeys().'); |
170 | 170 |
171 var kCreateSessionExceptionsTestCases = [ | 171 var kCreateSessionExceptionsTestCases = [ |
172 // Tests in this set use a shortened parameter name due to | 172 // Tests in this set use a shortened parameter name due to |
173 // format_value() only returning the first 60 characters as the | 173 // format_value() only returning the first 60 characters as the |
174 // result. With a longer name the first 60 characters is not | 174 // result. With a longer name the first 60 characters is not |
175 // enough to determine which test failed. | 175 // enough to determine which test failed. |
176 | 176 |
177 // Invalid parameters. | 177 // Invalid parameters. |
178 { | 178 { |
179 exception: 'TypeError', | 179 exception: 'TypeError', |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 function test_createSession(testCase, mediaKeys) | 493 function test_createSession(testCase, mediaKeys) |
494 { | 494 { |
495 var mediaKeySession; | 495 var mediaKeySession; |
496 try { | 496 try { |
497 mediaKeySession = testCase.func.call(null, mediaKeys); | 497 mediaKeySession = testCase.func.call(null, mediaKeys); |
498 } catch (e) { | 498 } catch (e) { |
499 assert_true(testCase.isNotSupportedAllowed); | 499 assert_true(testCase.isNotSupportedAllowed); |
500 return; | 500 return; |
501 } | 501 } |
502 | 502 |
503 // FIXME: Update this set of tests when done | |
504 // implementing the latest spec. | |
505 assert_equals(typeof mediaKeySession, 'object'); | 503 assert_equals(typeof mediaKeySession, 'object'); |
506 assert_equals(typeof mediaKeySession.addEventListener, 'function
'); | 504 assert_equals(typeof mediaKeySession.addEventListener, 'function
'); |
| 505 assert_equals(typeof mediaKeySession.sessionId, 'string'); |
| 506 assert_equals(typeof mediaKeySession.expiration, 'number'); |
| 507 assert_equals(typeof mediaKeySession.closed, 'object'); |
| 508 assert_equals(typeof mediaKeySession.keyStatuses, 'object'); |
| 509 assert_equals(typeof mediaKeySession.onkeystatuseschange, 'objec
t'); |
| 510 assert_equals(typeof mediaKeySession.onmessage, 'object'); |
507 assert_equals(typeof mediaKeySession.generateRequest, 'function'
); | 511 assert_equals(typeof mediaKeySession.generateRequest, 'function'
); |
| 512 assert_equals(typeof mediaKeySession.load, 'function'); |
508 assert_equals(typeof mediaKeySession.update, 'function'); | 513 assert_equals(typeof mediaKeySession.update, 'function'); |
509 assert_equals(typeof mediaKeySession.close, 'function'); | 514 assert_equals(typeof mediaKeySession.close, 'function'); |
510 assert_equals(typeof mediaKeySession.remove, 'function'); | 515 assert_equals(typeof mediaKeySession.remove, 'function'); |
511 assert_equals(mediaKeySession.sessionId, ''); | 516 assert_equals(mediaKeySession.sessionId, ''); |
512 assert_equals(typeof mediaKeySession.sessionId, 'string'); | |
513 assert_equals(typeof mediaKeySession.onopen, 'undefined'); | |
514 assert_equals(typeof mediaKeySession.onmessage, 'undefined'); | |
515 assert_equals(typeof mediaKeySession.onclose, 'undefined'); | |
516 assert_equals(typeof mediaKeySession.onerror, 'undefined'); | |
517 } | 517 } |
518 | 518 |
519 async_test(function(test) | 519 async_test(function(test) |
520 { | 520 { |
521 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 521 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { |
522 return access.createMediaKeys(); | 522 return access.createMediaKeys(); |
523 }).then(function(mediaKeys) { | 523 }).then(function(mediaKeys) { |
524 kCreateSessionTestCases.map(function(testCase) { | 524 kCreateSessionTestCases.map(function(testCase) { |
525 test_createSession(testCase, mediaKeys); | 525 test_createSession(testCase, mediaKeys); |
526 }); | 526 }); |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 }); | 1001 }); |
1002 }, 'Test MediaKeys setServerCertificate().'); | 1002 }, 'Test MediaKeys setServerCertificate().'); |
1003 | 1003 |
1004 | 1004 |
1005 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). | 1005 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). |
1006 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. | 1006 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. |
1007 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. | 1007 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. |
1008 </script> | 1008 </script> |
1009 </body> | 1009 </body> |
1010 </html> | 1010 </html> |
OLD | NEW |