-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Basic test for generated SDP #13887
Merged
alvestrand
merged 2 commits into
web-platform-tests:master
from
alvestrand:jsep-basic-sdp
Nov 4, 2018
Merged
Basic test for generated SDP #13887
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>RTCPeerConnection.prototype.createOffer</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../RTCPeerConnection-helper.js"></script> | ||
<script> | ||
'use strict'; | ||
|
||
// Tests for the construction of initial offers according to | ||
// draft-ietf-rtcweb-jsep-24 section 5.2.1 | ||
promise_test(async t => { | ||
const pc = new RTCPeerConnection(); | ||
const offer = await pc.createOffer({offerToReceiveVideo: true}); | ||
let offer_lines = offer.sdp.split('\r\n'); | ||
// The first 3 lines are dictated by JSEP. | ||
assert_equals(offer_lines[0], "v=0"); | ||
assert_equals(offer_lines[1].slice(0, 2), "o="); | ||
// JSEP says that the address part SHOULD be a meaningless address | ||
// "such as" IN IP4 127.0.0.1. We do strict matching here in order | ||
// to detect if anyone ever uses something different. | ||
assert_regexp_match(offer_lines[1], /^o=- \d+ \d+ IN IP4 127.0.0.1$/); | ||
const fields = RegExp(/^o=- (\d+) (\d+)/).exec(offer_lines[1]); | ||
// Per RFC 3264, the sess-id should be representable in an uint64 | ||
// Note: JSEP -24 has this wrong - see bug: | ||
// https://github.com/rtcweb-wg/jsep/issues/855 | ||
assert_less_than(Number(fields[1]), 2**64); | ||
// Per RFC 3264, the version should be less than 2^62 to avoid overflow | ||
assert_less_than(Number(fields[2]), 2**62); | ||
// Note: using - in s=- is a SHOULD in JSEP, not a MUST. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should being not complying to "SHOULD" requirements in JSEP result in test failure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that we should (SHOULD) do that.... |
||
assert_equals(offer_lines[2], "s=-"); | ||
// After this, the order is not dictated by JSEP. | ||
// TODO: Check lines subsequent to the s= line. | ||
}, 'Offer conforms to basic SDP requirements'); | ||
</script> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails on Firefox as it has the username field value "mozilla...THIS_IS_SDPARTA". JSEP says "
The value of the <username> field SHOULD be "-"
". Since it is optional it should not result in a test failure.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nils-ohlmeier says that Firefox expects to change this.
SHOULD is a problem for tests; if we don't test them, will they ever be tested?