blob: f72a6d642e6c47f8b176b7ef95af4691f941b760 [file] [log] [blame]
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Shadowing then()</title>
</head>
<body>
<!--
This test verifies that the implementation of navigator.getUserMedia does not use public promise APIs.
-->
<p id="output"></p>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function endTest(testStatus) {
document.getElementById("output").textContent = testStatus;
testRunner.notifyDone();
}
// Shadow Promise.prototype.then
Promise.prototype.then = (function () {
const realThen = Promise.prototype.then;
return function () {
endTest("FAIL: Executed shadowed, public .then()");
}
})();
function gotUserMedia(mediaStream) {
endTest("FAIL: Got user media");
}
function userMediaError(error) {
endTest("PASS");
}
var options = { audio: false, video: false };
navigator.getUserMedia(options, gotUserMedia, userMediaError);
</script>
</body>
</html>