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

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

Issue 2084053002: EME: Update tests so 'audioCapabilities' always provided (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes (+rebase) Created 4 years, 5 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 <div id="log"></div> 10 <div id="log"></div>
11 <script> 11 <script>
12 // Create a session and call generateRequest() with |initDataType| 12 // Create a session and call generateRequest() with |initDataType|
13 // and |initData|. generateRequest() should fail with an 13 // and |initData|. generateRequest() should fail with an
14 // InvalidAccessError. Returns a promise that resolves successfully 14 // InvalidAccessError. Returns a promise that resolves successfully
15 // if the error happened, rejects otherwise. 15 // if the error happened, rejects otherwise.
16 function test_session(initDataType, initData) 16 function test_session(initDataType, initData)
17 { 17 {
18 return isInitDataTypeSupported(initDataType).then(function(resul t) { 18 return isInitDataTypeSupported(initDataType).then(function(resul t) {
19 // If |initDataType| is not supported, simply succeed. 19 // If |initDataType| is not supported, simply succeed.
20 if (!result) 20 if (!result)
21 return Promise.resolve('Not supported'); 21 return Promise.resolve('Not supported');
22 22
23 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', [{}]).then(function(access) { 23 return navigator.requestMediaKeySystemAccess('org.w3.clearke y', getSimpleConfigurationForInitDataType(initDataType)).then(function(access) {
24 return access.createMediaKeys(); 24 return access.createMediaKeys();
25 }).then(function(mediaKeys) { 25 }).then(function(mediaKeys) {
26 var mediaKeySession = mediaKeys.createSession(); 26 var mediaKeySession = mediaKeys.createSession();
27 return mediaKeySession.generateRequest(initDataType, ini tData); 27 return mediaKeySession.generateRequest(initDataType, ini tData);
28 }).then(function() { 28 }).then(function() {
29 assert_unreached('generateRequest() succeeded'); 29 assert_unreached('generateRequest() succeeded');
30 }, function(error) { 30 }, function(error) {
31 assert_equals(error.name, 'InvalidAccessError'); 31 assert_equals(error.name, 'InvalidAccessError');
32 return Promise.resolve('success'); 32 return Promise.resolve('success');
33 }); 33 });
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 promise_test(function() 94 promise_test(function()
95 { 95 {
96 // Valid key ID size must be less than 512 characters for keyids . 96 // Valid key ID size must be less than 512 characters for keyids .
97 var keyId = new Uint8Array(600); 97 var keyId = new Uint8Array(600);
98 var initData = stringToUint8Array(createKeyIDs(keyId)); 98 var initData = stringToUint8Array(createKeyIDs(keyId));
99 return test_session('keyids', initData); 99 return test_session('keyids', initData);
100 }, 'generateRequest() with too long key ID.'); 100 }, 'generateRequest() with too long key ID.');
101 </script> 101 </script>
102 </body> 102 </body>
103 </html> 103 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698