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

Side by Side Diff: media/test/data/eme_player_js/unit_test_player.js

Issue 2085063002: media: Add OutputProtectionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « media/test/data/eme_player_js/player_utils.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 // CDM unit test player is used to run a specific test within the CDM. The test
6 // result is reported via a special key message with UNIT_TEST_RESULT_HEADER
7 // followed by 1 for success, and 0 for failure.
8 function UnitTestPlayer(video, testConfig) {
9 this.video = video;
10 this.testConfig = testConfig;
11 }
12
13 UnitTestPlayer.prototype.init = function() {
14 // Returns a promise.
15 return PlayerUtils.initEMEPlayer(this);
16 };
17
18 UnitTestPlayer.prototype.registerEventListeners = function() {
19 // Returns a promise.
20 return PlayerUtils.registerEMEEventListeners(this);
21 };
22
23 handleMessage = function(message) {
24 // The test result is either '0' or '1' appended to the header.
25 var msg = Utils.convertToUint8Array(message.message);
26 if (Utils.hasPrefix(msg, UNIT_TEST_RESULT_HEADER)) {
27 if (msg.length != UNIT_TEST_RESULT_HEADER.length + 1) {
28 Utils.failTest('Unexpected CDM Unit Test message' + msg);
29 return;
30 }
31 var result_index = UNIT_TEST_RESULT_HEADER.length;
32 var success = String.fromCharCode(msg[result_index]) == 1;
33 Utils.timeLog('CDM unit test: ' + (success ? 'Success' : 'Fail'));
34 if (success)
35 Utils.setResultInTitle(UNIT_TEST_SUCCESS);
36 else
37 Utils.failTest('CDM unit test failed.');
38 }
39 };
40
41 UnitTestPlayer.prototype.onMessage = handleMessage;
OLDNEW
« no previous file with comments | « media/test/data/eme_player_js/player_utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698