summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorjrummell <jrummell@chromium.org>2014-10-24 17:19:25 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-25 00:19:44 +0000
commitb67dd6d2be03f6c970cd34d1790440d4ce89fafc (patch)
tree5aa918d4a477f8e392a3b532339ebf8e9381f24f /media
parent20c60c6296390308b24d07b6e1b06b7caaac2105 (diff)
downloadchromium_src-b67dd6d2be03f6c970cd34d1790440d4ce89fafc.zip
chromium_src-b67dd6d2be03f6c970cd34d1790440d4ce89fafc.tar.gz
chromium_src-b67dd6d2be03f6c970cd34d1790440d4ce89fafc.tar.bz2
Update EME tests to work with navigator.requestMediaKeySystemAccess()
Upcoming changes to the EME API remove MediaKeys.create() and replace it with navigator.requestMediaKeySystemAccess(). This change updates the EME JavaScript test to work either way. BUG=425186 TEST=EME tests pass with and without the change Review URL: https://codereview.chromium.org/673943002 Cr-Commit-Position: refs/heads/master@{#301240}
Diffstat (limited to 'media')
-rw-r--r--media/test/data/eme_player_js/player_utils.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/media/test/data/eme_player_js/player_utils.js b/media/test/data/eme_player_js/player_utils.js
index 634cc31..5dbe002 100644
--- a/media/test/data/eme_player_js/player_utils.js
+++ b/media/test/data/eme_player_js/player_utils.js
@@ -79,11 +79,18 @@ PlayerUtils.registerEMEEventListeners = function(player) {
this.registerDefaultEventListeners(player);
try {
Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
- MediaKeys.create(player.testConfig.keySystem).then(function(mediaKeys) {
- player.video.setMediaKeys(mediaKeys);
- }).catch(function(error) {
- Utils.failTest(error, NOTSUPPORTEDERROR);
- });
+ if (typeof navigator.requestMediaKeySystemAccess == 'function') {
+ navigator.requestMediaKeySystemAccess(player.testConfig.keySystem)
+ .then(function(access) { return access.createMediaKeys(); })
+ .then(function(mediaKeys) { player.video.setMediaKeys(mediaKeys); })
+ .catch(function(error) { Utils.failTest(error, NOTSUPPORTEDERROR); });
+ } else {
+ // TODO(jrummell): Remove this once the blink change for
+ // requestMediaKeySystemAccess lands.
+ MediaKeys.create(player.testConfig.keySystem)
+ .then(function(mediaKeys) { player.video.setMediaKeys(mediaKeys); })
+ .catch(function(error) { Utils.failTest(error, NOTSUPPORTEDERROR); });
+ }
} catch (e) {
Utils.failTest(e);
}