-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for if codec info surfaces at the right time.
In support of landing this spec PR: w3c/webrtc-pc#2972 Bug: None Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762 Commit-Queue: Harald Alvestrand <[email protected]> Reviewed-by: Florent Castelli <[email protected]> Cr-Commit-Position: refs/heads/main@{#1317347}
- Loading branch information
1 parent
1ec7cf9
commit 4d7ec06
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>RTCRtpSender.prototype.getParameters</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="dictionary-helper.js"></script> | ||
<script src="RTCPeerConnection-helper.js"></script> | ||
<script src="RTCRtpParameters-helper.js"></script> | ||
<script> | ||
'use strict'; | ||
|
||
promise_test(async t => { | ||
const stream = await getNoiseStream({video: true}); | ||
t.add_cleanup(() => stream.getTracks().forEach(track => track.stop())); | ||
const [track] = stream.getTracks(); | ||
const caller = new RTCPeerConnection(); | ||
t.add_cleanup(() => caller.close()); | ||
caller.addTrack(track); | ||
const callee = new RTCPeerConnection(); | ||
t.add_cleanup(() => callee.close()); | ||
callee.addTrack(track); | ||
var callerSender = caller.getTransceivers()[0].sender; | ||
assert_equals(callerSender.getParameters().codecs.length, 0); | ||
const offer = await caller.createOffer(); | ||
await caller.setLocalDescription(offer); | ||
await callee.setRemoteDescription(offer); | ||
// Check that it is a single 2-way transceiver. | ||
assert_equals(callee.getTransceivers().length, 1); | ||
var calleeSender = callee.getTransceivers()[0].sender; | ||
assert_equals(calleeSender.getParameters().codecs.length, 0); | ||
const answer = await callee.createAnswer(); | ||
await callee.setLocalDescription(answer); | ||
assert_greater_than(calleeSender.getParameters().codecs.length, 0, | ||
"callee codecs after answer"); | ||
await caller.setRemoteDescription(answer); | ||
assert_greater_than(callerSender.getParameters().codecs.length, 0, | ||
"caller codecs after answer"); | ||
}, 'getParameters() surfaces codecs on two-way sender with addTrack at the right time'); | ||
|
||
</script> |