Automatic update from web-platform-tests Create a `<usermedia>` element to allow experimentation specific to ... camera and microphone capability-aware elements. Initially this element will have the exact same functionality as the current permission element, but it allows us to iterate on the design to make something better tailored for camera/microphone, while still providing the core functionality for sites to experiment and provide feedback on. The geolocation element is launching in M144, and the permission element will soon be deprecated, therefore some of the verbose feature checks will soon be simplified. I added some of the permission element WPT tests as a sanity check. Work will soon follow to migrate all permission elements tests to either geolocation or usermedia element tests. Also drive-by fix some tests which required https to use the test_driver. Fixed: 462059159 Change-Id: I56090f57d83d4994891fb6251913984d35df051e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7207362 Reviewed-by: Thomas Nguyen <tungnh@chromium.org> Reviewed-by: Robert Flack <flackr@chromium.org> Reviewed-by: Mike West <mkwst@chromium.org> Reviewed-by: Peter Conn <peconn@chromium.org> Commit-Queue: Andy Paicu <andypaicu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1551127} -- wpt-commits: efa7f392251218ddc34732a2ed11e1d73774a763 wpt-pr: 56329
51 lines
1.9 KiB
HTML
51 lines
1.9 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<meta charset=utf-8>
|
|
<link rel="help" href="https://github.com/WICG/PEPC/blob/main/explainer.md#locking-the-pepc-style">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-actions.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<body>
|
|
<div id="el1" lang="en">
|
|
<div id="el2" lang="en">
|
|
<div>
|
|
<usermedia id="usermedia-element" type="camera" style="width:fit-content"></usermedia>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Since the `lang` attribute is inherited, but the actual inherited value
|
|
// isn't available via IDL, there's no direct way to check that it gets
|
|
// invalidated and updated when changes are made. As such, this test looks
|
|
// for side-effects of changing the language, such as changing the rendered
|
|
// size of the element.
|
|
promise_test(async() => {
|
|
var usermedia_element = document.getElementById("usermedia-element");
|
|
const initial_width = usermedia_element.offsetWidth;
|
|
let widths = new Set();
|
|
widths.add(initial_width);
|
|
const outer_lang_div = document.getElementById("el1");
|
|
const inner_lang_div = document.getElementById("el2");
|
|
|
|
// Changing the lang of the outer div should not have any effect as it is
|
|
// shadowed by the inner div.
|
|
outer_lang_div.lang = "de";
|
|
assert_equals(usermedia_element.offsetWidth, initial_width);
|
|
|
|
// The width of the usermedia element should change due to the changed
|
|
// language of the inner element. Try a couple languages to make sure one
|
|
// of them has a different size.
|
|
['de','hu','fr-AG','es'].forEach(lang => {
|
|
inner_lang_div.lang = lang;
|
|
widths.add(usermedia_element.offsetWidth);
|
|
});
|
|
assert_true(widths.size > 1);
|
|
|
|
}, "UserMedia element should dynamically change text when the lang attribute changes")
|
|
</script>
|
|
</body>
|
|
</html>
|