| Index: media/test/data/eme_player_js/clearkey_player.js
|
| diff --git a/media/test/data/eme_player_js/clearkey_player.js b/media/test/data/eme_player_js/clearkey_player.js
|
| index 05cab2f013b41f46c8fe9d937599a82c77ec196a..9324c9971685b6d60fffce808c3590da0b1351b6 100644
|
| --- a/media/test/data/eme_player_js/clearkey_player.js
|
| +++ b/media/test/data/eme_player_js/clearkey_player.js
|
| @@ -20,11 +20,38 @@ ClearKeyPlayer.prototype.registerEventListeners = function() {
|
|
|
| ClearKeyPlayer.prototype.onMessage = function(message) {
|
| Utils.timeLog('MediaKeySession onMessage', message);
|
| +
|
| + var mediaKeySession = message.target;
|
| var keyId = Utils.extractFirstLicenseKeyId(message.message);
|
| var key = Utils.getDefaultKey(this.testConfig.forceInvalidResponse);
|
| var jwkSet = Utils.createJWKData(keyId, key);
|
| +
|
| + // Number of milliseconds in 100 years, which is approximately
|
| + // 100 * 365 * 24 * 60 * 60 * 1000.
|
| + // See clear_key_cdm.cc where this value is set.
|
| + const ECK_RENEWAL_EXPIRATION = 3153600000000;
|
| +
|
| Utils.timeLog('Calling update: ' + String.fromCharCode.apply(null, jwkSet));
|
| - message.target.update(jwkSet).catch(function(error) {
|
| + mediaKeySession.update(jwkSet).then(function() {
|
| + // Check session expiration.
|
| + // - For CLEARKEY, expiration is not set and is the default value NaN.
|
| + // - For EXTERNAL_CLEARKEY_RENEWAL, expiration is set to
|
| + // ECK_RENEWAL_EXPIRATION milliseconds after 01 January 1970 UTC.
|
| + // - For other EXTERNAL_CLEARKEY variants, expiration is explicitly set to
|
| + // NaN.
|
| + var expiration = mediaKeySession.expiration;
|
| + if (this.testConfig.keySystem == EXTERNAL_CLEARKEY_RENEWAL) {
|
| + if (isNaN(expiration) || expiration != ECK_RENEWAL_EXPIRATION) {
|
| + Utils.timeLog('Unexpected expiration: ', expiration);
|
| + Utils.failTest(error, EME_UPDATE_FAILED);
|
| + }
|
| + } else {
|
| + if (!isNaN(mediaKeySession.expiration)) {
|
| + Utils.timeLog('Unexpected expiration: ', expiration);
|
| + Utils.failTest(error, EME_UPDATE_FAILED);
|
| + }
|
| + }
|
| + }).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 != CRASH_TEST_KEYSYSTEM) {
|
|
|