OLD | NEW |
| (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 // File IO test player is used to test File IO CDM functionality. | |
6 function FileIOTestPlayer(video, testConfig) { | |
7 this.video = video; | |
8 this.testConfig = testConfig; | |
9 } | |
10 | |
11 FileIOTestPlayer.prototype.init = function() { | |
12 PlayerUtils.initPrefixedEMEPlayer(this); | |
13 }; | |
14 | |
15 FileIOTestPlayer.prototype.registerEventListeners = function() { | |
16 PlayerUtils.registerPrefixedEMEEventListeners(this); | |
17 }; | |
18 | |
19 FileIOTestPlayer.prototype.onWebkitKeyMessage = function(message) { | |
20 // The test result is either '0' or '1' appended to the header. | |
21 if (Utils.hasPrefix(message.message, FILE_IO_TEST_RESULT_HEADER)) { | |
22 if (message.message.length != FILE_IO_TEST_RESULT_HEADER.length + 1) { | |
23 Utils.failTest('Unexpected FileIOTest CDM message' + message.message); | |
24 return; | |
25 } | |
26 var result_index = FILE_IO_TEST_RESULT_HEADER.length; | |
27 var success = String.fromCharCode(message.message[result_index]) == 1; | |
28 Utils.timeLog('CDM file IO test: ' + (success ? 'Success' : 'Fail')); | |
29 if (success) | |
30 Utils.setResultInTitle(FILE_IO_TEST_SUCCESS); | |
31 else | |
32 Utils.failTest('File IO CDM message fail status.'); | |
33 } | |
34 }; | |
OLD | NEW |