Bug 1639126 [wpt PR 23686] - webrtc wpt: s/doSignalingHandshake/exchangeOfferAnswer...
[gecko.git] / testing / web-platform / tests / webrtc-priority / RTCPeerConnection-ondatachannel.html
blobe4b1e8d58a51be112cb4f68a7681268219f0c81c
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>RTCPeerConnection.prototype.ondatachannel</title>
4 <script src="/resources/testharness.js"></script>
5 <script src="/resources/testharnessreport.js"></script>
6 <script src="../webrtc/RTCPeerConnection-helper.js"></script>
7 <script>
8 'use strict';
10 promise_test(async (t) => {
11 const resolver = new Resolver();
12 const pc1 = new RTCPeerConnection();
13 const pc2 = new RTCPeerConnection();
14 t.add_cleanup(() => pc1.close());
15 t.add_cleanup(() => pc2.close());
17 const dc1 = pc1.createDataChannel('test', {
18 ordered: false,
19 maxRetransmits: 1,
20 protocol: 'custom',
21 priority: 'high'
22 });
24 assert_equals(dc1.priority, 'high');
26 pc2.ondatachannel = t.step_func((event) => {
27 const dc2 = event.channel;
29 assert_equals(dc2.priority, 'high');
31 resolver.resolve();
32 });
34 exchangeIceCandidates(pc1, pc2);
35 await exchangeOfferAnswer(pc1, pc2);
37 await resolver;
38 }, 'In-band negotiated channel created on remote peer should match the same configuration as local ' +
39 'peer');
41 promise_test(async (t) => {
42 const resolver = new Resolver();
43 const pc1 = new RTCPeerConnection();
44 const pc2 = new RTCPeerConnection();
45 t.add_cleanup(() => pc1.close());
46 t.add_cleanup(() => pc2.close());
48 const dc1 = pc1.createDataChannel('');
50 assert_equals(dc1.priority, 'low');
52 pc2.ondatachannel = t.step_func((event) => {
53 const dc2 = event.channel;
54 assert_equals(dc2.priority, 'low');
56 resolver.resolve();
57 });
59 exchangeIceCandidates(pc1, pc2);
60 await exchangeOfferAnswer(pc1, pc2);
62 await resolver;
63 }, 'In-band negotiated channel created on remote peer should match the same (default) ' +
64 'configuration as local peer');
66 </script>