PeerConnectionTest(java): test SCTP DataChannels.
BUG=1408,2253,2626 R=jiayl@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7929004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5477 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
ecd622eec3
commit
a06ebab1e1
@ -39,7 +39,7 @@ public class DataChannel {
|
||||
// Optional unsigned short in WebIDL, -1 means unspecified.
|
||||
public int maxRetransmits = -1;
|
||||
public String protocol = "";
|
||||
public boolean negotiated = true;
|
||||
public boolean negotiated = false;
|
||||
// Optional unsigned short in WebIDL, -1 means unspecified.
|
||||
public int id = -1;
|
||||
|
||||
|
@ -509,12 +509,6 @@ public class PeerConnectionTest extends TestCase {
|
||||
MediaConstraints pcConstraints = new MediaConstraints();
|
||||
pcConstraints.mandatory.add(
|
||||
new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
|
||||
pcConstraints.optional.add(
|
||||
new MediaConstraints.KeyValuePair("RtpDataChannels", "true"));
|
||||
// TODO(fischman): replace above with below to test SCTP channels when
|
||||
// supported (https://code.google.com/p/webrtc/issues/detail?id=1408).
|
||||
// pcConstraints.optional.add(new MediaConstraints.KeyValuePair(
|
||||
// "internalSctpDataChannels", "true"));
|
||||
|
||||
LinkedList<PeerConnection.IceServer> iceServers =
|
||||
new LinkedList<PeerConnection.IceServer>();
|
||||
@ -567,7 +561,9 @@ public class PeerConnectionTest extends TestCase {
|
||||
answeringExpectations.expectSignalingChange(
|
||||
SignalingState.HAVE_REMOTE_OFFER);
|
||||
answeringExpectations.expectAddStream("oLMS");
|
||||
answeringExpectations.expectDataChannel("offeringDC");
|
||||
// SCTP DataChannels are announced via OPEN messages over the established
|
||||
// connection (not via SDP), so answeringExpectations can only register
|
||||
// expecting the channel during ICE, below.
|
||||
answeringPC.setRemoteDescription(sdpLatch, offerSdp);
|
||||
assertEquals(
|
||||
PeerConnection.SignalingState.STABLE, offeringPC.signalingState());
|
||||
@ -638,6 +634,8 @@ public class PeerConnectionTest extends TestCase {
|
||||
IceConnectionState.CONNECTED);
|
||||
|
||||
offeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
||||
// See commentary about SCTP DataChannels above for why this is here.
|
||||
answeringExpectations.expectDataChannel("offeringDC");
|
||||
answeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
||||
|
||||
for (IceCandidate candidate : offeringExpectations.gotIceCandidates) {
|
||||
@ -665,29 +663,25 @@ public class PeerConnectionTest extends TestCase {
|
||||
assertTrue(offeringExpectations.dataChannel.send(buffer));
|
||||
answeringExpectations.waitForAllExpectationsToBeSatisfied();
|
||||
|
||||
// TODO(fischman): add testing of binary messages when SCTP channels are
|
||||
// supported (https://code.google.com/p/webrtc/issues/detail?id=1408).
|
||||
// // Construct this binary message two different ways to ensure no
|
||||
// // shortcuts are taken.
|
||||
// ByteBuffer expectedBinaryMessage = ByteBuffer.allocateDirect(5);
|
||||
// for (byte i = 1; i < 6; ++i) {
|
||||
// expectedBinaryMessage.put(i);
|
||||
// }
|
||||
// expectedBinaryMessage.flip();
|
||||
// offeringExpectations.expectMessage(expectedBinaryMessage, true);
|
||||
// assertTrue(answeringExpectations.dataChannel.send(
|
||||
// new DataChannel.Buffer(
|
||||
// ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 } ), true)));
|
||||
// offeringExpectations.waitForAllExpectationsToBeSatisfied();
|
||||
// Construct this binary message two different ways to ensure no
|
||||
// shortcuts are taken.
|
||||
ByteBuffer expectedBinaryMessage = ByteBuffer.allocateDirect(5);
|
||||
for (byte i = 1; i < 6; ++i) {
|
||||
expectedBinaryMessage.put(i);
|
||||
}
|
||||
expectedBinaryMessage.flip();
|
||||
offeringExpectations.expectMessage(expectedBinaryMessage, true);
|
||||
assertTrue(answeringExpectations.dataChannel.send(
|
||||
new DataChannel.Buffer(
|
||||
ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 } ), true)));
|
||||
offeringExpectations.waitForAllExpectationsToBeSatisfied();
|
||||
|
||||
offeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
||||
answeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
||||
offeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||
answeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||
answeringExpectations.dataChannel.close();
|
||||
offeringExpectations.dataChannel.close();
|
||||
// TODO(fischman): implement a new offer/answer exchange to finalize the
|
||||
// closing of the channel in order to see the CLOSED state reached.
|
||||
// offeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||
// answeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||
|
||||
if (RENDER_TO_GUI) {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user