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

Unified Diff: webrtc/media/sctp/sctptransport_unittest.cc

Issue 2743653005: Fixed invalid filtering of SCTP datachannel packets on high ports. (Closed)
Patch Set: Created 3 years, 9 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/media/sctp/sctptransport.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/media/sctp/sctptransport_unittest.cc
diff --git a/webrtc/media/sctp/sctptransport_unittest.cc b/webrtc/media/sctp/sctptransport_unittest.cc
index 7fcbd9ce8eb5fd7aca6b65bcb1185e8e08176757..b8495d081a5fbc94deb6d13a38be3ab7b8dc1399 100644
--- a/webrtc/media/sctp/sctptransport_unittest.cc
+++ b/webrtc/media/sctp/sctptransport_unittest.cc
@@ -130,6 +130,10 @@ class SctpTransportTest : public testing::Test, public sigslot::has_slots<> {
static void SetUpTestCase() {}
void SetupConnectedTransportsWithTwoStreams() {
+ SetupConnectedTransportsWithTwoStreams(kTransport1Port, kTransport2Port);
+ }
+
+ void SetupConnectedTransportsWithTwoStreams(int port1, int port2) {
fake_dtls1_.reset(new FakeDtlsTransport("fake dtls 1", 0));
fake_dtls2_.reset(new FakeDtlsTransport("fake dtls 2", 0));
recv1_.reset(new SctpFakeDataReceiver());
@@ -153,8 +157,8 @@ class SctpTransportTest : public testing::Test, public sigslot::has_slots<> {
LOG(LS_VERBOSE) << "Connect the transports -----------------------------";
// Both transports need to have started (with matching ports) for an
// association to be formed.
- transport1_->Start(kTransport1Port, kTransport2Port);
- transport2_->Start(kTransport2Port, kTransport1Port);
+ transport1_->Start(port1, port2);
+ transport2_->Start(port2, port1);
}
bool AddStream(int sid) {
@@ -451,6 +455,20 @@ TEST_F(SctpTransportTest, SendDataWithNonexistentStreamFails) {
EXPECT_EQ(SDR_ERROR, result);
}
+TEST_F(SctpTransportTest, SendDataHighPorts) {
+ SetupConnectedTransportsWithTwoStreams(32768, 32769);
+
+ SendDataResult result;
+ ASSERT_TRUE(SendData(transport1(), 1, "hello?", &result));
+ EXPECT_EQ(SDR_SUCCESS, result);
+ EXPECT_TRUE_WAIT(ReceivedData(receiver2(), 1, "hello?"), kDefaultTimeout);
+
+ ASSERT_TRUE(SendData(transport2(), 2, "hi transport1", &result));
+ EXPECT_EQ(SDR_SUCCESS, result);
+ EXPECT_TRUE_WAIT(ReceivedData(receiver1(), 2, "hi transport1"),
+ kDefaultTimeout);
+}
+
TEST_F(SctpTransportTest, ClosesRemoteStream) {
SetupConnectedTransportsWithTwoStreams();
SignalTransportClosedObserver transport1_sig_receiver,
« no previous file with comments | « webrtc/media/sctp/sctptransport.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698