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

Unified Diff: LayoutTests/media/encrypted-media/encrypted-media-utils.js

Issue 429033003: Allow JSON messages to be returned for ClearKey. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.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: LayoutTests/media/encrypted-media/encrypted-media-utils.js
diff --git a/LayoutTests/media/encrypted-media/encrypted-media-utils.js b/LayoutTests/media/encrypted-media/encrypted-media-utils.js
index ed59afe2881e47190e86f15365f91b7ab7d90c78..7a40274b22ac3a3e1ad87a11b8f54fd117e95f56 100644
--- a/LayoutTests/media/encrypted-media/encrypted-media-utils.js
+++ b/LayoutTests/media/encrypted-media/encrypted-media-utils.js
@@ -123,3 +123,18 @@ function forceTestFailureFromPromise(test, error, message)
test.force_timeout();
test.done();
}
+
+function extractFirstLicenseKey(message)
ddorwin 2014/08/08 20:41:14 As mentioned earlier, should this be extractSingle
jrummell 2014/08/08 23:51:28 Done.
+{
+ try {
+ var json = JSON.parse(String.fromCharCode.apply(null, new Uint8Array(message)));
+ // Decode the first element of 'kids'.
+ var decoded_key = atob(json.kids[0]);
ddorwin 2014/08/08 20:41:14 FIXME: Switch to base64url See https://dvcs.w3.or
jrummell 2014/08/08 23:51:28 Done.
+ // Convert to an Uint8Array and return it.
+ return stringToUint8Array(decoded_key);
+ }
+ catch (o) {
ddorwin 2014/08/08 20:41:14 Just throw up the stack? It would mean the test is
jrummell 2014/08/08 23:51:28 Done.
+ // Not valid JSON, so return message untouched as Uint8Array.
+ return new Uint8Array(message);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698