Skip to content

Commit

Permalink
Bug 1950376 [wpt PR 50929] - webrtc wpt: add test asserting the order…
Browse files Browse the repository at this point in the history
… of track events matches the SDP, a=testonly

Automatic update from web-platform-tests
webrtc wpt: add test asserting the order of track events matches the SDP

and is not dependent on the order of tracks in the MediaStream

See
  w3c/mediacapture-main#1028

Bug: None
Change-Id: I77ac10a078632bc9ae944a3254626ff30965c433
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6286091
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Guido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1424488}

--

wpt-commits: 436123f65ed0a64afd3aea668b8928126fb422c1
wpt-pr: 50929
  • Loading branch information
fippo authored and moz-wptsync-bot committed Feb 28, 2025
1 parent 6626071 commit 016fdaa
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,29 @@
await new Promise(resolve => t.step_timeout(resolve, 100));
}, `Using offerToReceiveAudio and offerToReceiveVideo should only cause a ${type} track event to fire, if ${type} was the only type negotiated`));

promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());

const stream = new MediaStream();
const stream2 = new MediaStream();
// audio-then-video.
pc1.addTransceiver('audio', {streams: [stream]});
pc1.addTransceiver('video', {streams: [stream]});
// video-then-audio
pc1.addTransceiver('video', {streams: [stream2]});
pc1.addTransceiver('audio', {streams: [stream2]});
const tracks = [];
pc2.ontrack = (e) => tracks.push(e.track)

await pc2.setRemoteDescription(await pc1.createOffer());
assert_equals(tracks.length, 4, 'ontrack should have fired twice');
assert_equals(tracks[0].kind, 'audio', 'first ontrack fires with an audio track');
assert_equals(tracks[1].kind, 'video', 'second ontrack fires with a video track');
assert_equals(tracks[2].kind, 'video', 'third ontrack fires with a video track');
assert_equals(tracks[3].kind, 'audio', 'fourth ontrack fires with an audio track');
}, `addTransceiver order of kinds is retained in ontrack at the receiver`);

</script>

0 comments on commit 016fdaa

Please sign in to comment.