<!DOCTYPE html>
<html>
<head>
<title>Test support of different initDataTypes.</title>
<script src="encrypted-media-utils.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<script>
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('org.w3.clearkey', 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');
}, 'Clear key support for "webm".');
promise_test(function()
{
return checkInitDataType('cenc');
}, 'Clear key support for "cenc".');
promise_test(function()
{
return checkInitDataType('keyids');
}, 'Clear key support for "keyids".');
</script>
</body>
</html>