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

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

Issue 1034343004: Update EME browser_tests to handle early failure (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 addMediaKeySessionListeners(session); 77 addMediaKeySessionListeners(session);
78 session.generateRequest(message.initDataType, message.initData) 78 session.generateRequest(message.initDataType, message.initData)
79 .catch(function(error) { Utils.failTest(error, KEY_ERROR); }); 79 .catch(function(error) { Utils.failTest(error, KEY_ERROR); });
80 } 80 }
81 } catch (e) { 81 } catch (e) {
82 Utils.failTest(e); 82 Utils.failTest(e);
83 } 83 }
84 }); 84 });
85 85
86 this.registerDefaultEventListeners(player); 86 this.registerDefaultEventListeners(player);
87 player.video.receivedKeyMessage = false;
87 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); 88 Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
88 var persistentState = player.testConfig.sessionToLoad ? "required" 89 var persistentState = player.testConfig.sessionToLoad ? "required"
89 : "optional"; 90 : "optional";
90 return navigator.requestMediaKeySystemAccess( 91 return navigator.requestMediaKeySystemAccess(
91 player.testConfig.keySystem, [{persistentState: persistentState}]) 92 player.testConfig.keySystem, [{persistentState: persistentState}])
92 .then(function(access) { return access.createMediaKeys(); }) 93 .then(function(access) { return access.createMediaKeys(); })
93 .then(function(mediaKeys) { 94 .then(function(mediaKeys) {
94 return player.video.setMediaKeys(mediaKeys); 95 return player.video.setMediaKeys(mediaKeys);
95 }) 96 })
96 .then(function(result) { return player; }) 97 .then(function(result) { return player; })
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 message.target.receivedKeyMessage = true; 135 message.target.receivedKeyMessage = true;
135 if (Utils.isRenewalMessagePrefixed(message.message)) { 136 if (Utils.isRenewalMessagePrefixed(message.message)) {
136 Utils.timeLog('onWebkitKeyMessage - renewal', message); 137 Utils.timeLog('onWebkitKeyMessage - renewal', message);
137 message.target.receivedRenewalMessage = true; 138 message.target.receivedRenewalMessage = true;
138 } 139 }
139 }); 140 });
140 141
141 // The prefixed API is all synchronous, so wrap the calls in a promise. 142 // The prefixed API is all synchronous, so wrap the calls in a promise.
142 return new Promise(function(resolve, reject) { 143 return new Promise(function(resolve, reject) {
143 PlayerUtils.registerDefaultEventListeners(player); 144 PlayerUtils.registerDefaultEventListeners(player);
145 player.video.receivedKeyMessage = false;
144 resolve(player); 146 resolve(player);
145 }); 147 });
146 }; 148 };
147 149
148 PlayerUtils.setVideoSource = function(player) { 150 PlayerUtils.setVideoSource = function(player) {
149 if (player.testConfig.useMSE) { 151 if (player.testConfig.useMSE) {
150 Utils.timeLog('Loading media using MSE.'); 152 Utils.timeLog('Loading media using MSE.');
151 var mediaSource = 153 var mediaSource =
152 MediaSourceUtils.loadMediaSourceFromTestConfig(player.testConfig); 154 MediaSourceUtils.loadMediaSourceFromTestConfig(player.testConfig);
153 player.video.src = window.URL.createObjectURL(mediaSource); 155 player.video.src = window.URL.createObjectURL(mediaSource);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 default: 194 default:
193 Utils.timeLog(keySystem + ' is not a known key system'); 195 Utils.timeLog(keySystem + ' is not a known key system');
194 if (usePrefixedEME) 196 if (usePrefixedEME)
195 return PrefixedClearKeyPlayer; 197 return PrefixedClearKeyPlayer;
196 return ClearKeyPlayer; 198 return ClearKeyPlayer;
197 } 199 }
198 } 200 }
199 var Player = getPlayerType(testConfig.keySystem); 201 var Player = getPlayerType(testConfig.keySystem);
200 return new Player(video, testConfig); 202 return new Player(video, testConfig);
201 }; 203 };
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