Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 }); | 60 }); |
| 61 } | 61 } |
| 62 | 62 |
| 63 try { | 63 try { |
| 64 if (player.testConfig.sessionToLoad) { | 64 if (player.testConfig.sessionToLoad) { |
| 65 Utils.timeLog('Loading session: ' + player.testConfig.sessionToLoad); | 65 Utils.timeLog('Loading session: ' + player.testConfig.sessionToLoad); |
| 66 var session = | 66 var session = |
| 67 message.target.mediaKeys.createSession('persistent-license'); | 67 message.target.mediaKeys.createSession('persistent-license'); |
| 68 addMediaKeySessionListeners(session); | 68 addMediaKeySessionListeners(session); |
| 69 session.load(player.testConfig.sessionToLoad) | 69 session.load(player.testConfig.sessionToLoad) |
| 70 .catch(function(error) { Utils.failTest(error, EME_LOAD_FAILED); }); | 70 .then( |
| 71 function(result) { | |
| 72 if (!result) | |
| 73 Utils.failTest('Session not found.', EME_SESSION_NOT_FOUND); | |
|
ddorwin
2015/07/08 20:32:13
failTest() is actually used to report expected "er
jrummell
2015/07/08 20:58:17
I guess all that is required is a title change to
ddorwin
2015/07/08 21:50:13
Hmm, that might be more consistent with the fact t
jrummell
2015/07/08 23:15:08
Done.
| |
| 74 }, | |
| 75 function(error) { Utils.failTest(error, EME_LOAD_FAILED); }); | |
| 71 } else { | 76 } else { |
| 72 Utils.timeLog('Creating new media key session for initDataType: ' + | 77 Utils.timeLog('Creating new media key session for initDataType: ' + |
| 73 message.initDataType + ', initData: ' + | 78 message.initDataType + ', initData: ' + |
| 74 Utils.getHexString(new Uint8Array(message.initData))); | 79 Utils.getHexString(new Uint8Array(message.initData))); |
| 75 var session = message.target.mediaKeys.createSession(); | 80 var session = message.target.mediaKeys.createSession(); |
| 76 addMediaKeySessionListeners(session); | 81 addMediaKeySessionListeners(session); |
| 77 session.generateRequest(message.initDataType, message.initData) | 82 session.generateRequest(message.initDataType, message.initData) |
| 78 .catch(function(error) { | 83 .catch(function(error) { |
| 79 // Ignore the error if a crash is expected. This ensures that | 84 // Ignore the error if a crash is expected. This ensures that |
| 80 // the decoder actually detects and reports the error. | 85 // the decoder actually detects and reports the error. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 default: | 214 default: |
| 210 Utils.timeLog(keySystem + ' is not a known key system'); | 215 Utils.timeLog(keySystem + ' is not a known key system'); |
| 211 if (usePrefixedEME) | 216 if (usePrefixedEME) |
| 212 return PrefixedClearKeyPlayer; | 217 return PrefixedClearKeyPlayer; |
| 213 return ClearKeyPlayer; | 218 return ClearKeyPlayer; |
| 214 } | 219 } |
| 215 } | 220 } |
| 216 var Player = getPlayerType(testConfig.keySystem); | 221 var Player = getPlayerType(testConfig.keySystem); |
| 217 return new Player(video, testConfig); | 222 return new Player(video, testConfig); |
| 218 }; | 223 }; |
| OLD | NEW |