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

Unified Diff: webrtc/p2p/base/dtlstransportchannel_unittest.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Revert the change of stun_unittests Created 3 years, 11 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
Index: webrtc/p2p/base/dtlstransportchannel_unittest.cc
diff --git a/webrtc/p2p/base/dtlstransportchannel_unittest.cc b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
index 3efc1e7df9fddf23130d94be7a3ba363014bebe0..bc237d1e1abcbd258a8ac592f074d379539dddd5 100644
--- a/webrtc/p2p/base/dtlstransportchannel_unittest.cc
+++ b/webrtc/p2p/base/dtlstransportchannel_unittest.cc
@@ -88,8 +88,8 @@ class DtlsTestClient : public sigslot::has_slots<> {
transport_.reset(
new cricket::JsepTransport("dtls content name", certificate_));
for (int i = 0; i < count; ++i) {
- cricket::FakeTransportChannel* fake_ice_channel =
- new cricket::FakeTransportChannel(transport_->mid(), i);
+ cricket::FakeIceTransport* fake_ice_channel =
+ new cricket::FakeIceTransport(transport_->mid(), i);
fake_ice_channel->SetAsync(true);
fake_ice_channel->SetAsyncDelay(async_delay_ms);
// Hook the raw packets so that we can verify they are encrypted.
@@ -99,8 +99,9 @@ class DtlsTestClient : public sigslot::has_slots<> {
cricket::DtlsTransportChannelWrapper* channel =
new cricket::DtlsTransportChannelWrapper(fake_ice_channel);
channel->SetLocalCertificate(certificate_);
- channel->SetIceRole(role);
- channel->SetIceTiebreaker((role == cricket::ICEROLE_CONTROLLING) ? 1 : 2);
+ channel->ice_transport()->SetIceRole(role);
+ channel->ice_transport()->SetIceTiebreaker(
+ (role == cricket::ICEROLE_CONTROLLING) ? 1 : 2);
channel->SetSslMaxProtocolVersion(ssl_max_version_);
channel->SignalWritableState.connect(this,
&DtlsTestClient::OnTransportChannelWritableState);
@@ -111,14 +112,14 @@ class DtlsTestClient : public sigslot::has_slots<> {
channels_.push_back(
std::unique_ptr<cricket::DtlsTransportChannelWrapper>(channel));
fake_channels_.push_back(
- std::unique_ptr<cricket::FakeTransportChannel>(fake_ice_channel));
+ std::unique_ptr<cricket::FakeIceTransport>(fake_ice_channel));
transport_->AddChannel(channel, i);
}
}
cricket::JsepTransport* transport() { return transport_.get(); }
- cricket::FakeTransportChannel* GetFakeChannel(int component) {
+ cricket::FakeIceTransport* GetFakeChannel(int component) {
for (const auto& ch : fake_channels_) {
if (ch->component() == component) {
return ch.get();
@@ -231,12 +232,12 @@ class DtlsTestClient : public sigslot::has_slots<> {
return true;
}
- bool all_raw_channels_writable() const {
+ bool all_ice_transport_writable() const {
if (channels_.empty()) {
return false;
}
for (const auto& channel : channels_) {
- if (!channel->channel()->writable()) {
+ if (!channel->ice_transport()->writable()) {
return false;
}
}
@@ -434,7 +435,7 @@ class DtlsTestClient : public sigslot::has_slots<> {
private:
std::string name_;
rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
- std::vector<std::unique_ptr<cricket::FakeTransportChannel>> fake_channels_;
+ std::vector<std::unique_ptr<cricket::FakeIceTransport>> fake_channels_;
std::vector<std::unique_ptr<cricket::DtlsTransportChannelWrapper>> channels_;
std::unique_ptr<cricket::JsepTransport> transport_;
size_t packet_size_ = 0u;
@@ -639,8 +640,8 @@ class DtlsTransportChannelTest : public DtlsTransportChannelTestBase,
// Test that transport negotiation of ICE, no DTLS works properly.
TEST_F(DtlsTransportChannelTest, TestChannelSetupIce) {
Negotiate();
- cricket::FakeTransportChannel* channel1 = client1_.GetFakeChannel(0);
- cricket::FakeTransportChannel* channel2 = client2_.GetFakeChannel(0);
+ cricket::FakeIceTransport* channel1 = client1_.GetFakeChannel(0);
+ cricket::FakeIceTransport* channel2 = client2_.GetFakeChannel(0);
ASSERT_TRUE(channel1 != NULL);
ASSERT_TRUE(channel2 != NULL);
EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole());
@@ -993,12 +994,12 @@ TEST_F(DtlsTransportChannelTest, TestRetransmissionSchedule) {
// Make client2_ writable, but not client1_.
// This means client1_ will send DTLS client hellos but get no response.
EXPECT_TRUE(client2_.Connect(&client1_, true));
- EXPECT_TRUE_SIMULATED_WAIT(client2_.all_raw_channels_writable(), kTimeout,
+ EXPECT_TRUE_SIMULATED_WAIT(client2_.all_ice_transport_writable(), kTimeout,
fake_clock_);
// Wait for the first client hello to be sent.
EXPECT_EQ_WAIT(1, client1_.received_dtls_client_hellos(), kTimeout);
- EXPECT_FALSE(client1_.all_raw_channels_writable());
+ EXPECT_FALSE(client1_.all_ice_transport_writable());
static int timeout_schedule_ms[] = {50, 100, 200, 400, 800, 1600,
3200, 6400, 12800, 25600, 51200, 60000};
@@ -1103,7 +1104,7 @@ class DtlsEventOrderingTest
break;
case CALLER_WRITABLE:
EXPECT_TRUE(client1_.Connect(&client2_, true));
- EXPECT_TRUE_SIMULATED_WAIT(client1_.all_raw_channels_writable(),
+ EXPECT_TRUE_SIMULATED_WAIT(client1_.all_ice_transport_writable(),
kTimeout, fake_clock_);
break;
case CALLER_RECEIVES_CLIENTHELLO:
@@ -1111,7 +1112,7 @@ class DtlsEventOrderingTest
EXPECT_EQ(0, client1_.received_dtls_client_hellos());
// Making client2_ writable will cause it to send the ClientHello.
EXPECT_TRUE(client2_.Connect(&client1_, true));
- EXPECT_TRUE_SIMULATED_WAIT(client2_.all_raw_channels_writable(),
+ EXPECT_TRUE_SIMULATED_WAIT(client2_.all_ice_transport_writable(),
kTimeout, fake_clock_);
EXPECT_EQ_SIMULATED_WAIT(1, client1_.received_dtls_client_hellos(),
kTimeout, fake_clock_);

Powered by Google App Engine
This is Rietveld 408576698