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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/events-session-closed-event.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) + ' test MediaKey Session closed event.';
4
5 var configuration = {
6 initDataTypes: [config.initDataType],
7 audioCapabilities: [{
8 contentType: config.audioType
9 }],
10 videoCapabilities: [{
11 contentType: config.videoType
12 }],
13 sessionTypes: ['temporary']
14 };
15
16 promise_test(function (test) {
17 var initDataType;
18 var initData;
19 var mediaKeySession;
20
21 return navigator.requestMediaKeySystemAccess(config.keysystem, [configur ation]).then(function (access) {
22 initDataType = access.getConfiguration().initDataTypes[0];
23 return access.createMediaKeys();
24 }).then(function (mediaKeys) {
25 mediaKeySession = mediaKeys.createSession();
26 if(config.initData) {
27 initData = config.initData;
28 } else {
29 initData = stringToUint8Array(atob(config.content.keys[0].initDa ta));
30 }
31 return mediaKeySession.generateRequest(initDataType, initData);
32 }).then(function() {
33 // close() should result in the closed promise being
34 // fulfilled.
35 return mediaKeySession.close();
36 }).then(function (result) {
37 assert_equals(result, undefined);
38 // Wait for the session to be closed.
39 return mediaKeySession.closed;
40 }).then(function (result) {
41 assert_equals(result, undefined);
42 // Now that the session is closed, verify that the
43 // closed attribute immediately returns a fulfilled
44 // promise.
45 return mediaKeySession.closed;
46 }).then(function (result) {
47 assert_equals(result, undefined);
48 }).catch(function(error) {
49 assert_unreached('Error: ' + error.name);
50 });
51 }, testname);
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698