cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / media / test / data / eme_player_js / clearkey_player.js
blob0ee240484115ff032d68b3dd38122467551737c2
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // ClearKeyPlayer responsible for playing media using Clear Key key system and
6 // the unprefixed version of EME.
7 function ClearKeyPlayer(video, testConfig) {
8 this.video = video;
9 this.testConfig = testConfig;
12 ClearKeyPlayer.prototype.init = function() {
13 // Returns a promise.
14 return PlayerUtils.initEMEPlayer(this);
17 ClearKeyPlayer.prototype.registerEventListeners = function() {
18 // Returns a promise.
19 return PlayerUtils.registerEMEEventListeners(this);
22 ClearKeyPlayer.prototype.onMessage = function(message) {
23 Utils.timeLog('MediaKeySession onMessage', message);
24 var keyId = Utils.extractFirstLicenseKeyId(message.message);
25 var key = Utils.getDefaultKey(this.testConfig.forceInvalidResponse);
26 var jwkSet = Utils.createJWKData(keyId, key);
27 Utils.timeLog('Calling update: ' + String.fromCharCode.apply(null, jwkSet));
28 message.target.update(jwkSet).catch(function(error) {
29 // Ignore the error if a crash is expected. This ensures that the decoder
30 // actually detects and reports the error.
31 if (this.testConfig.keySystem != 'org.chromium.externalclearkey.crash') {
32 Utils.failTest(error, EME_UPDATE_FAILED);
34 });