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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/setmediakeys-multiple-times-with-the-same-mediakeys.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 var testname = testnamePrefix( qualifier, config.keysystem )
3 + ', setmediakeys multiple times with the same mediakey s';
4
5 var configuration = getSimpleConfigurationForContent( config.content );
6
7 if ( config.initDataType && config.initData ) {
8 configuration.initDataTypes = [ config.initDataType ];
9 }
10
11 async_test (function (test) {
12 var _video = config.video,
13 _mediaKeys;
14
15 // Test MediaKeys assignment.
16 assert_equals(_video.mediaKeys, null);
17 assert_equals(typeof _video.setMediaKeys, 'function');
18
19 function onFailure(error) {
20 forceTestFailureFromPromise(test, error);
21 }
22
23 navigator.requestMediaKeySystemAccess(config.keysystem, [configuration]) .then(function(access) {
24 return access.createMediaKeys();
25 }).then(function(result) {
26 _mediaKeys = result;
27 // Set mediaKeys for first time on video should work.
28 return _video.setMediaKeys(_mediaKeys);
29 }).then(function(result) {
30 assert_equals(_video.mediaKeys, _mediaKeys);
31 // Set mediaKeys on video again should return a resolved promise.
32 return _video.setMediaKeys(_mediaKeys);
33 }).then(function (result) {
34 assert_equals(_video.mediaKeys, _mediaKeys);
35 return testmediasource(config);
36 }).then(function(source) {
37 // Set src attribute on Video Element
38 _video.src = URL.createObjectURL(source);
39 // Set mediaKeys again on video should still return a resolved promi se.
40 return _video.setMediaKeys(_mediaKeys);
41 }).then(function() {
42 assert_equals(_video.mediaKeys, _mediaKeys);
43 test.done();
44 }).catch(onFailure);
45 }, testname);
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698