Chromium Code Reviews| 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); |
| + } |
| +} |