Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-generate-request-disallowed-input.html

Issue 2342953002: Update EME errors to use TypeError (Closed)
Patch Set: changes Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test handling of invalid initData for generateRequest().</title> 4 <title>Test handling of invalid initData for generateRequest().</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>
11 // Create a session and call generateRequest() with |initDataType| 11 // Create a session and call generateRequest() with |initDataType|
12 // and |initData|. generateRequest() should fail with an 12 // and |initData|. generateRequest() should fail with an
13 // InvalidAccessError. Returns a promise that resolves successfully 13 // TypeError. Returns a promise that resolves successfully
14 // if the error happened, rejects otherwise. 14 // if the error happened, rejects otherwise.
15 function test_session(initDataType, initData) 15 function test_session(initDataType, initData)
16 { 16 {
17 return isInitDataTypeSupported(initDataType).then(function(resul t) { 17 return isInitDataTypeSupported(initDataType).then(function(resul t) {
18 // If |initDataType| is not supported, simply succeed. 18 // If |initDataType| is not supported, simply succeed.
19 if (!result) 19 if (!result)
20 return Promise.resolve('Not supported'); 20 return Promise.resolve('Not supported');
21 21
22 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', getSimpleConfigurationForInitDataType(initDataType)).then(function(access) { 22 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
23 return access.createMediaKeys(); 23 return access.createMediaKeys();
24 }).then(function(mediaKeys) { 24 }).then(function(mediaKeys) {
25 var mediaKeySession = mediaKeys.createSession(); 25 var mediaKeySession = mediaKeys.createSession();
26 return mediaKeySession.generateRequest(initDataType, ini tData); 26 return mediaKeySession.generateRequest(initDataType, ini tData);
27 }).then(function() { 27 }).then(function() {
28 assert_unreached('generateRequest() succeeded'); 28 assert_unreached('generateRequest() succeeded');
29 }, function(error) { 29 }, function(error) {
30 assert_equals(error.name, 'InvalidAccessError'); 30 assert_equals(error.name, 'TypeError');
31 return Promise.resolve('success'); 31 return Promise.resolve('success');
32 }); 32 });
33 }) 33 })
34 } 34 }
35 35
36 promise_test(function() 36 promise_test(function()
37 { 37 {
38 var initData = new Uint8Array(70000); 38 var initData = new Uint8Array(70000);
39 return test_session('webm', initData); 39 return test_session('webm', initData);
40 }, 'generateRequest() with webm initData longer than 64Kb characters .'); 40 }, 'generateRequest() with webm initData longer than 64Kb characters .');
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 promise_test(function() 93 promise_test(function()
94 { 94 {
95 // Valid key ID size must be less than 512 characters for keyids . 95 // Valid key ID size must be less than 512 characters for keyids .
96 var keyId = new Uint8Array(600); 96 var keyId = new Uint8Array(600);
97 var initData = stringToUint8Array(createKeyIDs(keyId)); 97 var initData = stringToUint8Array(createKeyIDs(keyId));
98 return test_session('keyids', initData); 98 return test_session('keyids', initData);
99 }, 'generateRequest() with too long key ID.'); 99 }, 'generateRequest() with too long key ID.');
100 </script> 100 </script>
101 </body> 101 </body>
102 </html> 102 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698