AX: <svg> elements with labels and no accessible contents are exposed as empty AXGroups
[WebKit-https.git] / LayoutTests / webrtc / ice-candidate-sdpMLineIndex.html
1 <!doctype html>
2 <html>
3     <head>
4         <meta charset="utf-8">
5         <title>Testing ICE candidates with audio and video tracks</title>
6         <script src="../resources/testharness.js"></script>
7         <script src="../resources/testharnessreport.js"></script>
8     </head>
9     <body>
10         <script>
11 promise_test((test) => {
12     if (window.testRunner)
13         testRunner.setUserMediaPermission(true);
14
15     return navigator.mediaDevices.getUserMedia({audio: true, video: true}).then((stream) => {
16         return new Promise((resolve, reject) => {
17             var pc = new RTCPeerConnection();
18             pc.addTrack(stream.getAudioTracks()[0], stream);
19             pc.addTrack(stream.getVideoTracks()[0], stream); 
20             var candidates = [];
21             pc.onicecandidate = (event) => {
22                 if (event.candidate === null) {
23                     resolve(candidates);
24                     return;
25                 }
26                 candidates.push(event.candidate.candidate);
27             };
28             pc.createOffer().then((offer) => {
29                 pc.setLocalDescription(offer);
30             });
31          });
32      }).then((candidates) => {
33          var index0Count, index1Count;
34          for (var candidate of candidates) {
35              if (candidate.sdpMLineIndex === 0)
36                  index0Count++;
37              if (candidate.sdpMLineIndex === 1)
38                  index1Count++;
39          }
40          assert_true(!!candidates.length, "candidates should be found");
41          assert_equals(index0Count, index1Count, "same number of candidates should be found for audio and video");
42      });
43 }, "Basic audio/video ICE candidate gathering");
44         </script>
45     </body>
46 </html>