fune/testing/web-platform/tests/audio-output/setSinkId.https.html
James Graham 7c95410c7b Bug 1397215 - Update web-platform-tests to revision 7abe12a95a33cf1906182c1e56da37a32effce3f, a=testonly
MozReview-Commit-ID: 7EKrQudqd4D


--HG--
rename : testing/web-platform/tests/app-uri/resources/ExamPLE/mmY/index.html => testing/web-platform/tests/XMLHttpRequest/resources/pass.txt
rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-001-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-001-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-002-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-002-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-003-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-003-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-004-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-004-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-dir-target-005-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-dir-target-005-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-009-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-010-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-011-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-012-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-down-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-down-013-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-009-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-010-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-011-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-012-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-left-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-left-013-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-009-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-010-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-011-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-012-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-right-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-right-013-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-009-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-009-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-010-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-010-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-011-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-011-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-012-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-012-frame.html
rename : testing/web-platform/tests/css/css-ui-3/support/nav-up-013-frame.html => testing/web-platform/tests/css/css-ui-4/support/nav-up-013-frame.html
rename : testing/web-platform/tests/fullscreen/api/element-ready-check-enabled-flag-not-set-manual.html => testing/web-platform/tests/fullscreen/api/element-ready-check-not-allowed-manual.html
rename : testing/web-platform/tests/html/user-interaction/focus/tabindex-focus-flag.html => testing/web-platform/tests/html/editing/focus/tabindex-focus-flag.html
rename : testing/web-platform/tests/image-decodes/image-decode-iframe.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-iframe.html
rename : testing/web-platform/tests/image-decodes/image-decode-path-changes.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode-path-changes.html
rename : testing/web-platform/tests/image-decodes/image-decode.html => testing/web-platform/tests/html/semantics/embedded-content/the-img-element/decode/image-decode.html
2017-09-07 12:50:49 +01:00

45 lines
2.5 KiB
HTML

<!doctype html>
<html>
<head>
<title>Test setSinkId behavior </title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="https://www.w3.org/TR/audio-output/#dom-htmlmediaelement-setsinkid">
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">This test checks that <code>setSinkId</code> follows the algorithm (but does not consider actual rendering of the audio which needs to be manual).</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script>
"use strict";
const is_output = d => d.kind === "audiooutput";
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("inexistent_device_id")), "setSinkId fails with NotFoundError on made up deviceid");
promise_test(t =>
navigator.mediaDevices.enumerateDevices().then(list => {
assert_not_equals(list.find(is_output), undefined, "media device list includes at least one audio output device");
// since we haven't gained any specific permission,
// for all listed audio output devices, calling setSinkId with device id can
// either create a security exception or work and thus reflect the deviceId
let acceptedDevice = 0;
list.filter(is_output).forEach((d,i) => promise_test(td => audio.setSinkId(d.deviceId).then(r => {
assert_equals(r, undefined, "setSinkId resolves with undefined");
assert_equals(audio.sinkId, d.deviceId, "when it resolves, setSinkId updates sinkId to the requested deviceId");
assert_equals(acceptedDevice, 0, "only one output device can be set without permission");
acceptedDevice++;
promise_test(t => audio.setSinkId(d.deviceId), "resetting sinkid on same current value should always work");
promise_test(t => audio.setSinkId(""), "resetting sinkid on default audio output should always work");
}, e => {
assert_equals(e.name, "SecurityError", "On known devices, the only possible failure of setSinkId is a securityerror"); // assuming AbortError can't happen in the test environment by default
}), "Correctly reacts to setting known deviceid as sinkid " + i));
}), "List media devices");
</script>
</body>
</html>