Index: third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/check-initdata-type.js |
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/check-initdata-type.js b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/check-initdata-type.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c7cb6e4b9a427d4f15364027724e13ba836d89e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/imported/wpt/encrypted-media/scripts/check-initdata-type.js |
@@ -0,0 +1,35 @@ |
+ function runTest( config, qualifier ) |
+ { |
+ function checkInitDataType(initDataType) |
+ { |
+ return isInitDataTypeSupported(initDataType).then(function(result) { |
+ // If |initDataType| is not supported, simply succeed. |
+ if (!result) |
+ return Promise.resolve('Not supported'); |
+ |
+ return navigator.requestMediaKeySystemAccess( config.keysystem, getSimpleConfigurationForInitDataType(initDataType)) |
+ .then(function(access) { |
+ return access.createMediaKeys(); |
+ }).then(function(mediaKeys) { |
+ var mediaKeySession = mediaKeys.createSession(); |
+ var initData = getInitData(initDataType); |
+ return mediaKeySession.generateRequest(initDataType, initData); |
+ }); |
+ }); |
+ } |
+ |
+ promise_test(function() |
+ { |
+ return checkInitDataType('webm'); |
+ }, testnamePrefix( qualifier, config.keysystem ) + ' support for "webm".'); |
+ |
+ promise_test(function() |
+ { |
+ return checkInitDataType('cenc'); |
+ }, testnamePrefix( qualifier, config.keysystem ) + ' support for "cenc".'); |
+ |
+ promise_test(function() |
+ { |
+ return checkInitDataType('keyids'); |
+ }, testnamePrefix( qualifier, config.keysystem ) + ' support for "keyids".'); |
+} |