mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851
This commit is contained in:
parent
55347aa39f
commit
bf84a079f9
1983 changed files with 58006 additions and 31437 deletions
|
@ -1,44 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test setSinkId behavior </title>
|
||||
<div id='log'></div>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
const audio = new Audio();
|
||||
|
||||
promise_test(t => audio.setSinkId(""), "setSinkId on default audio output should always work");
|
||||
|
||||
promise_test(t => promise_rejects(t, "NotFoundError", audio.setSinkId("nonexistent_device_id")),
|
||||
"setSinkId fails with NotFoundError on made up deviceid");
|
||||
|
||||
promise_test(async t => {
|
||||
const list = await navigator.mediaDevices.enumerateDevices();
|
||||
const outputDevicesList = list.filter(({kind}) => kind == "audiooutput");
|
||||
assert_not_equals(outputDevicesList.length, 0,
|
||||
"media device list includes at least one audio output device");
|
||||
|
||||
let acceptedDevices = 0;
|
||||
for (const {deviceId} of outputDevicesList) {
|
||||
const {deviceId} = outputDevicesList[0];
|
||||
const p1 = audio.setSinkId(deviceId);
|
||||
assert_equals(audio.sinkId, "", "before it resolves, setSinkId is unchanged");
|
||||
try {
|
||||
let r = await p1;
|
||||
assert_equals(acceptedDevices, 0, "only the default sink device can be set");
|
||||
acceptedDevices++;
|
||||
assert_equals(r, undefined, "setSinkId resolves with undefined");
|
||||
assert_equals(audio.sinkId, deviceId, "when it resolves, setSinkId updates sinkId to the requested deviceId");
|
||||
r = await audio.setSinkId(deviceId);
|
||||
assert_equals(r, undefined, "resetting sinkid on same current value should always work");
|
||||
r = await audio.setSinkId("");
|
||||
assert_equals(r, undefined, "resetting sinkid on default audio output should always work");
|
||||
} catch (e) {
|
||||
assert_equals(e.name, "NotAllowedError", "Non-default devices are failing with NotAllowed error");
|
||||
}
|
||||
}
|
||||
}, "List device, setSinkId should be allowed on the default, the rest of the devices will get a NotAllowedError");
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue