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

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel_unittest.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 new cricket::FakeTransportChannel(transport_->mid(), i); 92 new cricket::FakeTransportChannel(transport_->mid(), i);
93 fake_ice_channel->SetAsync(true); 93 fake_ice_channel->SetAsync(true);
94 fake_ice_channel->SetAsyncDelay(async_delay_ms); 94 fake_ice_channel->SetAsyncDelay(async_delay_ms);
95 // Hook the raw packets so that we can verify they are encrypted. 95 // Hook the raw packets so that we can verify they are encrypted.
96 fake_ice_channel->SignalReadPacket.connect( 96 fake_ice_channel->SignalReadPacket.connect(
97 this, &DtlsTestClient::OnFakeTransportChannelReadPacket); 97 this, &DtlsTestClient::OnFakeTransportChannelReadPacket);
98 98
99 cricket::DtlsTransportChannelWrapper* channel = 99 cricket::DtlsTransportChannelWrapper* channel =
100 new cricket::DtlsTransportChannelWrapper(fake_ice_channel); 100 new cricket::DtlsTransportChannelWrapper(fake_ice_channel);
101 channel->SetLocalCertificate(certificate_); 101 channel->SetLocalCertificate(certificate_);
102 channel->SetIceRole(role); 102 channel->ice_transport()->SetIceRole(role);
103 channel->SetIceTiebreaker((role == cricket::ICEROLE_CONTROLLING) ? 1 : 2); 103 channel->ice_transport()->SetIceTiebreaker(
104 (role == cricket::ICEROLE_CONTROLLING) ? 1 : 2);
104 channel->SetSslMaxProtocolVersion(ssl_max_version_); 105 channel->SetSslMaxProtocolVersion(ssl_max_version_);
105 channel->SignalWritableState.connect(this, 106 channel->SignalWritableState.connect(this,
106 &DtlsTestClient::OnTransportChannelWritableState); 107 &DtlsTestClient::OnTransportChannelWritableState);
107 channel->SignalReadPacket.connect(this, 108 channel->SignalReadPacket.connect(this,
108 &DtlsTestClient::OnTransportChannelReadPacket); 109 &DtlsTestClient::OnTransportChannelReadPacket);
109 channel->SignalSentPacket.connect( 110 channel->SignalSentPacket.connect(
110 this, &DtlsTestClient::OnTransportChannelSentPacket); 111 this, &DtlsTestClient::OnTransportChannelSentPacket);
111 channels_.push_back( 112 channels_.push_back(
112 std::unique_ptr<cricket::DtlsTransportChannelWrapper>(channel)); 113 std::unique_ptr<cricket::DtlsTransportChannelWrapper>(channel));
113 fake_channels_.push_back( 114 fake_channels_.push_back(
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return false; 225 return false;
225 } 226 }
226 for (const auto& channel : channels_) { 227 for (const auto& channel : channels_) {
227 if (!channel->writable()) { 228 if (!channel->writable()) {
228 return false; 229 return false;
229 } 230 }
230 } 231 }
231 return true; 232 return true;
232 } 233 }
233 234
234 bool all_raw_channels_writable() const { 235 bool all_raw_channels_writable() const {
Taylor Brandstetter 2017/01/03 23:21:59 nit: Since it now makes sense, can you rename this
Zhi Huang 2017/01/10 18:30:51 What about "all_ice_transport_writable", since the
Taylor Brandstetter 2017/01/10 19:43:47 Right, sounds good.
235 if (channels_.empty()) { 236 if (channels_.empty()) {
236 return false; 237 return false;
237 } 238 }
238 for (const auto& channel : channels_) { 239 for (const auto& channel : channels_) {
239 if (!channel->channel()->writable()) { 240 if (!channel->ice_transport()->writable()) {
240 return false; 241 return false;
241 } 242 }
242 } 243 }
243 return true; 244 return true;
244 } 245 }
245 246
246 int received_dtls_client_hellos() const { 247 int received_dtls_client_hellos() const {
247 return received_dtls_client_hellos_; 248 return received_dtls_client_hellos_;
248 } 249 }
249 250
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 std::vector<DtlsTransportEvent>{ 1184 std::vector<DtlsTransportEvent>{
1184 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT, 1185 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT,
1185 CALLER_WRITABLE, HANDSHAKE_FINISHES}, 1186 CALLER_WRITABLE, HANDSHAKE_FINISHES},
1186 std::vector<DtlsTransportEvent>{ 1187 std::vector<DtlsTransportEvent>{
1187 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE, 1188 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE,
1188 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES}, 1189 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES},
1189 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO, 1190 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO,
1190 CALLER_WRITABLE, HANDSHAKE_FINISHES, 1191 CALLER_WRITABLE, HANDSHAKE_FINISHES,
1191 CALLER_RECEIVES_FINGERPRINT}), 1192 CALLER_RECEIVES_FINGERPRINT}),
1192 ::testing::Bool())); 1193 ::testing::Bool()));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698