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

Unified Diff: media/test/data/eme_player_js/player_utils.js

Issue 2426813002: EME: Close existing sessions on CDM failure (Closed)
Patch Set: add new tests Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/test/data/eme_player_js/player_utils.js
diff --git a/media/test/data/eme_player_js/player_utils.js b/media/test/data/eme_player_js/player_utils.js
index 9a2bb8b1e74668ea53ef97d8eb5d2a5e89e87e2c..cc4e1ab85d3622ee2cd4bb4f1ec03d3f3a4684fd 100644
--- a/media/test/data/eme_player_js/player_utils.js
+++ b/media/test/data/eme_player_js/player_utils.js
@@ -28,9 +28,12 @@ PlayerUtils.registerDefaultEventListeners = function(player) {
player.video.addEventListener('error', function(error) {
// This most likely happens on pipeline failures (e.g. when the CDM
- // crashes).
+ // crashes). Don't report a failure if the test is checking that sessions
+ // are closed on a crash.
Utils.timeLog('onHTMLElementError', error);
- Utils.failTest(error);
+ if (player.testConfig.keySystem != CLOSE_ON_CRASH_TEST_KEYSYSTEM) {
+ Utils.failTest(error);
+ }
});
};
@@ -77,10 +80,18 @@ PlayerUtils.registerEMEEventListeners = function(player) {
addMediaKeySessionListeners(session);
session.generateRequest(message.initDataType, message.initData)
.catch(function(error) {
- // Ignore the error if a crash is expected. This ensures that
- // the decoder actually detects and reports the error.
- if (this.testConfig.keySystem !=
- 'org.chromium.externalclearkey.crash') {
+ if (this.testConfig.keySystem == CLOSE_ON_CRASH_TEST_KEYSYSTEM) {
+ // Failure is expected, wait for the session to be closed.
+ session.closed.then(
+ function(result) {
+ Utils.setResultInTitle('SESSION_CLOSED');
+ },
+ function(error) { Utils.failTest(error); });
+ } else if (
+ this.testConfig.keySystem == ERROR_ON_CRASH_TEST_KEYSYSTEM) {
+ // Ignore the failure if a crash is expected. This ensures that
+ // the decoder actually detects and reports the error.
+ } else {
Utils.failTest(error, EME_GENERATEREQUEST_FAILED);
}
});
@@ -199,6 +210,8 @@ PlayerUtils.createPlayer = function(video, testConfig) {
case CLEARKEY:
case EXTERNAL_CLEARKEY:
case EXTERNAL_CLEARKEY_RENEWAL:
+ case ERROR_ON_CRASH_TEST_KEYSYSTEM:
+ case CLOSE_ON_CRASH_TEST_KEYSYSTEM:
return ClearKeyPlayer;
case FILE_IO_TEST_KEYSYSTEM:
case OUTPUT_PROTECTION_TEST_KEYSYSTEM:
« media/test/data/eme_player_js/clearkey_player.js ('K') | « media/test/data/eme_player_js/globals.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698