blob: 7f5b1eccc41e9344d4620e817256321229961807 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>fps-requestMediaKeySystemAccess</title>
<script src="../../../../media/video-test.js"></script>
<script>
var capabilities = [{
initDataTypes: ['sinf'],
videoCapabilities: [{ contentType: 'video/mp4', robustness: '' }],
distinctiveIdentifier: 'not-allowed',
persistentState: 'not-allowed',
sessionTypes: ['temporary'],
}];
var promise;
var access;
var keys;
var session;
var initData = new TextEncoder().encode(JSON.stringify({
sinf: [
"AAAADGZybWFtcDRhAAAAFHNjaG0AAAAAY2JjcwABAAAAAAA5c2NoaQAAADF0ZW5jAQAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAENwoLj77jCjwCAAw3SqKao8=",
]
}));
var serverCertificateURI = "data:application/x-x509-ca-cert;base64,MIIEyDCCA7CgAwIBAgIID0/07cCHH0YwDQYJKoZIhvcNAQEFBQAwfzELMAkGA1UEBhMCVVMxEzARBgNVBAoMCkFwcGxlIEluYy4xJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MTMwMQYDVQQDDCpBcHBsZSBLZXkgU2VydmljZXMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTIxMjIwMDAzODQzWhcNMTQxMjIxMDAzODQzWjBIMQswCQYDVQQGEwJVUzESMBAGA1UECgwJQXBwbGUgSW5jMRIwEAYDVQQLDAlBcHBsZSBJbmMxETAPBgNVBAMMCGZwc3Rlc3Q0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuHevDlphOM0sD67r3olFkN/2vC0oPl+dJ2CrBkL0tUJov9YbXud6ymJp2TkKkGqnubRaX5mI94+V9Cc/0zSlp+NTCDTcZ7y44E8j85Av/5XqozUf/wUyY+UYPBRD6BHUnH5YD6uuSlLcqE0DaE8ptXiQyN3SRteCFQ4nI9f11uQIDAQABo4ICATCCAf0wHQYDVR0OBBYEFBaVf1g1bfyAW776Sfveqj9N03EMMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUY+RHVMuFcVlGLIOszEQxZGcDLL4wgeIGA1UdIASB2jCB1zCB1AYJKoZIhvdjZAUBMIHGMIHDBggrBgEFBQcCAjCBtgyBs1JlbGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJkIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNhdGUgcG9saWN5IGFuZCBjZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMuMDUGA1UdHwQuMCwwKqAooCaGJGh0dHA6Ly9jcmwuYXBwbGUuY29tL2tleXNlcnZpY2VzLmNybDAOBgNVHQ8BAf8EBAMCBSAwNAYLKoZIhvdjZAYNAQMBAf8EIgHGeq0WCxH3oALqbKRDeCl4lqDaHVSQjsQZnyCME2TecUEwSwYLKoZIhvdjZAYNAQQBAf8EOQHlHhdsgB8QPJZFb9aAmvc8kYSTQYbjF6/U2mq46sXWRKWPKGpqLyC5ActNQUuHjynZn6Y0vs0D8jANBgkqhkiG9w0BAQUFAAOCAQEAg8GkEw0gDRn7raA8w+V36NOvKlUx3Wh3pcqI8cRATv9Twp4zfyJ4FwxdT90/zCtUUjTVtau6yESTwX+LUFu/Y0kvaV0htgBIBu7MWYCvfLlSwS4MqbBtNdloDNvU7CNyWXaMpKpYKN6i0SqEnTvF0mSTpBliCT+QxuNIxaWq9h2cCn79kbXJM5+IC37mIWO0jvzQjeSlOXJPZrNHZ6Bjt0AyiCIiZVkPmVm5lV3Ycd0gf4mfhAVJYE/p6/dTk+mqnxDdUUMVFDUfu1OqBim6ldWnAh8PlWaGh5rLYVgGvxEEPDNeueYhxTrDnENbhCZ5n/by0Rp0s67t1924Wk+QUQ==";
var serverCertificate;
function startTest() {
run('promise = navigator.requestMediaKeySystemAccess("com.apple.fps", capabilities)');
shouldResolve(promise).then(gotAccess, endTest);
}
function gotAccess(access) {
window.access = access;
run('promise = access.createMediaKeys()');
shouldResolve(promise).then(createdKeys, endTest);
}
async function createdKeys(keys) {
window.keys = keys;
var response = await fetch(serverCertificateURI);
serverCertificate = await response.arrayBuffer();
run('keys.setServerCertificate(serverCertificate)');
run('session = keys.createSession()');
testExpected('session', 'null', '!=');
run('promise = session.generateRequest("sinf", initData)');
shouldResolve(promise).then(endTest, endTest);
}
window.addEventListener('load', startTest);
</script>
</head>
<body>
</body>
</html>