fune/testing/web-platform/tests/webrtc/RTCConfiguration-validation.html
Dominique Hazael-Massieux 83538159d4 Bug 1864814 [wpt PR 43167] - Add test for w3c/webrtc-pc#2689, a=testonly
Automatic update from web-platform-tests
Add test for w3c/webrtc-pc#2689 (#43167)

* Add test for w3c/webrtc-pc#2689

Ensure that an invalid rtcconfiguration doesn't get partially applied

* Fix typo

Co-authored-by: Harald Alvestrand <hta+github@alvestrand.no>

---------

Co-authored-by: Harald Alvestrand <hta+github@alvestrand.no>
--

wpt-commits: 967eaa031cfe4039a18a7380899dbe3091d16cbe
wpt-pr: 43167
2023-11-22 12:51:27 +00:00

20 lines
916 B
HTML

<!doctype html>
<meta name="timeout" content="long">
<title>RTCConfiguration validation</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="RTCConfiguration-helper.js"></script>
<script src="RTCPeerConnection-helper.js"></script>
<script>
test(() => {
// Check that a configuration change gets applied only if it's entirely valid
// see https://github.com/w3c/webrtc-pc/issues/2688
// and https://github.com/w3c/webrtc-pc/pull/2689
const pc = new RTCPeerConnection();
assert_equals(pc.getConfiguration().iceTransportPolicy, 'all');
assert_throws_dom('SyntaxError', () =>
pc.setConfiguration({iceTransportPolicy: 'relay', iceServers: [{urls: ""}]})
);
assert_equals(pc.getConfiguration().iceTransportPolicy, 'all');
}, `setConfiguration only applies if the entire configuration is valid`);
</script>