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

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

Issue 2084053002: EME: Update tests so 'audioCapabilities' always provided (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avConfiguration Created 4 years, 6 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: third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
diff --git a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
index b1e6c9207f295fb506d400ff9161e0960c9b470a..fc7607b9806eeed651cbf2e49816fd29d799b1f9 100644
--- a/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
+++ b/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-utils.js
@@ -17,7 +17,7 @@ function consoleWrite(text)
function isInitDataTypeSupported(initDataType)
{
return navigator.requestMediaKeySystemAccess(
- "org.w3.clearkey", [{ initDataTypes : [initDataType] }])
+ "org.w3.clearkey", simpleConfigurationForInitDataType(initDataType))
.then(function() { return(true); }, function() { return(false); });
}
@@ -25,7 +25,10 @@ function isInitDataTypeSupported(initDataType)
// rejected if none are supported.
function getSupportedInitDataType()
ddorwin 2016/06/24 03:05:23 We may not actually need this anymore if we follow
jrummell 2016/06/28 23:04:26 Done.
{
- var configuration = [{ initDataTypes : [ 'webm', 'cenc', 'keyids' ] }];
+ var configuration = [ {
+ initDataTypes : [ 'webm', 'cenc', 'keyids' ],
+ audioCapabilities: [ { contentType: 'audio/webm; codecs="vorbis"' } ]
ddorwin 2016/06/24 03:05:23 We should add a note that one would need to includ
jrummell 2016/06/28 23:04:26 Done.
+ } ];
return navigator.requestMediaKeySystemAccess('org.w3.clearkey', configuration)
.then(function(access) {
var initDataTypes = access.getConfiguration().initDataTypes;
@@ -71,6 +74,48 @@ function getInitData(initDataType)
throw 'initDataType ' + initDataType + ' not supported.';
}
+// Returns a trivial MediaKeySystemConfiguration. Since Chromium only
+// supports WebM by default, use an audio codec so that at least one
+// capability is specified.
+// NOTE: Supporting user agents that don't support WebM and/or Vorbis would
+// require passing in an audio content type.
+function simpleConfiguration()
+{
+ return [ {
+ audioCapabilities: [ { contentType: 'audio/webm; codecs="vorbis"' } ]
ddorwin 2016/06/24 03:05:23 Actually, that might work here too. We just need o
jrummell 2016/06/28 23:04:26 Done.
+ } ];
+}
+
+// Returns a MediaKeySystemConfiguration for |initDataType|. Since Chromium
+// only supports WebM by default, use an audio codec so that at least one
+// capability is specified.
+// NOTE: Supporting user agents that don't support WebM and/or Vorbis would
+// require passing in an audio content type.
+function simpleConfigurationForInitDataType(initDataType)
+{
+ return [ {
+ initDataTypes: [ initDataType ],
+ audioCapabilities: [ { contentType: 'audio/webm; codecs="vorbis"' } ]
+ } ];
+}
+
+// Returns a MediaKeySystemConfiguration for |initDataType| that specifies
+// both audio and video capabilities.
+function avConfiguration(initDataType)
ddorwin 2016/06/24 03:05:23 Passing the IDT isn't strictly correct. Also, FTR,
jrummell 2016/06/28 23:04:26 Renamed the parameter since it is really the media
+{
+ if (initDataType == 'webm') {
+ return [ {
ddorwin 2016/06/24 21:24:56 (Especially for cases where more than one configur
jrummell 2016/06/28 23:04:26 Acknowledged. Doesn't look like we need to handle
+ initDataTypes: [ 'webm' ],
+ audioCapabilities: [ { contentType: 'audio/webm; codecs="vorbis"' } ],
+ videoCapabilities: [ { contentType: 'video/webm; codecs="vp8"' } ]
+ } ];
+ }
+
+ // NOTE: Supporting other initDataTypes not currently implemented as
+ // Chromium only tests with WebM files.
+ throw 'initDataType ' + initDataType + ' not supported.';
+}
+
function waitForEventAndRunStep(eventName, element, func, stepTest)
{
var eventCallback = function(event) {
@@ -268,7 +313,7 @@ function createMediaKeys(keyId, key)
var request = stringToUint8Array(createKeyIDs(keyId));
var jwkSet = stringToUint8Array(createJWKSet(createJWK(keyId, key)));
- return navigator.requestMediaKeySystemAccess('org.w3.clearkey', [{}]).then(function(access) {
+ return navigator.requestMediaKeySystemAccess('org.w3.clearkey', simpleConfigurationForInitDataType('keyids')).then(function(access) {
return access.createMediaKeys();
}).then(function(result) {
mediaKeys = result;

Powered by Google App Engine
This is Rietveld 408576698