40 lines
971 B
HTML
40 lines
971 B
HTML
<!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>
|