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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 | 799 |
800 assert_not_equals(promises.length, 0); | 800 assert_not_equals(promises.length, 0); |
801 return Promise.all(promises); | 801 return Promise.all(promises); |
802 }).then(function(result) { | 802 }).then(function(result) { |
803 test.done(); | 803 test.done(); |
804 }).catch(function(error) { | 804 }).catch(function(error) { |
805 forceTestFailureFromPromise(test, error, 'close() tests fail ed'); | 805 forceTestFailureFromPromise(test, error, 'close() tests fail ed'); |
806 }); | 806 }); |
807 }, 'Test MediaKeySession close().'); | 807 }, 'Test MediaKeySession close().'); |
808 | 808 |
809 function create_remove_exception_test(mediaKeys, type, initData) | 809 function create_remove_exception_test(mediaKeys, type, initData) |
xhwang
2017/04/21 18:00:28
Now there's no exception... what's the value of th
jrummell
2017/04/22 00:23:17
"exception" means failure.
Test still verifies th
| |
810 { | 810 { |
811 // remove() on an uninitialized session should fail. | 811 // remove() on an uninitialized session should fail. |
812 var mediaKeySession = mediaKeys.createSession('temporary'); | 812 var mediaKeySession = mediaKeys.createSession('temporary'); |
813 return mediaKeySession.remove().then(function(result) { | 813 return mediaKeySession.remove().then(function(result) { |
814 assert_unreached('remove() should not succeed if session uni nitialized'); | 814 assert_unreached('remove() should not succeed if session uni nitialized'); |
815 }, function(error) { | 815 }, function(error) { |
816 assert_equals(error.name, 'InvalidStateError'); | 816 assert_equals(error.name, 'InvalidStateError'); |
817 | |
818 // remove() on a temporary session should fail. | |
819 return mediaKeySession.generateRequest(type, initData); | |
820 }).then(function(result) { | |
821 return mediaKeySession.remove(); | |
822 }).then(function(result) { | |
823 assert_unreached('remove() should not succeed for temporary sessions'); | |
824 }, function(error) { | |
825 assert_equals(error.name, 'TypeError'); | |
826 }); | 817 }); |
827 } | 818 } |
828 | 819 |
829 async_test(function(test) | 820 async_test(function(test) |
830 { | 821 { |
831 var isWebmSupported; | 822 var isWebmSupported; |
832 var isCencSupported; | 823 var isCencSupported; |
833 | 824 |
834 isInitDataTypeSupported('webm').then(function(result) { | 825 isInitDataTypeSupported('webm').then(function(result) { |
835 isWebmSupported = result; | 826 isWebmSupported = result; |
(...skipping 18 matching lines...) Expand all Loading... | |
854 return Promise.all(promises); | 845 return Promise.all(promises); |
855 }).then(function(result) { | 846 }).then(function(result) { |
856 test.done(); | 847 test.done(); |
857 }).catch(function(error) { | 848 }).catch(function(error) { |
858 forceTestFailureFromPromise(test, error, 'remove() exception tests failed'); | 849 forceTestFailureFromPromise(test, error, 'remove() exception tests failed'); |
859 }); | 850 }); |
860 }, 'Test MediaKeySession remove() exceptions.'); | 851 }, 'Test MediaKeySession remove() exceptions.'); |
861 | 852 |
862 function create_remove_test(mediaKeys, type, initData) | 853 function create_remove_test(mediaKeys, type, initData) |
863 { | 854 { |
864 // Clear Key may not support persistent-license sessions. | 855 var mediaKeySession = mediaKeys.createSession(); |
865 var mediaKeySession; | 856 var promise = mediaKeySession.generateRequest(type, initData).th en(function(result) { |
866 try { | |
867 mediaKeySession = mediaKeys.createSession('persistent-licens e'); | |
868 } catch (error) { | |
869 // Not supported, so return a resolved promise. | |
870 assert_equals(error.name, 'NotSupportedError'); | |
871 return Promise.resolve(); | |
872 } | |
873 return mediaKeySession.generateRequest(type, initData).then(func tion(result) { | |
874 return mediaKeySession.remove(); | 857 return mediaKeySession.remove(); |
858 }).then(function() { | |
859 // remove() doesn't close the session, so must call close(). | |
860 return mediaKeySession.close(); | |
861 }).then(function() { | |
862 try { | |
863 // Clear Key may not support persistent-license sessions . | |
864 mediaKeySession = mediaKeys.createSession('persistent-li cense'); | |
865 return mediaKeySession.generateRequest(type, initData).t hen(function(result) { | |
866 return mediaKeySession.remove(); | |
867 }).then(function() { | |
868 return mediaKeySession.close(); | |
869 }); | |
870 } catch (error) { | |
871 // Not supported, so return a resolved promise. | |
872 assert_equals(error.name, 'NotSupportedError'); | |
873 return Promise.resolve(); | |
xhwang
2017/04/21 18:00:28
We probably should have a new test covering the ke
jrummell
2017/04/22 00:23:17
New test added.
| |
874 } | |
875 }); | 875 }); |
876 } | 876 } |
877 | 877 |
878 async_test(function(test) | 878 async_test(function(test) |
879 { | 879 { |
880 var isWebmSupported; | 880 var isWebmSupported; |
881 var isCencSupported; | 881 var isCencSupported; |
882 | 882 |
883 isInitDataTypeSupported('webm').then(function(result) { | 883 isInitDataTypeSupported('webm').then(function(result) { |
884 isWebmSupported = result; | 884 isWebmSupported = result; |
(...skipping 144 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 |