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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/expiration.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,qualifier) {
2
3 var testname = testnamePrefix(qualifier, config.keysystem) + ', expiration';
4
5 var configuration = getSimpleConfigurationForContent(config.content);
6 if (config.initDataType && config.initData) {
7 configuration.initDataTypes = [config.initDataType];
8 }
9
10 async_test(function(test) {
11
12 var _mediaKeys,
13 _mediaKeySession;
14
15 function onFailure(error) {
16 forceTestFailureFromPromise(test, error);
17 }
18
19 function onMessage(event) {
20 assert_equals(event.target, _mediaKeySession);
21 assert_true(event instanceof window.MediaKeyMessageEvent);
22 assert_equals(event.type, 'message');
23
24 assert_in_array(event.messageType, [ 'license-request', 'individuali zation-request' ] );
25
26 config.messagehandler(event.messageType, event.message, {expiration: config.expiration}).then(function(response) {
27 return event.target.update(response);
28 }).then(test.step_func(function() {
29 assert_approx_equals(event.target.expiration, config.expiration, 4000, "expiration attribute should equal provided expiration time");
30 test.done();
31 })).catch(onFailure);
32 }
33
34 navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]) .then(function(access) {
35 return access.createMediaKeys();
36 }).then(function(mediaKeys) {
37 _mediaKeys = mediaKeys;
38 _mediaKeySession = _mediaKeys.createSession( 'temporary' );
39 waitForEventAndRunStep('message', _mediaKeySession, onMessage, test) ;
40 return _mediaKeySession.generateRequest(config.initDataType, config. initData);
41 }).catch(onFailure);
42 }, testname);
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698