| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 }, | 65 }, |
| 66 { | 66 { |
| 67 exception: 'NotSupportedError', | 67 exception: 'NotSupportedError', |
| 68 func: function() { return navigator.requestMediaKeySystemAcc
ess(undefined, [{}]); } | 68 func: function() { return navigator.requestMediaKeySystemAcc
ess(undefined, [{}]); } |
| 69 }, | 69 }, |
| 70 { | 70 { |
| 71 exception: 'NotSupportedError', | 71 exception: 'NotSupportedError', |
| 72 func: function() { return navigator.requestMediaKeySystemAcc
ess(1, [{}]); } | 72 func: function() { return navigator.requestMediaKeySystemAcc
ess(1, [{}]); } |
| 73 }, | 73 }, |
| 74 { | 74 { |
| 75 exception: 'InvalidAccessError', | 75 exception: 'TypeError', |
| 76 func: function() { return navigator.requestMediaKeySystemAcc
ess(new Uint8Array(0), [{}]); } | 76 func: function() { return navigator.requestMediaKeySystemAcc
ess(new Uint8Array(0), [{}]); } |
| 77 }, | 77 }, |
| 78 { | 78 { |
| 79 exception: 'InvalidAccessError', | 79 exception: 'TypeError', |
| 80 func: function() { return navigator.requestMediaKeySystemAcc
ess('', [{}]); } | 80 func: function() { return navigator.requestMediaKeySystemAcc
ess('', [{}]); } |
| 81 }, | 81 }, |
| 82 { | 82 { |
| 83 exception: 'NotSupportedError', | 83 exception: 'NotSupportedError', |
| 84 func: function() { return navigator.requestMediaKeySystemAcc
ess('unsupported', [{}]); } | 84 func: function() { return navigator.requestMediaKeySystemAcc
ess('unsupported', [{}]); } |
| 85 }, | 85 }, |
| 86 // Non-ASCII names. | 86 // Non-ASCII names. |
| 87 { | 87 { |
| 88 exception: 'NotSupportedError', | 88 exception: 'NotSupportedError', |
| 89 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3\u263A.clearkey', [{}]); } | 89 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3\u263A.clearkey', [{}]); } |
| 90 }, | 90 }, |
| 91 // Empty sequence of MediaKeySystemConfiguration. | 91 // Empty sequence of MediaKeySystemConfiguration. |
| 92 { | 92 { |
| 93 exception: 'InvalidAccessError', | 93 exception: 'TypeError', |
| 94 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', []); } | 94 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', []); } |
| 95 }, | 95 }, |
| 96 // Invalid sequences of MediaKeySystemConfigurations. | 96 // Invalid sequences of MediaKeySystemConfigurations. |
| 97 { | 97 { |
| 98 exception: 'TypeError', | 98 exception: 'TypeError', |
| 99 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', {}); } | 99 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', {}); } |
| 100 }, | 100 }, |
| 101 { | 101 { |
| 102 exception: 'TypeError', | 102 exception: 'TypeError', |
| 103 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', "invalid"); } | 103 func: function() { return navigator.requestMediaKeySystemAcc
ess('org.w3.clearkey', "invalid"); } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 { | 276 { |
| 277 exception: 'TypeError', | 277 exception: 'TypeError', |
| 278 func: function(mk6) { return mk6.createSession().generateReq
uest(new Uint8Array(0)); } | 278 func: function(mk6) { return mk6.createSession().generateReq
uest(new Uint8Array(0)); } |
| 279 }, | 279 }, |
| 280 { | 280 { |
| 281 exception: 'TypeError', | 281 exception: 'TypeError', |
| 282 func: function(mk7, _, initData) { return mk7.createSession(
).generateRequest(initData); } | 282 func: function(mk7, _, initData) { return mk7.createSession(
).generateRequest(initData); } |
| 283 }, | 283 }, |
| 284 // Invalid parameters. | 284 // Invalid parameters. |
| 285 { | 285 { |
| 286 exception: 'InvalidAccessError', | 286 exception: 'TypeError', |
| 287 func: function(mk8, _, initData) { return mk8.createSession(
).generateRequest('', initData); } | 287 func: function(mk8, _, initData) { return mk8.createSession(
).generateRequest('', initData); } |
| 288 }, | 288 }, |
| 289 // Not supported initDataTypes. | 289 // Not supported initDataTypes. |
| 290 { | 290 { |
| 291 exception: 'NotSupportedError', | 291 exception: 'NotSupportedError', |
| 292 func: function(mk9, _, initData) { return mk9.createSession(
).generateRequest(null, initData); } | 292 func: function(mk9, _, initData) { return mk9.createSession(
).generateRequest(null, initData); } |
| 293 }, | 293 }, |
| 294 { | 294 { |
| 295 exception: 'NotSupportedError', | 295 exception: 'NotSupportedError', |
| 296 func: function(mk10, _, initData) { return mk10.createSessio
n().generateRequest(undefined, initData); } | 296 func: function(mk10, _, initData) { return mk10.createSessio
n().generateRequest(undefined, initData); } |
| 297 }, | 297 }, |
| 298 { | 298 { |
| 299 exception: 'NotSupportedError', | 299 exception: 'NotSupportedError', |
| 300 func: function(mk11, _, initData) { return mk11.createSessio
n().generateRequest(1, initData); } | 300 func: function(mk11, _, initData) { return mk11.createSessio
n().generateRequest(1, initData); } |
| 301 }, | 301 }, |
| 302 { | 302 { |
| 303 exception: 'InvalidAccessError', | 303 exception: 'TypeError', |
| 304 func: function(mk12, _, initData) { return mk12.createSessio
n().generateRequest(new Uint8Array(0), initData); } | 304 func: function(mk12, _, initData) { return mk12.createSessio
n().generateRequest(new Uint8Array(0), initData); } |
| 305 }, | 305 }, |
| 306 { | 306 { |
| 307 exception: 'NotSupportedError', | 307 exception: 'NotSupportedError', |
| 308 func: function(mk13, _, initData) { return mk13.createSessio
n().generateRequest('unsupported', initData); } | 308 func: function(mk13, _, initData) { return mk13.createSessio
n().generateRequest('unsupported', initData); } |
| 309 }, | 309 }, |
| 310 { | 310 { |
| 311 exception: 'NotSupportedError', | 311 exception: 'NotSupportedError', |
| 312 func: function(mk14, _, initData) { return mk14.createSessio
n().generateRequest('video/webm', initData); } | 312 func: function(mk14, _, initData) { return mk14.createSessio
n().generateRequest('video/webm', initData); } |
| 313 }, | 313 }, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 }, | 349 }, |
| 350 { | 350 { |
| 351 exception: 'TypeError', | 351 exception: 'TypeError', |
| 352 func: function(mk4, type) { return mk4.createSession().gener
ateRequest(type, undefined); } | 352 func: function(mk4, type) { return mk4.createSession().gener
ateRequest(type, undefined); } |
| 353 }, | 353 }, |
| 354 { | 354 { |
| 355 exception: 'TypeError', | 355 exception: 'TypeError', |
| 356 func: function(mk5, type) { return mk5.createSession().gener
ateRequest(type, 1); } | 356 func: function(mk5, type) { return mk5.createSession().gener
ateRequest(type, 1); } |
| 357 }, | 357 }, |
| 358 { | 358 { |
| 359 exception: 'InvalidAccessError', | 359 exception: 'TypeError', |
| 360 func: function(mk6, type) { return mk6.createSession().gener
ateRequest(type, new Uint8Array(0)); } | 360 func: function(mk6, type) { return mk6.createSession().gener
ateRequest(type, new Uint8Array(0)); } |
| 361 } | 361 } |
| 362 ]; | 362 ]; |
| 363 | 363 |
| 364 async_test(function(test) | 364 async_test(function(test) |
| 365 { | 365 { |
| 366 var isWebmSupported; | 366 var isWebmSupported; |
| 367 var isCencSupported; | 367 var isCencSupported; |
| 368 | 368 |
| 369 isInitDataTypeSupported('webm').then(function(result) { | 369 isInitDataTypeSupported('webm').then(function(result) { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 }); | 406 }); |
| 407 }, 'Test MediaKeys generateRequest() exceptions.'); | 407 }, 'Test MediaKeys generateRequest() exceptions.'); |
| 408 | 408 |
| 409 var kLoadExceptionsTestCases = [ | 409 var kLoadExceptionsTestCases = [ |
| 410 // Too few parameters. | 410 // Too few parameters. |
| 411 { | 411 { |
| 412 exception: 'TypeError', | 412 exception: 'TypeError', |
| 413 func: function(mk1) { return mk1.createSession('temporary').
load(); } | 413 func: function(mk1) { return mk1.createSession('temporary').
load(); } |
| 414 }, | 414 }, |
| 415 // 'temporary' sessions are never allowed, so always return | 415 // 'temporary' sessions are never allowed, so always return |
| 416 // 'InvalidAccessError'. | 416 // 'TypeError'. |
| 417 { | 417 { |
| 418 exception: 'InvalidAccessError', | 418 exception: 'TypeError', |
| 419 func: function(mk3) { return mk3.createSession('temporary').
load(''); } | 419 func: function(mk3) { return mk3.createSession('temporary').
load(''); } |
| 420 }, | 420 }, |
| 421 { | 421 { |
| 422 exception: 'InvalidAccessError', | 422 exception: 'TypeError', |
| 423 func: function(mk4) { return mk4.createSession('temporary').
load(1); } | 423 func: function(mk4) { return mk4.createSession('temporary').
load(1); } |
| 424 }, | 424 }, |
| 425 { | 425 { |
| 426 exception: 'InvalidAccessError', | 426 exception: 'TypeError', |
| 427 func: function(mk5) { return mk5.createSession('temporary').
load('!@#$%^&*()'); } | 427 func: function(mk5) { return mk5.createSession('temporary').
load('!@#$%^&*()'); } |
| 428 }, | 428 }, |
| 429 { | 429 { |
| 430 exception: 'InvalidAccessError', | 430 exception: 'TypeError', |
| 431 func: function(mk6) { return mk6.createSession('temporary').
load('1234'); } | 431 func: function(mk6) { return mk6.createSession('temporary').
load('1234'); } |
| 432 } | 432 } |
| 433 ]; | 433 ]; |
| 434 | 434 |
| 435 async_test(function(test) | 435 async_test(function(test) |
| 436 { | 436 { |
| 437 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 437 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { |
| 438 return access.createMediaKeys(); | 438 return access.createMediaKeys(); |
| 439 }).then(function(mediaKeys) { | 439 }).then(function(mediaKeys) { |
| 440 var initData = stringToUint8Array('init data'); | 440 var initData = stringToUint8Array('init data'); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 }, | 609 }, |
| 610 { | 610 { |
| 611 exception: 'TypeError', | 611 exception: 'TypeError', |
| 612 func: function(s) { return s.update(undefined); } | 612 func: function(s) { return s.update(undefined); } |
| 613 }, | 613 }, |
| 614 { | 614 { |
| 615 exception: 'TypeError', | 615 exception: 'TypeError', |
| 616 func: function(s) { return s.update(1); } | 616 func: function(s) { return s.update(1); } |
| 617 }, | 617 }, |
| 618 { | 618 { |
| 619 exception: 'InvalidAccessError', | 619 exception: 'TypeError', |
| 620 func: function(s) { return s.update(new Uint8Array(0)); } | 620 func: function(s) { return s.update(new Uint8Array(0)); } |
| 621 } | 621 } |
| 622 ]; | 622 ]; |
| 623 | 623 |
| 624 async_test(function(test) | 624 async_test(function(test) |
| 625 { | 625 { |
| 626 var isWebmSupported; | 626 var isWebmSupported; |
| 627 var isCencSupported; | 627 var isCencSupported; |
| 628 | 628 |
| 629 isInitDataTypeSupported('webm').then(function(result) { | 629 isInitDataTypeSupported('webm').then(function(result) { |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 }, function(error) { | 815 }, function(error) { |
| 816 assert_equals(error.name, 'InvalidStateError'); | 816 assert_equals(error.name, 'InvalidStateError'); |
| 817 | 817 |
| 818 // remove() on a temporary session should fail. | 818 // remove() on a temporary session should fail. |
| 819 return mediaKeySession.generateRequest(type, initData); | 819 return mediaKeySession.generateRequest(type, initData); |
| 820 }).then(function(result) { | 820 }).then(function(result) { |
| 821 return mediaKeySession.remove(); | 821 return mediaKeySession.remove(); |
| 822 }).then(function(result) { | 822 }).then(function(result) { |
| 823 assert_unreached('remove() should not succeed for temporary
sessions'); | 823 assert_unreached('remove() should not succeed for temporary
sessions'); |
| 824 }, function(error) { | 824 }, function(error) { |
| 825 assert_equals(error.name, 'InvalidAccessError'); | 825 assert_equals(error.name, 'TypeError'); |
| 826 }); | 826 }); |
| 827 } | 827 } |
| 828 | 828 |
| 829 async_test(function(test) | 829 async_test(function(test) |
| 830 { | 830 { |
| 831 var isWebmSupported; | 831 var isWebmSupported; |
| 832 var isCencSupported; | 832 var isCencSupported; |
| 833 | 833 |
| 834 isInitDataTypeSupported('webm').then(function(result) { | 834 isInitDataTypeSupported('webm').then(function(result) { |
| 835 isWebmSupported = result; | 835 isWebmSupported = result; |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 { | 926 { |
| 927 exception: 'TypeError', | 927 exception: 'TypeError', |
| 928 func: function(mk) { return mk.setServerCertificate(undefine
d); } | 928 func: function(mk) { return mk.setServerCertificate(undefine
d); } |
| 929 }, | 929 }, |
| 930 { | 930 { |
| 931 exception: 'TypeError', | 931 exception: 'TypeError', |
| 932 func: function(mk) { return mk.setServerCertificate(1); } | 932 func: function(mk) { return mk.setServerCertificate(1); } |
| 933 }, | 933 }, |
| 934 // Empty array. | 934 // Empty array. |
| 935 { | 935 { |
| 936 exception: 'InvalidAccessError', | 936 exception: 'TypeError', |
| 937 func: function(mk) { return mk.setServerCertificate(new Uint
8Array(0)); } | 937 func: function(mk) { return mk.setServerCertificate(new Uint
8Array(0)); } |
| 938 } | 938 } |
| 939 ]; | 939 ]; |
| 940 | 940 |
| 941 async_test(function(test) | 941 async_test(function(test) |
| 942 { | 942 { |
| 943 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { | 943 navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).t
hen(function(access) { |
| 944 return access.createMediaKeys(); | 944 return access.createMediaKeys(); |
| 945 }).then(function(mediaKeys) { | 945 }).then(function(mediaKeys) { |
| 946 var promises = kSetServerCertificateExceptionsTestCases.map(
function(testCase) { | 946 var promises = kSetServerCertificateExceptionsTestCases.map(
function(testCase) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 new MediaKeyMessageEvent('eventType', { messageType: 'licens
e-request' } ); | 1029 new MediaKeyMessageEvent('eventType', { messageType: 'licens
e-request' } ); |
| 1030 }); | 1030 }); |
| 1031 }, 'Test MediaKeyMessageEvent.'); | 1031 }, 'Test MediaKeyMessageEvent.'); |
| 1032 | 1032 |
| 1033 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). | 1033 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). |
| 1034 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. | 1034 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. |
| 1035 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. | 1035 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. |
| 1036 </script> | 1036 </script> |
| 1037 </body> | 1037 </body> |
| 1038 </html> | 1038 </html> |
| OLD | NEW |