diff options
author | jrummell <jrummell@chromium.org> | 2014-12-23 10:57:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-23 18:58:52 +0000 |
commit | 37edfbac393c04549884ec15ce612a376a5be6ff (patch) | |
tree | 21ba085d298c801dcbf8bc41436959d1bad58e18 /media | |
parent | 09eafe7304589043a9b9aa34b9ef559ead1e8e59 (diff) | |
download | chromium_src-37edfbac393c04549884ec15ce612a376a5be6ff.zip chromium_src-37edfbac393c04549884ec15ce612a376a5be6ff.tar.gz chromium_src-37edfbac393c04549884ec15ce612a376a5be6ff.tar.bz2 |
Fix Flaky EncryptedMediaTest
Tests are flaky as setMediaKeys() was not completing before the
"encrypted" event was generated. Change delays setting the video
source until setMediaKeys() completes.
BUG=444683
TEST=Failing tests run fine locally
Review URL: https://codereview.chromium.org/823743002
Cr-Commit-Position: refs/heads/master@{#309568}
Diffstat (limited to 'media')
-rw-r--r-- | media/test/data/eme_player_js/player_utils.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/media/test/data/eme_player_js/player_utils.js b/media/test/data/eme_player_js/player_utils.js index 5dbe002..a5a6462 100644 --- a/media/test/data/eme_player_js/player_utils.js +++ b/media/test/data/eme_player_js/player_utils.js @@ -80,19 +80,21 @@ PlayerUtils.registerEMEEventListeners = function(player) { try { Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); if (typeof navigator.requestMediaKeySystemAccess == 'function') { - navigator.requestMediaKeySystemAccess(player.testConfig.keySystem) + return 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) + return MediaKeys.create(player.testConfig.keySystem) .then(function(mediaKeys) { player.video.setMediaKeys(mediaKeys); }) .catch(function(error) { Utils.failTest(error, NOTSUPPORTEDERROR); }); } } catch (e) { Utils.failTest(e); + // Return a failing promise. + return new Promise(function(resolve, reject) { reject(Error(e)); }); } }; @@ -149,8 +151,9 @@ PlayerUtils.setVideoSource = function(player) { }; PlayerUtils.initEMEPlayer = function(player) { - this.registerEMEEventListeners(player); - this.setVideoSource(player); + var promise = this.registerEMEEventListeners(player); + promise.then(function(result) { PlayerUtils.setVideoSource(player); }) + .catch(function(error) { Utils.failTest(error, NOTSUPPORTEDERROR); }); }; PlayerUtils.initPrefixedEMEPlayer = function(player) { |