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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/update-disallowed-input.js

Issue 2546853003: Add W3C encrypted-media tests (Closed)
Patch Set: rebase now that content files landed Created 4 years 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
(Empty)
1 function runTest(config)
2 {
3 // This test passes |response| to update() as a JSON Web Key Set.
4 // CDMs other than Clear Key won't expect |response| in this format.
5 promise_test(function(test) {
6 var initDataType;
7 var initData;
8 var keySystem = config.keysystem;
9 var mediaKeySession;
10
11 function createReallyLongJWKSet()
12 {
13 // This is just a standard JWKSet with a lot of
14 // extra items added to the end. Key ID and key
15 // doesn't really matter.
16 var jwkSet = '{"keys":[{'
17 + '"kty":"oct",'
18 + '"k":"MDEyMzQ1Njc4OTAxMjM0NQ",'
19 + '"kid":"MDEyMzQ1Njc4OTAxMjM0NQ"'
20 + '}]';
21 return jwkSet + ',"test":"unknown"'.repeat(4000) + '}';
22 }
23
24 return navigator.requestMediaKeySystemAccess(keySystem, getSimpleConfigu ration()).then(function(access) {
25 initDataType = access.getConfiguration().initDataTypes[0];
26 initData = getInitData(initDataType);
27 return access.createMediaKeys();
28 }).then(function(mediaKeys) {
29 mediaKeySession = mediaKeys.createSession();
30 var eventWatcher = new EventWatcher(test, mediaKeySession, ['message ']);
31 var promise = eventWatcher.wait_for('message');
32 mediaKeySession.generateRequest(initDataType, initData);
33 return promise;
34 }).then(function () {
35 var jwkSet = createReallyLongJWKSet();
36 assert_greater_than(jwkSet.length, 65536);
37 var jwkSetArray = stringToUint8Array(jwkSet);
38 return mediaKeySession.update(jwkSetArray);
39 }).then(function () {
40 assert_unreached('update() with a response longer than 64Kb succeed' );
41 }).catch(function (error) {
42 assert_equals(error.name, 'TypeError');
43 });
44 }, 'update() with invalid response (longer than 64Kb characters) should fail .');
45 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698