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

Side by Side Diff: media/test/data/eme_player_js/player_utils.js

Issue 544283002: Update eme_player to handle MediaKeySession.generateRequest() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The PlayerUtils provides utility functions to binding common media events 5 // The PlayerUtils provides utility functions to binding common media events
6 // to specific player functions. It also provides functions to load media source 6 // to specific player functions. It also provides functions to load media source
7 // base on test configurations. 7 // base on test configurations.
8 var PlayerUtils = new function() { 8 var PlayerUtils = new function() {
9 } 9 }
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 }); 50 });
51 mediaKeySession.addEventListener('error', function(error) { 51 mediaKeySession.addEventListener('error', function(error) {
52 Utils.failTest(error, KEY_ERROR); 52 Utils.failTest(error, KEY_ERROR);
53 }); 53 });
54 } 54 }
55 55
56 Utils.timeLog('Creating new media key session for contentType: ' + 56 Utils.timeLog('Creating new media key session for contentType: ' +
57 message.contentType + ', initData: ' + 57 message.contentType + ', initData: ' +
58 Utils.getHexString(message.initData)); 58 Utils.getHexString(message.initData));
59 try { 59 try {
60 var session = message.target.mediaKeys.createSession( 60 if (message.target.mediaKeys.createSession.length == 0) {
61 message.contentType, message.initData); 61 // FIXME(jrummell): Remove this test (and else branch) once blink
62 if (PROMISES_SUPPORTED) { 62 // uses the new API.
63 session.then(addMediaKeySessionListeners) 63 var session = message.target.mediaKeys.createSession();
64 .catch (function(error) { 64 addMediaKeySessionListeners(session);
65 Utils.failTest(error, KEY_ERROR); 65 session.generateRequest(message.contentType, message.initData)
66 }); 66 .catch (function(error) {
ddorwin 2014/09/08 17:50:09 remove the space here and below
jrummell 2014/09/08 18:21:05 Done. Note that clang-format wants to put the spac
67 Utils.failTest(error, KEY_ERROR);
ddorwin 2014/09/08 17:50:09 What is KEY_ERROR? Why do these all fail with that
jrummell 2014/09/08 18:21:05 KEY_ERROR is simply the string "KEY_ERROR". It is
68 });
67 } else { 69 } else {
68 addMediaKeySessionListeners(session); 70 var session = message.target.mediaKeys.createSession(
71 message.contentType, message.initData);
72 if (PROMISES_SUPPORTED) {
ddorwin 2014/09/08 17:50:09 Can we remove this now? Probably in a separate CL
jrummell 2014/09/08 18:21:05 Yes. However, this test is done in several files,
73 session.then(addMediaKeySessionListeners)
74 .catch (function(error) {
75 Utils.failTest(error, KEY_ERROR);
76 });
77 } else {
78 addMediaKeySessionListeners(session);
79 }
69 } 80 }
70 } catch (e) { 81 } catch (e) {
71 Utils.failTest(e); 82 Utils.failTest(e);
72 } 83 }
73 }); 84 });
74 this.registerDefaultEventListeners(player); 85 this.registerDefaultEventListeners(player);
75 try { 86 try {
76 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); 87 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
77 if (PROMISES_SUPPORTED) { 88 if (PROMISES_SUPPORTED) {
78 MediaKeys.create(player.testConfig.keySystem).then(function(mediaKeys) { 89 MediaKeys.create(player.testConfig.keySystem).then(function(mediaKeys) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 default: 188 default:
178 Utils.timeLog(keySystem + ' is not a known key system'); 189 Utils.timeLog(keySystem + ' is not a known key system');
179 if (usePrefixedEME) 190 if (usePrefixedEME)
180 return PrefixedClearKeyPlayer; 191 return PrefixedClearKeyPlayer;
181 return ClearKeyPlayer; 192 return ClearKeyPlayer;
182 } 193 }
183 } 194 }
184 var Player = getPlayerType(testConfig.keySystem); 195 var Player = getPlayerType(testConfig.keySystem);
185 return new Player(video, testConfig); 196 return new Player(video, testConfig);
186 }; 197 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698