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

Side by Side Diff: chrome/test/data/media/encrypted_media_utils.js

Issue 79903002: Add decrypt-only external clear key browser tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/media/chrome_key_systems.cc ('k') | media/cdm/key_system_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 var keySystem = QueryString.keysystem; 5 var keySystem = QueryString.keysystem;
6 var mediaFile = QueryString.mediafile; 6 var mediaFile = QueryString.mediafile;
7 var mediaType = QueryString.mediatype || 'video/webm; codecs="vorbis, vp8"'; 7 var mediaType = QueryString.mediatype || 'video/webm; codecs="vorbis, vp8"';
8 var useMSE = QueryString.usemse == 1; 8 var useMSE = QueryString.usemse == 1;
9 9
10 // Default key used to encrypt many media files used in browser tests. 10 // Default key used to encrypt many media files used in browser tests.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // keymessage in response to generateKeyRequest. Reply with key. 98 // keymessage in response to generateKeyRequest. Reply with key.
99 console.log('onKeyMessage - key request', e); 99 console.log('onKeyMessage - key request', e);
100 var initData = e.message; 100 var initData = e.message;
101 if (mediaType.indexOf('mp4') != -1) 101 if (mediaType.indexOf('mp4') != -1)
102 initData = KEY_ID; // Temporary hack for Clear Key in v0.1. 102 initData = KEY_ID; // Temporary hack for Clear Key in v0.1.
103 video.webkitAddKey(keySystem, key, initData); 103 video.webkitAddKey(keySystem, key, initData);
104 } 104 }
105 105
106 function verifyHeartbeatMessage(e) { 106 function verifyHeartbeatMessage(e) {
107 String.prototype.startsWith = function(prefix) {
108 return this.indexOf(prefix) === 0;
109 }
110
111 function isExternalClearKey(keySystem) {
112 return keySystem == EXTERNAL_CLEAR_KEY_KEY_SYSTEM ||
113 keySystem.startsWith(EXTERNAL_CLEAR_KEY_KEY_SYSTEM + '.');
114 }
115
107 // Only External Clear Key sends a HEARTBEAT message. 116 // Only External Clear Key sends a HEARTBEAT message.
108 if (e.keySystem != EXTERNAL_CLEAR_KEY_KEY_SYSTEM) { 117 if (!isExternalClearKey(e.keySystem)) {
109 failTest('Unexpected heartbeat from ' + e.keySystem); 118 failTest('Unexpected heartbeat from ' + e.keySystem);
110 return; 119 return;
111 } 120 }
112 121
113 if (e.defaultURL != EXTERNAL_CLEAR_KEY_HEARTBEAT_URL) { 122 if (e.defaultURL != EXTERNAL_CLEAR_KEY_HEARTBEAT_URL) {
114 failTest('Heartbeat message with unexpected defaultURL: ' + e.defaultURL); 123 failTest('Heartbeat message with unexpected defaultURL: ' + e.defaultURL);
115 return; 124 return;
116 } 125 }
117 } 126 }
118 127
(...skipping 14 matching lines...) Expand all
133 } 142 }
134 } 143 }
135 144
136 function getInitDataFromKeyId(keyID) { 145 function getInitDataFromKeyId(keyID) {
137 var init_key_id = new Uint8Array(keyID.length); 146 var init_key_id = new Uint8Array(keyID.length);
138 for(var i = 0; i < keyID.length; i++) { 147 for(var i = 0; i < keyID.length; i++) {
139 init_key_id[i] = keyID.charCodeAt(i); 148 init_key_id[i] = keyID.charCodeAt(i);
140 } 149 }
141 return init_key_id; 150 return init_key_id;
142 } 151 }
OLDNEW
« no previous file with comments | « chrome/renderer/media/chrome_key_systems.cc ('k') | media/cdm/key_system_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698