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

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

Issue 1717033002: EME: Fix the CDM File IO test when run using unprefixed EME. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // File IO test player is used to test File IO CDM functionality. 5 // File IO test player is used to test File IO CDM functionality.
6 function FileIOTestPlayer(video, testConfig) { 6 function FileIOTestPlayer(video, testConfig) {
7 this.video = video; 7 this.video = video;
8 this.testConfig = testConfig; 8 this.testConfig = testConfig;
9 } 9 }
10 10
11 FileIOTestPlayer.prototype.init = function() { 11 FileIOTestPlayer.prototype.init = function() {
12 // Returns a promise. 12 // Returns a promise.
13 return PlayerUtils.initEMEPlayer(this); 13 return PlayerUtils.initEMEPlayer(this);
14 }; 14 };
15 15
16 FileIOTestPlayer.prototype.registerEventListeners = function() { 16 FileIOTestPlayer.prototype.registerEventListeners = function() {
17 // Returns a promise. 17 // Returns a promise.
18 return PlayerUtils.registerPrefixedEMEEventListeners(this); 18 return PlayerUtils.registerEMEEventListeners(this).then(function(result) {
19 return PlayerUtils.registerPrefixedEMEEventListeners(this);
20 });
19 }; 21 };
20 22
21 handleMessage = function(message) { 23 handleMessage = function(message) {
22 // The test result is either '0' or '1' appended to the header. 24 // The test result is either '0' or '1' appended to the header.
23 if (Utils.hasPrefix(message.message, FILE_IO_TEST_RESULT_HEADER)) { 25 var msg = Utils.convertToUint8Array(message.message);
24 if (message.message.length != FILE_IO_TEST_RESULT_HEADER.length + 1) { 26 if (Utils.hasPrefix(msg, FILE_IO_TEST_RESULT_HEADER)) {
25 Utils.failTest('Unexpected FileIOTest CDM message' + message.message); 27 if (msg.length != FILE_IO_TEST_RESULT_HEADER.length + 1) {
28 Utils.failTest('Unexpected FileIOTest CDM message' + msg);
26 return; 29 return;
27 } 30 }
28 var result_index = FILE_IO_TEST_RESULT_HEADER.length; 31 var result_index = FILE_IO_TEST_RESULT_HEADER.length;
29 var success = String.fromCharCode(message.message[result_index]) == 1; 32 var success = String.fromCharCode(msg[result_index]) == 1;
30 Utils.timeLog('CDM file IO test: ' + (success ? 'Success' : 'Fail')); 33 Utils.timeLog('CDM file IO test: ' + (success ? 'Success' : 'Fail'));
31 if (success) 34 if (success)
32 Utils.setResultInTitle(FILE_IO_TEST_SUCCESS); 35 Utils.setResultInTitle(FILE_IO_TEST_SUCCESS);
33 else 36 else
34 Utils.failTest('File IO CDM message fail status.'); 37 Utils.failTest('File IO CDM message fail status.');
35 } 38 }
36 }; 39 };
37 40
38 // Check message for prefixed API. 41 // Check message for prefixed API.
39 FileIOTestPlayer.prototype.onWebkitKeyMessage = handleMessage; 42 FileIOTestPlayer.prototype.onWebkitKeyMessage = handleMessage;
40 43
41 // Check message for unprefixed API. 44 // Check message for unprefixed API.
42 FileIOTestPlayer.prototype.onMessage = handleMessage; 45 FileIOTestPlayer.prototype.onMessage = handleMessage;
OLDNEW
« no previous file with comments | « no previous file | media/test/data/eme_player_js/player_utils.js » ('j') | media/test/data/eme_player_js/utils.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698