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.
|
// Optional unsigned short in WebIDL, -1 means unspecified.
|
||||||
public int maxRetransmits = -1;
|
public int maxRetransmits = -1;
|
||||||
public String protocol = "";
|
public String protocol = "";
|
||||||
public boolean negotiated = true;
|
public boolean negotiated = false;
|
||||||
// Optional unsigned short in WebIDL, -1 means unspecified.
|
// Optional unsigned short in WebIDL, -1 means unspecified.
|
||||||
public int id = -1;
|
public int id = -1;
|
||||||
|
|
||||||
|
@ -509,12 +509,6 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
MediaConstraints pcConstraints = new MediaConstraints();
|
MediaConstraints pcConstraints = new MediaConstraints();
|
||||||
pcConstraints.mandatory.add(
|
pcConstraints.mandatory.add(
|
||||||
new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
|
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 =
|
LinkedList<PeerConnection.IceServer> iceServers =
|
||||||
new LinkedList<PeerConnection.IceServer>();
|
new LinkedList<PeerConnection.IceServer>();
|
||||||
@ -567,7 +561,9 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
answeringExpectations.expectSignalingChange(
|
answeringExpectations.expectSignalingChange(
|
||||||
SignalingState.HAVE_REMOTE_OFFER);
|
SignalingState.HAVE_REMOTE_OFFER);
|
||||||
answeringExpectations.expectAddStream("oLMS");
|
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);
|
answeringPC.setRemoteDescription(sdpLatch, offerSdp);
|
||||||
assertEquals(
|
assertEquals(
|
||||||
PeerConnection.SignalingState.STABLE, offeringPC.signalingState());
|
PeerConnection.SignalingState.STABLE, offeringPC.signalingState());
|
||||||
@ -638,6 +634,8 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
IceConnectionState.CONNECTED);
|
IceConnectionState.CONNECTED);
|
||||||
|
|
||||||
offeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
offeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
||||||
|
// See commentary about SCTP DataChannels above for why this is here.
|
||||||
|
answeringExpectations.expectDataChannel("offeringDC");
|
||||||
answeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
answeringExpectations.expectStateChange(DataChannel.State.OPEN);
|
||||||
|
|
||||||
for (IceCandidate candidate : offeringExpectations.gotIceCandidates) {
|
for (IceCandidate candidate : offeringExpectations.gotIceCandidates) {
|
||||||
@ -665,29 +663,25 @@ public class PeerConnectionTest extends TestCase {
|
|||||||
assertTrue(offeringExpectations.dataChannel.send(buffer));
|
assertTrue(offeringExpectations.dataChannel.send(buffer));
|
||||||
answeringExpectations.waitForAllExpectationsToBeSatisfied();
|
answeringExpectations.waitForAllExpectationsToBeSatisfied();
|
||||||
|
|
||||||
// TODO(fischman): add testing of binary messages when SCTP channels are
|
// Construct this binary message two different ways to ensure no
|
||||||
// supported (https://code.google.com/p/webrtc/issues/detail?id=1408).
|
// shortcuts are taken.
|
||||||
// // Construct this binary message two different ways to ensure no
|
ByteBuffer expectedBinaryMessage = ByteBuffer.allocateDirect(5);
|
||||||
// // shortcuts are taken.
|
for (byte i = 1; i < 6; ++i) {
|
||||||
// ByteBuffer expectedBinaryMessage = ByteBuffer.allocateDirect(5);
|
expectedBinaryMessage.put(i);
|
||||||
// for (byte i = 1; i < 6; ++i) {
|
}
|
||||||
// expectedBinaryMessage.put(i);
|
expectedBinaryMessage.flip();
|
||||||
// }
|
offeringExpectations.expectMessage(expectedBinaryMessage, true);
|
||||||
// expectedBinaryMessage.flip();
|
assertTrue(answeringExpectations.dataChannel.send(
|
||||||
// offeringExpectations.expectMessage(expectedBinaryMessage, true);
|
new DataChannel.Buffer(
|
||||||
// assertTrue(answeringExpectations.dataChannel.send(
|
ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 } ), true)));
|
||||||
// new DataChannel.Buffer(
|
offeringExpectations.waitForAllExpectationsToBeSatisfied();
|
||||||
// ByteBuffer.wrap(new byte[] { 1, 2, 3, 4, 5 } ), true)));
|
|
||||||
// offeringExpectations.waitForAllExpectationsToBeSatisfied();
|
|
||||||
|
|
||||||
offeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
offeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
||||||
answeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
answeringExpectations.expectStateChange(DataChannel.State.CLOSING);
|
||||||
|
offeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||||
|
answeringExpectations.expectStateChange(DataChannel.State.CLOSED);
|
||||||
answeringExpectations.dataChannel.close();
|
answeringExpectations.dataChannel.close();
|
||||||
offeringExpectations.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) {
|
if (RENDER_TO_GUI) {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user