Automatic update from web-platform-tests [CE] Default HTMLUserMediaElement to request both camera and microphone. This change modifies the behavior of the HTMLUserMediaElement in standard mode to be in line with the spec. Upon insertion into the DOM, the element will now asynchronously apply default constraints to request both video and audio capture permissions. Previously, the element required an explicit call to `setConstraints` to define which permissions were needed. Now, if `setConstraints` is not called, it defaults to requesting both camera and microphone. Change-Id: I3093488063a681a39bcbc1125eb7e1c9a71f3d9e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8041783 Reviewed-by: Joey Arhar <jarhar@chromium.org> Reviewed-by: Thomas Nguyen <tungnh@chromium.org> Commit-Queue: Thomas Nguyen <tungnh@chromium.org> Cr-Commit-Position: refs/heads/main@{#1659867} -- wpt-commits: 7c53508a3c63a04238445e66cc5d5bd3db375378 wpt-pr: 61202
42 lines
1.6 KiB
HTML
42 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset="utf-8">
|
|
<title>HTMLUserMediaElement Test: denying prompt triggers oncancel</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="resources/pepc-helper.js"></script>
|
|
<body>
|
|
<script>
|
|
promise_test(async (t) => {
|
|
const usermedia = document.createElement('usermedia');
|
|
document.body.appendChild(usermedia);
|
|
|
|
let stream_fired = false;
|
|
usermedia.onstream = () => { stream_fired = true; };
|
|
|
|
let error_fired = false;
|
|
usermedia.onerror = () => { error_fired = true; };
|
|
|
|
const cancel_promise = new Promise((resolve) => {
|
|
usermedia.oncancel = resolve;
|
|
});
|
|
|
|
// Explicitly deny the permission to simulate user click-deny
|
|
await test_driver.set_permission({name: 'camera'}, 'denied');
|
|
await test_driver.set_permission({name: 'microphone'}, 'denied');
|
|
|
|
// Wait until clickable
|
|
await new Promise(resolve => t.step_timeout(resolve, PEPC_CLICK_DELAY));
|
|
await test_driver.click(usermedia);
|
|
|
|
await cancel_promise;
|
|
assert_false(stream_fired, "onstream should not fire on cancel");
|
|
assert_false(error_fired, "onerror should not fire on cancel");
|
|
assert_equals(usermedia.stream, null, "stream should be null on cancel");
|
|
assert_not_equals(usermedia.error, null, "error should not be null on cancel");
|
|
assert_equals(usermedia.error.name, "NotAllowedError", "error should be NotAllowedError on cancel");
|
|
}, "Denying PEPC prompt triggers oncancel event and sets NotAllowedError");
|
|
</script>
|
|
</body>
|