Integration test that verifies that data channels open.

This is in preparation for writing tests that verify that
they close, and that they close at the right times.

Bug: chromium:1030631, webrtc:10360
Change-Id: I8129a9fc9731c1bfe1a660e82e23c1aeff1e5087
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/162181
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30091}
diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc
index ab617c6..7a8d152 100644
--- a/pc/peer_connection_integrationtest.cc
+++ b/pc/peer_connection_integrationtest.cc
@@ -3556,6 +3556,7 @@
 static void MakeSpecCompliantSctpOffer(cricket::SessionDescription* desc) {
   cricket::SctpDataContentDescription* dcd_offer =
       GetFirstSctpDataContentDescription(desc);
+  // See https://crbug.com/webrtc/11211 - this function is a no-op
   ASSERT_TRUE(dcd_offer);
   dcd_offer->set_use_sctpmap(false);
   dcd_offer->set_protocol("UDP/DTLS/SCTP");
@@ -5967,15 +5968,25 @@
   caller()->CreateDataChannel();
   caller()->AddAudioVideoTracks();
   callee()->AddAudioVideoTracks();
-  caller()->SetGeneratedSdpMunger(MakeSpecCompliantSctpOffer);
   caller()->CreateAndSetAndSignalOffer();
   ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
-  // Ensure that media and data are multiplexed on the same DTLS transport.
-  // This only works on Unified Plan, because transports are not exposed in plan
-  // B.
-  auto sctp_info = caller()->pc()->GetSctpTransport()->Information();
-  EXPECT_EQ(sctp_info.dtls_transport(),
-            caller()->pc()->GetSenders()[0]->dtls_transport());
+  ASSERT_EQ_WAIT(SctpTransportState::kConnected,
+                 caller()->pc()->GetSctpTransport()->Information().state(),
+                 kDefaultTimeout);
+  ASSERT_TRUE_WAIT(callee()->data_channel(), kDefaultTimeout);
+  ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout);
+}
+
+TEST_F(PeerConnectionIntegrationTestUnifiedPlan,
+       EndToEndCallWithDataChannelOnlyConnects) {
+  ASSERT_TRUE(CreatePeerConnectionWrappers());
+  ConnectFakeSignaling();
+  caller()->CreateDataChannel();
+  caller()->CreateAndSetAndSignalOffer();
+  ASSERT_TRUE_WAIT(SignalingStateStable(), kDefaultTimeout);
+  ASSERT_TRUE_WAIT(callee()->data_channel(), kDefaultTimeout);
+  ASSERT_TRUE_WAIT(callee()->data_observer()->IsOpen(), kDefaultTimeout);
+  ASSERT_TRUE(caller()->data_observer()->IsOpen());
 }
 
 #endif  // HAVE_SCTP