-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add test for constructing RTCSctpTransport #6147
Merged
rwaldron
merged 2 commits into
web-platform-tests:master
from
soareschen:rtcsctptransport-constructor
Jun 7, 2017
Merged
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,89 @@ | ||
<!doctype html> | ||
<meta charset="utf-8"> | ||
<title>RTCSctpTransport constructor</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="./RTCPeerConnection-helper.js"></script> | ||
<script> | ||
'use strict'; | ||
|
||
// Test is based on the following editor draft: | ||
// https://w3c.github.io/webrtc-pc/archives/20170515/webrtc.html | ||
|
||
// The following helper functions are called from RTCPeerConnection-helper.js: | ||
// generateOffer() | ||
// generateAnswer() | ||
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. This is awesome :) If I have time, I will try to update all the other tests with this comment. |
||
|
||
/* | ||
6.1. RTCPeerConnection Interface Extensions | ||
partial interface RTCPeerConnection { | ||
readonly attribute RTCSctpTransport? sctp; | ||
... | ||
}; | ||
|
||
1.1. RTCSctpTransport Interface | ||
interface RTCSctpTransport { | ||
readonly attribute RTCDtlsTransport transport; | ||
readonly attribute unsigned long maxMessageSize; | ||
}; | ||
|
||
4.3.1. Operation | ||
When the RTCPeerConnection() constructor is invoked | ||
8. Let connection have an [[sctpTransport]] internal slot, | ||
initialized to null. | ||
|
||
To set an RTCSessionDescription description | ||
6. If description is of type "answer" or "pranswer", then run the | ||
following steps: | ||
1. If description initiates the establishment of a new SCTP | ||
association, as defined in [SCTP-SDP], Sections 10.3 and 10.4, | ||
set the value of connection's [[sctpTransport]] internal slot | ||
to a newly created RTCSctpTransport. | ||
*/ | ||
|
||
promise_test(t => { | ||
const pc = new RTCPeerConnection(); | ||
assert_equals(pc.sctp, null); | ||
pc.createDataChannel('test'); | ||
|
||
return pc.createOffer() | ||
.then(offer => | ||
pc.setLocalDescription(offer) | ||
.then(() => generateAnswer(offer))) | ||
.then(answer => pc.setRemoteDescription(answer)) | ||
.then(() => { | ||
const { sctp } = pc; | ||
assert_not_equals(sctp, null); | ||
assert_true(sctp instanceof RTCSctpTransport, | ||
'Expect pc.sctp to be instance of RTCSctpTransport'); | ||
|
||
assert_true(sctp.transport instanceof RTCDtlsTransport, | ||
'Expect sctp.transport to be instance of RTCDtlsTransport'); | ||
|
||
assert_true(typeof sctp.maxMessageSize, 'number', | ||
'Expect sctp.maxMessageSize to be a number'); | ||
}); | ||
}, 'setRemoteDescription() with answer containing data media should initialize pc.sctp'); | ||
|
||
promise_test(t => { | ||
const pc = new RTCPeerConnection(); | ||
assert_equals(pc.sctp, null); | ||
|
||
return generateOffer({ data: true }) | ||
.then(offer => pc.setRemoteDescription(offer)) | ||
.then(() => pc.createAnswer()) | ||
.then(answer => pc.setLocalDescription(answer)) | ||
.then(() => { | ||
const { sctp } = pc; | ||
assert_not_equals(sctp, null); | ||
assert_true(sctp instanceof RTCSctpTransport, | ||
'Expect pc.sctp to be instance of RTCSctpTransport'); | ||
|
||
assert_true(sctp.transport instanceof RTCDtlsTransport, | ||
'Expect sctp.transport to be instance of RTCDtlsTransport'); | ||
|
||
assert_true(typeof sctp.maxMessageSize, 'number', | ||
'Expect sctp.maxMessageSize to be a number'); | ||
}); | ||
}, 'setLocalDescription() with answer containing data media should initialize pc.sctp'); | ||
</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.
Need to add this to
interfaces.html
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 require quite a bit of refactoring on
interfaces.html
since it involves async initialization. I will put that in a separate PR together with other pending interface tests.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.
Sounds like a good plan!