summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/RTCConfiguration-validation.html
blob: 851ed8d81b188468c053996275e534c307c6864d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<!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>