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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/invalid-license.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 promise_test(function (test) {
4 var initDataType;
5 var initData;
6 var keySystem = config.keysystem;
7 var invalidLicense = new Uint8Array([0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77]);
8 var messageEventFired = false;
9
10 return navigator.requestMediaKeySystemAccess(keySystem, getSimpleConfigu ration()).then(function (access) {
11 initDataType = access.getConfiguration().initDataTypes[0];
12 initData = getInitData(initDataType);
13 return access.createMediaKeys();
14 }).then(function (mediaKeys) {
15 var keySession = mediaKeys.createSession();
16 var eventWatcher = new EventWatcher(test, keySession, ['message']);
17 var promise = eventWatcher.wait_for('message');
18 keySession.generateRequest(initDataType, initData);
19 return promise;
20 }).then(function (messageEvent) {
21 messageEventFired = true;
22 return messageEvent.target.update(invalidLicense);
23 }).then(function () {
24 assert_unreached('Error: update() should fail because of an invalid license.');
25 }).catch(function (error) {
26 if(messageEventFired) {
27 assert_equals(error.name, 'TypeError');
28 } else {
29 assert_unreached('Error: ' + error.name);
30 }
31 });
32 }, 'Update with invalid Clear Key license');
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698