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

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

Issue 641443002: Add unprefixed EME tests for LoadSession() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add TODO (plus rebase) 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)));
63 try { 60 try {
64 if (message.target.mediaKeys.createSession.length == 0) { 61 if (player.testConfig.sessionToLoad) {
65 // FIXME(jrummell): Remove this test (and else branch) once blink 62 Utils.timeLog('Loading session: ' + player.testConfig.sessionToLoad);
66 // uses the new API. 63 var session = message.target.mediaKeys.createSession('persistent');
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)));
67 var session = message.target.mediaKeys.createSession(); 71 var session = message.target.mediaKeys.createSession();
68 addMediaKeySessionListeners(session); 72 addMediaKeySessionListeners(session);
69 session.generateRequest(init_data_type, message.initData) 73 session.generateRequest(init_data_type, message.initData)
70 .catch(function(error) { 74 .catch(function(error) {
71 Utils.failTest(error, KEY_ERROR); 75 Utils.failTest(error, KEY_ERROR);
72 }); 76 });
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 });
80 } 77 }
81 } catch (e) { 78 } catch (e) {
82 Utils.failTest(e); 79 Utils.failTest(e);
83 } 80 }
84 } 81 }
85 82
86 // TODO(sandersd): Stop registering 'needkey' after it is renamed to 83 // TODO(sandersd): Stop registering 'needkey' after it is renamed to
87 // 'encrypted'. 84 // 'encrypted'.
88 player.video.addEventListener('encrypted', encrypted_handler); 85 player.video.addEventListener('encrypted', encrypted_handler);
89 player.video.addEventListener('needkey', encrypted_handler); 86 player.video.addEventListener('needkey', encrypted_handler);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 default: 187 default:
191 Utils.timeLog(keySystem + ' is not a known key system'); 188 Utils.timeLog(keySystem + ' is not a known key system');
192 if (usePrefixedEME) 189 if (usePrefixedEME)
193 return PrefixedClearKeyPlayer; 190 return PrefixedClearKeyPlayer;
194 return ClearKeyPlayer; 191 return ClearKeyPlayer;
195 } 192 }
196 } 193 }
197 var Player = getPlayerType(testConfig.keySystem); 194 var Player = getPlayerType(testConfig.keySystem);
198 return new Player(video, testConfig); 195 return new Player(video, testConfig);
199 }; 196 };
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