blob: c3d4891bdb5ad6db570f00d63c04dfe9d8ab94e2 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script>
description("Tests that no callbacks are invoked until permission is allowed.");
window.jsTestIsAsync = true;
function allowPermission() {
permissionSet = true;
if (window.testRunner)
testRunner.setUserMediaPermission(true);
}
if (window.testRunner)
testRunner.resetUserMediaPermission();
var options = {audio: true, video: true};
navigator.mediaDevices.getUserMedia(options)
.then(stream => {
if (permissionSet) {
testPassed('Success callback invoked');
finishJSTest();
return;
}
testFailed('Success callback invoked unexpectedly');
})
.catch(err => {
testFailed('Error callback invoked unexpectedly');
finishJSTest();
});
window.setTimeout(allowPermission, 100);
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>