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

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

Issue 653533006: Revert "Add unprefixed EME tests for LoadSession()" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
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 player.onMessage(message); 50 player.onMessage(message);
51 }); 51 });
52 mediaKeySession.addEventListener('error', function(error) { 52 mediaKeySession.addEventListener('error', function(error) {
53 Utils.failTest(error, KEY_ERROR); 53 Utils.failTest(error, KEY_ERROR);
54 }); 54 });
55 } 55 }
56 56
57 // TODO(sandersd): Stop checking contentType once we complete the switch to 57 // TODO(sandersd): Stop checking contentType once we complete the switch to
58 // using the 'encrypted' event. 58 // using the 'encrypted' event.
59 var init_data_type = message.initDataType || message.contentType; 59 var init_data_type = message.initDataType || message.contentType;
60 Utils.timeLog('Creating new media key session for initDataType: ' +
61 init_data_type + ', initData: ' +
62 Utils.getHexString(new Uint8Array(message.initData)));
60 try { 63 try {
61 if (player.testConfig.sessionToLoad) { 64 if (message.target.mediaKeys.createSession.length == 0) {
62 Utils.timeLog('Loading session: ' + player.testConfig.sessionToLoad); 65 // FIXME(jrummell): Remove this test (and else branch) once blink
63 var session = message.target.mediaKeys.createSession('persistent'); 66 // uses the new API.
64 addMediaKeySessionListeners(session);
65 session.load(player.testConfig.sessionToLoad)
66 .catch(function(error) { Utils.failTest(error, KEY_ERROR); });
67 } else {
68 Utils.timeLog('Creating new media key session for initDataType: ' +
69 init_data_type + ', initData: ' +
70 Utils.getHexString(new Uint8Array(message.initData)));
71 var session = message.target.mediaKeys.createSession(); 67 var session = message.target.mediaKeys.createSession();
72 addMediaKeySessionListeners(session); 68 addMediaKeySessionListeners(session);
73 session.generateRequest(init_data_type, message.initData) 69 session.generateRequest(init_data_type, message.initData)
74 .catch(function(error) { 70 .catch(function(error) {
75 Utils.failTest(error, KEY_ERROR); 71 Utils.failTest(error, KEY_ERROR);
76 }); 72 });
73 } else {
74 var session = message.target.mediaKeys.createSession(
75 init_data_type, message.initData);
76 session.then(addMediaKeySessionListeners)
77 .catch(function(error) {
78 Utils.failTest(error, KEY_ERROR);
79 });
77 } 80 }
78 } catch (e) { 81 } catch (e) {
79 Utils.failTest(e); 82 Utils.failTest(e);
80 } 83 }
81 } 84 }
82 85
83 // TODO(sandersd): Stop registering 'needkey' after it is renamed to 86 // TODO(sandersd): Stop registering 'needkey' after it is renamed to
84 // 'encrypted'. 87 // 'encrypted'.
85 player.video.addEventListener('encrypted', encrypted_handler); 88 player.video.addEventListener('encrypted', encrypted_handler);
86 player.video.addEventListener('needkey', encrypted_handler); 89 player.video.addEventListener('needkey', encrypted_handler);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 default: 190 default:
188 Utils.timeLog(keySystem + ' is not a known key system'); 191 Utils.timeLog(keySystem + ' is not a known key system');
189 if (usePrefixedEME) 192 if (usePrefixedEME)
190 return PrefixedClearKeyPlayer; 193 return PrefixedClearKeyPlayer;
191 return ClearKeyPlayer; 194 return ClearKeyPlayer;
192 } 195 }
193 } 196 }
194 var Player = getPlayerType(testConfig.keySystem); 197 var Player = getPlayerType(testConfig.keySystem);
195 return new Player(video, testConfig); 198 return new Player(video, testConfig);
196 }; 199 };
OLDNEW
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/test/data/eme_player_js/test_config.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698