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 <div id="log"></div> | 10 <div id="log"></div> |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 exception: 'InvalidAccessError', | 308 exception: 'InvalidAccessError', |
309 func: function(mk6, type) { return mk6.createSession().gener
ateRequest(type, new Uint8Array(0)); } | 309 func: function(mk6, type) { return mk6.createSession().gener
ateRequest(type, new Uint8Array(0)); } |
310 } | 310 } |
311 ]; | 311 ]; |
312 | 312 |
313 async_test(function(test) | 313 async_test(function(test) |
314 { | 314 { |
315 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 315 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
316 return access.createMediaKeys(); | 316 return access.createMediaKeys(); |
317 }).then(function(mediaKeys) { | 317 }).then(function(mediaKeys) { |
| 318 // FIXME: Remove "video/" from the calls to isTypeSupported(
) once it is updated. |
| 319 // http://crbug.com/405731. |
318 var initData = stringToUint8Array('init data'); | 320 var initData = stringToUint8Array('init data'); |
319 var sessionPromises = kGenerateRequestExceptionsTestCases.ma
p(function(testCase) { | 321 var sessionPromises = kGenerateRequestExceptionsTestCases.ma
p(function(testCase) { |
320 return test_exception(testCase, mediaKeys, '', initData)
; | 322 return test_exception(testCase, mediaKeys, '', initData)
; |
321 }); | 323 }); |
322 | 324 |
323 // Test that WebM sessions generate the expected error, if | 325 // Test that WebM sessions generate the expected error, if |
324 // supported. | 326 // supported. |
325 if (isInitDataTypeSupported('webm')) { | 327 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
326 var WebmSessionPromises = kTypeSpecificGenerateRequestEx
ceptionsTestCases.map(function(testCase) { | 328 var WebmSessionPromises = kTypeSpecificGenerateRequestEx
ceptionsTestCases.map(function(testCase) { |
327 return test_exception(testCase, mediaKeys, 'webm', g
etInitData('webm')); | 329 return test_exception(testCase, mediaKeys, 'webm', g
etInitData('webm')); |
328 }); | 330 }); |
329 sessionPromises = sessionPromises.concat(WebmSessionProm
ises); | 331 sessionPromises = sessionPromises.concat(WebmSessionProm
ises); |
330 } | 332 } |
331 | 333 |
332 // Repeat for MP4, if supported. | 334 // Repeat for MP4, if supported. |
333 if (isInitDataTypeSupported('cenc')) { | 335 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
334 var mp4SessionPromises = kTypeSpecificGenerateRequestExc
eptionsTestCases.map(function(testCase) { | 336 var mp4SessionPromises = kTypeSpecificGenerateRequestExc
eptionsTestCases.map(function(testCase) { |
335 return test_exception(testCase, mediaKeys, 'cenc', g
etInitData('cenc')); | 337 return test_exception(testCase, mediaKeys, 'cenc', g
etInitData('cenc')); |
336 }); | 338 }); |
337 sessionPromises = sessionPromises.concat(mp4SessionPromi
ses); | 339 sessionPromises = sessionPromises.concat(mp4SessionPromi
ses); |
338 } | 340 } |
339 | 341 |
340 assert_not_equals(sessionPromises.length, 0); | 342 assert_not_equals(sessionPromises.length, 0); |
341 return Promise.all(sessionPromises); | 343 return Promise.all(sessionPromises); |
342 }).then(function(result) { | 344 }).then(function(result) { |
343 test.done(); | 345 test.done(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 exception: 'NotSupportedError', | 422 exception: 'NotSupportedError', |
421 func: function(mk16) { return mk16.createSession('persistent
').load('1234'); } | 423 func: function(mk16) { return mk16.createSession('persistent
').load('1234'); } |
422 } | 424 } |
423 ]; | 425 ]; |
424 | 426 |
425 async_test(function(test) | 427 async_test(function(test) |
426 { | 428 { |
427 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 429 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
428 return access.createMediaKeys(); | 430 return access.createMediaKeys(); |
429 }).then(function(mediaKeys) { | 431 }).then(function(mediaKeys) { |
| 432 // FIXME: Remove "video/" from the calls to isTypeSupported(
) once it is updated. |
| 433 // http://crbug.com/405731. |
430 var initData = stringToUint8Array('init data'); | 434 var initData = stringToUint8Array('init data'); |
431 var sessionPromises = kLoadExceptionsTestCases.map(function(
testCase) { | 435 var sessionPromises = kLoadExceptionsTestCases.map(function(
testCase) { |
432 return test_exception(testCase, mediaKeys); | 436 return test_exception(testCase, mediaKeys); |
433 }); | 437 }); |
434 | 438 |
435 assert_not_equals(sessionPromises.length, 0); | 439 assert_not_equals(sessionPromises.length, 0); |
436 return Promise.all(sessionPromises); | 440 return Promise.all(sessionPromises); |
437 }).then(function(result) { | 441 }).then(function(result) { |
438 test.done(); | 442 test.done(); |
439 }).catch(function(error) { | 443 }).catch(function(error) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 543 |
540 async_test(function(test) | 544 async_test(function(test) |
541 { | 545 { |
542 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 546 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
543 return access.createMediaKeys(); | 547 return access.createMediaKeys(); |
544 }).then(function(mediaKeys) { | 548 }).then(function(mediaKeys) { |
545 var sessionPromises = []; | 549 var sessionPromises = []; |
546 | 550 |
547 // Test that WebM sessions generate the expected error, if | 551 // Test that WebM sessions generate the expected error, if |
548 // supported. | 552 // supported. |
549 if (isInitDataTypeSupported('webm')) { | 553 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
550 var WebmSessionPromises = kCreateSessionTestCases.map(fu
nction(testCase) { | 554 var WebmSessionPromises = kCreateSessionTestCases.map(fu
nction(testCase) { |
551 return test_generateRequest(testCase, mediaKeys, 'we
bm', getInitData('webm')); | 555 return test_generateRequest(testCase, mediaKeys, 'we
bm', getInitData('webm')); |
552 }); | 556 }); |
553 sessionPromises = sessionPromises.concat(WebmSessionProm
ises); | 557 sessionPromises = sessionPromises.concat(WebmSessionProm
ises); |
554 } | 558 } |
555 | 559 |
556 // Repeat for MP4, if supported. | 560 // Repeat for MP4, if supported. |
557 if (isInitDataTypeSupported('cenc')) { | 561 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
558 var mp4SessionPromises = kCreateSessionTestCases.map(fun
ction(testCase) { | 562 var mp4SessionPromises = kCreateSessionTestCases.map(fun
ction(testCase) { |
559 return test_generateRequest(testCase, mediaKeys, 'ce
nc', getInitData('cenc')); | 563 return test_generateRequest(testCase, mediaKeys, 'ce
nc', getInitData('cenc')); |
560 }); | 564 }); |
561 sessionPromises = sessionPromises.concat(mp4SessionPromi
ses); | 565 sessionPromises = sessionPromises.concat(mp4SessionPromi
ses); |
562 } | 566 } |
563 | 567 |
564 assert_not_equals(sessionPromises.length, 0); | 568 assert_not_equals(sessionPromises.length, 0); |
565 return Promise.all(sessionPromises); | 569 return Promise.all(sessionPromises); |
566 }).then(function(result) { | 570 }).then(function(result) { |
567 test.done(); | 571 test.done(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } | 608 } |
605 ]; | 609 ]; |
606 | 610 |
607 async_test(function(test) | 611 async_test(function(test) |
608 { | 612 { |
609 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 613 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
610 return access.createMediaKeys(); | 614 return access.createMediaKeys(); |
611 }).then(function(mediaKeys) { | 615 }).then(function(mediaKeys) { |
612 var promises = []; | 616 var promises = []; |
613 | 617 |
614 if (isInitDataTypeSupported('webm')) { | 618 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
615 var WebmSessionPromises = kUpdateSessionExceptionsTestCa
ses.map(function(testCase) { | 619 var WebmSessionPromises = kUpdateSessionExceptionsTestCa
ses.map(function(testCase) { |
616 var mediaKeySession = mediaKeys.createSession(); | 620 var mediaKeySession = mediaKeys.createSession(); |
617 return mediaKeySession.generateRequest('webm', getIn
itData('webm')).then(function(result) { | 621 return mediaKeySession.generateRequest('webm', getIn
itData('webm')).then(function(result) { |
618 return test_exception(testCase, mediaKeySession)
; | 622 return test_exception(testCase, mediaKeySession)
; |
619 }); | 623 }); |
620 }); | 624 }); |
621 promises = promises.concat(WebmSessionPromises); | 625 promises = promises.concat(WebmSessionPromises); |
622 } | 626 } |
623 | 627 |
624 if (isInitDataTypeSupported('cenc')) { | 628 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
625 var mp4SessionPromises = kUpdateSessionExceptionsTestCas
es.map(function(testCase) { | 629 var mp4SessionPromises = kUpdateSessionExceptionsTestCas
es.map(function(testCase) { |
626 var mediaKeySession = mediaKeys.createSession(); | 630 var mediaKeySession = mediaKeys.createSession(); |
627 return mediaKeySession.generateRequest('cenc', getInit
Data('cenc')).then(function(result) { | 631 return mediaKeySession.generateRequest('cenc', getInit
Data('cenc')).then(function(result) { |
628 return test_exception(testCase, mediaKeySession); | 632 return test_exception(testCase, mediaKeySession); |
629 }); | 633 }); |
630 }); | 634 }); |
631 promises = promises.concat(mp4SessionPromises); | 635 promises = promises.concat(mp4SessionPromises); |
632 } | 636 } |
633 | 637 |
634 assert_not_equals(promises.length, 0); | 638 assert_not_equals(promises.length, 0); |
(...skipping 20 matching lines...) Expand all Loading... |
655 return promise; | 659 return promise; |
656 } | 660 } |
657 | 661 |
658 async_test(function(test) | 662 async_test(function(test) |
659 { | 663 { |
660 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 664 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
661 return access.createMediaKeys(); | 665 return access.createMediaKeys(); |
662 }).then(function(mediaKeys) { | 666 }).then(function(mediaKeys) { |
663 var promises = []; | 667 var promises = []; |
664 | 668 |
665 if (isInitDataTypeSupported('webm')) { | 669 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm')
) { |
666 promises.push(create_update_test(mediaKeys, 'webm', getIni
tData('webm'))); | 670 promises.push(create_update_test(mediaKeys, 'webm', getIni
tData('webm'))); |
667 } | 671 } |
668 | 672 |
669 if (isInitDataTypeSupported('cenc')) { | 673 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'))
{ |
670 promises.push(create_update_test(mediaKeys, 'cenc', getIni
tData('cenc'))); | 674 promises.push(create_update_test(mediaKeys, 'cenc', getIni
tData('cenc'))); |
671 } | 675 } |
672 | 676 |
673 assert_not_equals(promises.length, 0); | 677 assert_not_equals(promises.length, 0); |
674 return Promise.all(promises); | 678 return Promise.all(promises); |
675 }).then(function(result) { | 679 }).then(function(result) { |
676 test.done(); | 680 test.done(); |
677 }).catch(function(error) { | 681 }).catch(function(error) { |
678 forceTestFailureFromPromise(test, error, 'update() tests fai
led'); | 682 forceTestFailureFromPromise(test, error, 'update() tests fai
led'); |
679 }); | 683 }); |
(...skipping 11 matching lines...) Expand all Loading... |
691 }); | 695 }); |
692 } | 696 } |
693 | 697 |
694 async_test(function(test) | 698 async_test(function(test) |
695 { | 699 { |
696 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 700 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
697 return access.createMediaKeys(); | 701 return access.createMediaKeys(); |
698 }).then(function(mediaKeys) { | 702 }).then(function(mediaKeys) { |
699 var promises = []; | 703 var promises = []; |
700 | 704 |
701 if (isInitDataTypeSupported('webm')) { | 705 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
702 promises.push(create_close_exception_test(mediaKeys, 'we
bm', getInitData('webm'))); | 706 promises.push(create_close_exception_test(mediaKeys, 'we
bm', getInitData('webm'))); |
703 } | 707 } |
704 | 708 |
705 if (isInitDataTypeSupported('cenc')) { | 709 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
706 promises.push(create_close_exception_test(mediaKeys, 'ce
nc', getInitData('cenc'))); | 710 promises.push(create_close_exception_test(mediaKeys, 'ce
nc', getInitData('cenc'))); |
707 } | 711 } |
708 | 712 |
709 assert_not_equals(promises.length, 0); | 713 assert_not_equals(promises.length, 0); |
710 return Promise.all(promises); | 714 return Promise.all(promises); |
711 }).then(function(result) { | 715 }).then(function(result) { |
712 test.done(); | 716 test.done(); |
713 }).catch(function(error) { | 717 }).catch(function(error) { |
714 forceTestFailureFromPromise(test, error, 'close() exception
tests failed'); | 718 forceTestFailureFromPromise(test, error, 'close() exception
tests failed'); |
715 }); | 719 }); |
(...skipping 13 matching lines...) Expand all Loading... |
729 return promise; | 733 return promise; |
730 } | 734 } |
731 | 735 |
732 async_test(function(test) | 736 async_test(function(test) |
733 { | 737 { |
734 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 738 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
735 return access.createMediaKeys(); | 739 return access.createMediaKeys(); |
736 }).then(function(mediaKeys) { | 740 }).then(function(mediaKeys) { |
737 var promises = []; | 741 var promises = []; |
738 | 742 |
739 if (isInitDataTypeSupported('webm')) { | 743 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
740 promises.push(create_close_test(mediaKeys, 'webm', getIn
itData('webm'))); | 744 promises.push(create_close_test(mediaKeys, 'webm', getIn
itData('webm'))); |
741 } | 745 } |
742 | 746 |
743 if (isInitDataTypeSupported('cenc')) { | 747 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
744 promises.push(create_close_test(mediaKeys, 'cenc', getIn
itData('cenc'))); | 748 promises.push(create_close_test(mediaKeys, 'cenc', getIn
itData('cenc'))); |
745 } | 749 } |
746 | 750 |
747 assert_not_equals(promises.length, 0); | 751 assert_not_equals(promises.length, 0); |
748 return Promise.all(promises); | 752 return Promise.all(promises); |
749 }).then(function(result) { | 753 }).then(function(result) { |
750 test.done(); | 754 test.done(); |
751 }).catch(function(error) { | 755 }).catch(function(error) { |
752 forceTestFailureFromPromise(test, error, 'close() tests fail
ed'); | 756 forceTestFailureFromPromise(test, error, 'close() tests fail
ed'); |
753 }); | 757 }); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 }); | 792 }); |
789 } | 793 } |
790 | 794 |
791 async_test(function(test) | 795 async_test(function(test) |
792 { | 796 { |
793 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 797 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
794 return access.createMediaKeys(); | 798 return access.createMediaKeys(); |
795 }).then(function(mediaKeys) { | 799 }).then(function(mediaKeys) { |
796 var promises = []; | 800 var promises = []; |
797 | 801 |
798 if (isInitDataTypeSupported('webm')) { | 802 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
799 promises.push(create_remove_exception_test(mediaKeys, 'w
ebm', getInitData('webm'))); | 803 promises.push(create_remove_exception_test(mediaKeys, 'w
ebm', getInitData('webm'))); |
800 } | 804 } |
801 | 805 |
802 if (isInitDataTypeSupported('cenc')) { | 806 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
803 promises.push(create_remove_exception_test(mediaKeys, 'c
enc', getInitData('cenc'))); | 807 promises.push(create_remove_exception_test(mediaKeys, 'c
enc', getInitData('cenc'))); |
804 } | 808 } |
805 | 809 |
806 assert_not_equals(promises.length, 0); | 810 assert_not_equals(promises.length, 0); |
807 return Promise.all(promises); | 811 return Promise.all(promises); |
808 }).then(function(result) { | 812 }).then(function(result) { |
809 test.done(); | 813 test.done(); |
810 }).catch(function(error) { | 814 }).catch(function(error) { |
811 forceTestFailureFromPromise(test, error, 'remove() exception
tests failed'); | 815 forceTestFailureFromPromise(test, error, 'remove() exception
tests failed'); |
812 }); | 816 }); |
(...skipping 15 matching lines...) Expand all Loading... |
828 }); | 832 }); |
829 } | 833 } |
830 | 834 |
831 async_test(function(test) | 835 async_test(function(test) |
832 { | 836 { |
833 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { | 837 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
834 return access.createMediaKeys(); | 838 return access.createMediaKeys(); |
835 }).then(function(mediaKeys) { | 839 }).then(function(mediaKeys) { |
836 var promises = []; | 840 var promises = []; |
837 | 841 |
838 if (isInitDataTypeSupported('webm')) { | 842 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/webm
')) { |
839 promises.push(create_remove_test(mediaKeys, 'webm', getI
nitData('webm'))); | 843 promises.push(create_remove_test(mediaKeys, 'webm', getI
nitData('webm'))); |
840 } | 844 } |
841 | 845 |
842 if (isInitDataTypeSupported('cenc')) { | 846 if (MediaKeys.isTypeSupported('org.w3.clearkey', 'video/mp4'
)) { |
843 promises.push(create_remove_test(mediaKeys, 'cenc', getI
nitData('cenc'))); | 847 promises.push(create_remove_test(mediaKeys, 'cenc', getI
nitData('cenc'))); |
844 } | 848 } |
845 | 849 |
846 assert_not_equals(promises.length, 0); | 850 assert_not_equals(promises.length, 0); |
847 return Promise.all(promises); | 851 return Promise.all(promises); |
848 }).then(function(result) { | 852 }).then(function(result) { |
849 test.done(); | 853 test.done(); |
850 }).catch(function(error) { | 854 }).catch(function(error) { |
851 forceTestFailureFromPromise(test, error, 'remove() tests fai
led'); | 855 forceTestFailureFromPromise(test, error, 'remove() tests fai
led'); |
852 }); | 856 }); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 | 916 |
913 // FIXME: Add test for successful setServerCertificate(). Note that | 917 // FIXME: Add test for successful setServerCertificate(). Note that |
914 // ClearKey does not support it. | 918 // ClearKey does not support it. |
915 | 919 |
916 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). | 920 // FIXME: Add syntax checks for MediaKeys.IsTypeSupported(). |
917 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. | 921 // FIXME: Add syntax checks for MediaKeyError and MediaKeySession ev
ents. |
918 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. | 922 // FIXME: Add HTMLMediaElement syntax checks, e.g. setMediaKeys, med
iakeys, onencrypted. |
919 </script> | 923 </script> |
920 </body> | 924 </body> |
921 </html> | 925 </html> |
OLD | NEW |