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

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

Issue 2655413003: Fix expiry time conversion in ContentDecryptorDelegate (Closed)
Patch Set: Fix expiry time conversion in ContentDecryptorDelegate Created 3 years, 11 months 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
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698