Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Unified Diff: webrtc/api/peerconnectionendtoend_unittest.cc

Issue 1844803002: Modify PeerConnection for end-to-end QuicDataChannel usage (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Sync to upstream after landing QUIC data channel and QUIC transport CLs Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/peerconnection_unittest.cc ('k') | webrtc/api/peerconnectioninterface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/peerconnectionendtoend_unittest.cc
diff --git a/webrtc/api/peerconnectionendtoend_unittest.cc b/webrtc/api/peerconnectionendtoend_unittest.cc
index 95369b15c0823a0bbb81f6e517780711f94d2c1d..9ccf6ed8afaa7a9630002d7e9e4691520c5f1c35 100644
--- a/webrtc/api/peerconnectionendtoend_unittest.cc
+++ b/webrtc/api/peerconnectionendtoend_unittest.cc
@@ -55,6 +55,9 @@ class PeerConnectionEndToEndTest
"caller", &worker_thread_);
callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>(
"callee", &worker_thread_);
+ webrtc::PeerConnectionInterface::IceServer ice_server;
+ ice_server.uri = "stun:stun.l.google.com:19302";
+ config_.servers.push_back(ice_server);
#ifdef WEBRTC_ANDROID
webrtc::InitializeAndroidObjects();
#endif
@@ -65,8 +68,8 @@ class PeerConnectionEndToEndTest
}
void CreatePcs(const MediaConstraintsInterface* pc_constraints) {
- EXPECT_TRUE(caller_->CreatePc(pc_constraints));
- EXPECT_TRUE(callee_->CreatePc(pc_constraints));
+ EXPECT_TRUE(caller_->CreatePc(pc_constraints, config_));
+ EXPECT_TRUE(callee_->CreatePc(pc_constraints, config_));
PeerConnectionTestWrapper::Connect(caller_.get(), callee_.get());
caller_->SignalOnDataChannel.connect(
@@ -160,6 +163,7 @@ class PeerConnectionEndToEndTest
rtc::scoped_refptr<PeerConnectionTestWrapper> callee_;
DataChannelList caller_signaled_data_channels_;
DataChannelList callee_signaled_data_channels_;
+ webrtc::PeerConnectionInterface::RTCConfiguration config_;
};
// Disabled for TSan v2, see
@@ -315,6 +319,68 @@ TEST_F(PeerConnectionEndToEndTest,
EXPECT_EQ(1U, dc_2_observer->received_message_count());
}
+#ifdef HAVE_QUIC
+// Test that QUIC data channels can be used and that messages go to the correct
+// remote data channel when both peers want to use QUIC. It is assumed that the
+// application has externally negotiated the data channel parameters.
+TEST_F(PeerConnectionEndToEndTest, MessageTransferBetweenQuicDataChannels) {
+ config_.enable_quic = true;
+ CreatePcs();
+
+ webrtc::DataChannelInit init_1;
+ init_1.id = 0;
+ init_1.ordered = false;
+ init_1.reliable = true;
+
+ webrtc::DataChannelInit init_2;
+ init_2.id = 1;
+ init_2.ordered = false;
+ init_2.reliable = true;
+
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_1(
+ caller_->CreateDataChannel("data", init_1));
+ ASSERT_NE(nullptr, caller_dc_1);
+ rtc::scoped_refptr<DataChannelInterface> caller_dc_2(
+ caller_->CreateDataChannel("data", init_2));
+ ASSERT_NE(nullptr, caller_dc_2);
+ rtc::scoped_refptr<DataChannelInterface> callee_dc_1(
+ callee_->CreateDataChannel("data", init_1));
+ ASSERT_NE(nullptr, callee_dc_1);
+ rtc::scoped_refptr<DataChannelInterface> callee_dc_2(
+ callee_->CreateDataChannel("data", init_2));
+ ASSERT_NE(nullptr, callee_dc_2);
+
+ Negotiate();
+ WaitForConnection();
+ EXPECT_TRUE_WAIT(caller_dc_1->state() == webrtc::DataChannelInterface::kOpen,
+ kMaxWait);
+ EXPECT_TRUE_WAIT(callee_dc_1->state() == webrtc::DataChannelInterface::kOpen,
+ kMaxWait);
+ EXPECT_TRUE_WAIT(caller_dc_2->state() == webrtc::DataChannelInterface::kOpen,
+ kMaxWait);
+ EXPECT_TRUE_WAIT(callee_dc_2->state() == webrtc::DataChannelInterface::kOpen,
+ kMaxWait);
+
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_1_observer(
+ new webrtc::MockDataChannelObserver(callee_dc_1.get()));
+
+ rtc::scoped_ptr<webrtc::MockDataChannelObserver> dc_2_observer(
+ new webrtc::MockDataChannelObserver(callee_dc_2.get()));
+
+ const std::string message_1 = "hello 1";
+ const std::string message_2 = "hello 2";
+
+ caller_dc_1->Send(webrtc::DataBuffer(message_1));
+ EXPECT_EQ_WAIT(message_1, dc_1_observer->last_message(), kMaxWait);
+
+ caller_dc_2->Send(webrtc::DataBuffer(message_2));
+ EXPECT_EQ_WAIT(message_2, dc_2_observer->last_message(), kMaxWait);
+
+ EXPECT_EQ(1U, dc_1_observer->received_message_count());
+ EXPECT_EQ(1U, dc_2_observer->received_message_count());
+}
+#endif // HAVE_QUIC
+
// Verifies that a DataChannel added from an OPEN message functions after
// a channel has been previously closed (webrtc issue 3778).
// This previously failed because the new channel re-uses the ID of the closed
« no previous file with comments | « webrtc/api/peerconnection_unittest.cc ('k') | webrtc/api/peerconnectioninterface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698