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

Unified Diff: chrome/test/data/media/eme_player_js/utils.js

Issue 405733003: Update browser tests to support upcoming EME parameter type changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/media/eme_player_js/utils.js
diff --git a/chrome/test/data/media/eme_player_js/utils.js b/chrome/test/data/media/eme_player_js/utils.js
index e664593e8e56c6536a090817d4fc6dccc41ccb01..3c5e9525c2ab9023985a846bbc71f4324f572db2 100644
--- a/chrome/test/data/media/eme_player_js/utils.js
+++ b/chrome/test/data/media/eme_player_js/utils.js
@@ -30,11 +30,16 @@ Utils.convertToArray = function(input) {
};
Utils.convertToUint8Array = function(msg) {
- var ans = new Uint8Array(msg.length);
- for (var i = 0; i < msg.length; i++) {
- ans[i] = msg.charCodeAt(i);
+ if (typeof msg == 'string') {
+ var ans = new Uint8Array(msg.length);
+ for (var i = 0; i < msg.length; i++) {
+ ans[i] = msg.charCodeAt(i);
+ }
+ return ans;
}
- return ans;
+ // Assume it is ArrayBuffer or ArrayBufferView. If it already a Uint8Array,
+ // this will just make a copy.
ddorwin 2014/07/20 22:35:05 ... of the view. right? Change the last sentence
jrummell 2014/07/23 22:30:05 Done.
+ return new Uint8Array(msg);
};
Utils.createJWKData = function(keyId, key) {
@@ -150,7 +155,7 @@ Utils.getHexString = function(uintArray) {
};
Utils.getInitDataFromMessage = function(message, mediaType) {
- var initData = message.message;
+ var initData = Utils.convertToUint8Array(message.message);
ddorwin 2014/07/20 22:35:05 This will probably need to change when we update C
jrummell 2014/07/23 22:30:06 Acknowledged.
if (mediaType.indexOf('mp4') != -1) {
// Temporary hack for Clear Key in v0.1.
// If content uses mp4, then message.message is PSSH data. Instead of

Powered by Google App Engine
This is Rietveld 408576698