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

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

Issue 2517883002: Refactoring that removes P2PTransport and DtlsTransport classes. (Closed)
Patch Set: Leaving comments about what we'd need to do to support QUIC again. Created 4 years, 1 month 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
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 13
14 #include "webrtc/p2p/base/dtlstransport.h" 14 #include "webrtc/p2p/base/dtlstransportchannel.h"
15 #include "webrtc/p2p/base/faketransportcontroller.h" 15 #include "webrtc/p2p/base/faketransportcontroller.h"
16 #include "webrtc/p2p/base/packettransportinterface.h" 16 #include "webrtc/p2p/base/packettransportinterface.h"
17 #include "webrtc/base/common.h" 17 #include "webrtc/base/common.h"
18 #include "webrtc/base/dscp.h" 18 #include "webrtc/base/dscp.h"
19 #include "webrtc/base/gunit.h" 19 #include "webrtc/base/gunit.h"
20 #include "webrtc/base/helpers.h" 20 #include "webrtc/base/helpers.h"
21 #include "webrtc/base/ssladapter.h" 21 #include "webrtc/base/ssladapter.h"
22 #include "webrtc/base/sslidentity.h" 22 #include "webrtc/base/sslidentity.h"
23 #include "webrtc/base/sslstreamadapter.h" 23 #include "webrtc/base/sslstreamadapter.h"
24 #include "webrtc/base/stringutils.h" 24 #include "webrtc/base/stringutils.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 rtc::SSLIdentity::Generate(name_, key_type))); 72 rtc::SSLIdentity::Generate(name_, key_type)));
73 } 73 }
74 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() { 74 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate() {
75 return certificate_; 75 return certificate_;
76 } 76 }
77 void SetupSrtp() { 77 void SetupSrtp() {
78 ASSERT(certificate_); 78 ASSERT(certificate_);
79 use_dtls_srtp_ = true; 79 use_dtls_srtp_ = true;
80 } 80 }
81 void SetupMaxProtocolVersion(rtc::SSLProtocolVersion version) { 81 void SetupMaxProtocolVersion(rtc::SSLProtocolVersion version) {
82 ASSERT(!transport_);
83 ssl_max_version_ = version; 82 ssl_max_version_ = version;
84 } 83 }
85 void SetupChannels(int count, cricket::IceRole role, int async_delay_ms = 0) { 84 void SetupChannels(int count, cricket::IceRole role, int async_delay_ms = 0) {
86 transport_.reset(new cricket::DtlsTransport<cricket::FakeTransport>( 85 transport_.reset(new cricket::Transport("dtls content name", certificate_));
87 "dtls content name", nullptr, certificate_)); 86 for (int i = 0; i < count; ++i) {
88 transport_->SetAsync(true); 87 cricket::FakeTransportChannel* fake_ice_channel =
89 transport_->SetAsyncDelay(async_delay_ms); 88 new cricket::FakeTransportChannel(transport_->name(), i);
90 transport_->SetIceRole(role); 89 fake_ice_channel->SetAsync(true);
91 transport_->SetIceTiebreaker( 90 fake_ice_channel->SetAsyncDelay(async_delay_ms);
92 (role == cricket::ICEROLE_CONTROLLING) ? 1 : 2); 91 // Hook the raw packets so that we can verify they are encrypted.
92 fake_ice_channel->SignalReadPacket.connect(
93 this, &DtlsTestClient::OnFakeTransportChannelReadPacket);
93 94
94 for (int i = 0; i < count; ++i) {
95 cricket::DtlsTransportChannelWrapper* channel = 95 cricket::DtlsTransportChannelWrapper* channel =
96 static_cast<cricket::DtlsTransportChannelWrapper*>( 96 new cricket::DtlsTransportChannelWrapper(fake_ice_channel);
97 transport_->CreateChannel(i)); 97 channel->SetLocalCertificate(certificate_);
98 ASSERT_TRUE(channel != NULL); 98 channel->SetIceRole(role);
99 channel->SetIceTiebreaker((role == cricket::ICEROLE_CONTROLLING) ? 1 : 2);
99 channel->SetSslMaxProtocolVersion(ssl_max_version_); 100 channel->SetSslMaxProtocolVersion(ssl_max_version_);
100 channel->SignalWritableState.connect(this, 101 channel->SignalWritableState.connect(this,
101 &DtlsTestClient::OnTransportChannelWritableState); 102 &DtlsTestClient::OnTransportChannelWritableState);
102 channel->SignalReadPacket.connect(this, 103 channel->SignalReadPacket.connect(this,
103 &DtlsTestClient::OnTransportChannelReadPacket); 104 &DtlsTestClient::OnTransportChannelReadPacket);
104 channel->SignalSentPacket.connect( 105 channel->SignalSentPacket.connect(
105 this, &DtlsTestClient::OnTransportChannelSentPacket); 106 this, &DtlsTestClient::OnTransportChannelSentPacket);
106 channels_.push_back(channel); 107 channels_.push_back(
107 108 std::unique_ptr<cricket::DtlsTransportChannelWrapper>(channel));
108 // Hook the raw packets so that we can verify they are encrypted. 109 fake_channels_.push_back(
109 channel->channel()->SignalReadPacket.connect( 110 std::unique_ptr<cricket::FakeTransportChannel>(fake_ice_channel));
110 this, &DtlsTestClient::OnFakeTransportChannelReadPacket); 111 transport_->AddChannel(channel, fake_ice_channel, i);
111 } 112 }
112 } 113 }
113 114
114 cricket::Transport* transport() { return transport_.get(); } 115 cricket::Transport* transport() { return transport_.get(); }
115 116
116 cricket::FakeTransportChannel* GetFakeChannel(int component) { 117 cricket::FakeTransportChannel* GetFakeChannel(int component) {
117 cricket::TransportChannelImpl* ch = transport_->GetChannel(component); 118 for (const auto& ch : fake_channels_) {
118 cricket::DtlsTransportChannelWrapper* wrapper = 119 if (ch->component() == component) {
119 static_cast<cricket::DtlsTransportChannelWrapper*>(ch); 120 return ch.get();
120 return (wrapper) ? 121 }
121 static_cast<cricket::FakeTransportChannel*>(wrapper->channel()) : NULL; 122 }
123 return nullptr;
122 } 124 }
123 125
124 cricket::DtlsTransportChannelWrapper* GetDtlsChannel(int component) { 126 cricket::DtlsTransportChannelWrapper* GetDtlsChannel(int component) {
125 cricket::TransportChannelImpl* ch = transport_->GetChannel(component); 127 for (const auto& ch : channels_) {
126 return static_cast<cricket::DtlsTransportChannelWrapper*>(ch); 128 if (ch->component() == component) {
129 return ch.get();
130 }
131 }
132 return nullptr;
127 } 133 }
128 134
129 // Offer DTLS if we have an identity; pass in a remote fingerprint only if 135 // Offer DTLS if we have an identity; pass in a remote fingerprint only if
130 // both sides support DTLS. 136 // both sides support DTLS.
131 void Negotiate(DtlsTestClient* peer, cricket::ContentAction action, 137 void Negotiate(DtlsTestClient* peer, cricket::ContentAction action,
132 ConnectionRole local_role, ConnectionRole remote_role, 138 ConnectionRole local_role, ConnectionRole remote_role,
133 int flags) { 139 int flags) {
134 Negotiate(certificate_, certificate_ ? peer->certificate_ : nullptr, action, 140 Negotiate(certificate_, certificate_ ? peer->certificate_ : nullptr, action,
135 local_role, remote_role, flags); 141 local_role, remote_role, flags);
136 } 142 }
137 143
138 void MaybeSetSrtpCryptoSuites() { 144 void MaybeSetSrtpCryptoSuites() {
139 if (!use_dtls_srtp_) { 145 if (!use_dtls_srtp_) {
140 return; 146 return;
141 } 147 }
142 std::vector<int> ciphers; 148 std::vector<int> ciphers;
143 ciphers.push_back(rtc::SRTP_AES128_CM_SHA1_80); 149 ciphers.push_back(rtc::SRTP_AES128_CM_SHA1_80);
144 // SRTP ciphers will be set only in the beginning. 150 // SRTP ciphers will be set only in the beginning.
145 for (cricket::DtlsTransportChannelWrapper* channel : channels_) { 151 for (const auto& channel : channels_) {
146 EXPECT_TRUE(channel->SetSrtpCryptoSuites(ciphers)); 152 EXPECT_TRUE(channel->SetSrtpCryptoSuites(ciphers));
147 } 153 }
148 } 154 }
149 155
150 void SetLocalTransportDescription( 156 void SetLocalTransportDescription(
151 const rtc::scoped_refptr<rtc::RTCCertificate>& cert, 157 const rtc::scoped_refptr<rtc::RTCCertificate>& cert,
152 cricket::ContentAction action, 158 cricket::ContentAction action,
153 ConnectionRole role, 159 ConnectionRole role,
154 int flags) { 160 int flags) {
155 // If |NF_EXPECT_FAILURE| is set, expect SRTD or SLTD to fail when 161 // If |NF_EXPECT_FAILURE| is set, expect SRTD or SLTD to fail when
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 SetRemoteTransportDescription(remote_cert, cricket::CA_OFFER, remote_role, 201 SetRemoteTransportDescription(remote_cert, cricket::CA_OFFER, remote_role,
196 flags); 202 flags);
197 // If remote if the offerer and has no DTLS support, answer will be 203 // If remote if the offerer and has no DTLS support, answer will be
198 // without any fingerprint. 204 // without any fingerprint.
199 SetLocalTransportDescription(remote_cert ? local_cert : nullptr, 205 SetLocalTransportDescription(remote_cert ? local_cert : nullptr,
200 cricket::CA_ANSWER, local_role, flags); 206 cricket::CA_ANSWER, local_role, flags);
201 } 207 }
202 } 208 }
203 209
204 bool Connect(DtlsTestClient* peer, bool asymmetric) { 210 bool Connect(DtlsTestClient* peer, bool asymmetric) {
205 transport_->SetDestination(peer->transport_.get(), asymmetric); 211 for (auto& channel : fake_channels_) {
212 channel->SetDestination(peer->GetFakeChannel(channel->component()),
213 asymmetric);
214 }
206 return true; 215 return true;
207 } 216 }
208 217
209 bool all_channels_writable() const { 218 bool all_channels_writable() const {
210 if (channels_.empty()) { 219 if (channels_.empty()) {
211 return false; 220 return false;
212 } 221 }
213 for (cricket::DtlsTransportChannelWrapper* channel : channels_) { 222 for (const auto& channel : channels_) {
214 if (!channel->writable()) { 223 if (!channel->writable()) {
215 return false; 224 return false;
216 } 225 }
217 } 226 }
218 return true; 227 return true;
219 } 228 }
220 229
221 bool all_raw_channels_writable() const { 230 bool all_raw_channels_writable() const {
222 if (channels_.empty()) { 231 if (channels_.empty()) {
223 return false; 232 return false;
224 } 233 }
225 for (cricket::DtlsTransportChannelWrapper* channel : channels_) { 234 for (const auto& channel : channels_) {
226 if (!channel->channel()->writable()) { 235 if (!channel->channel()->writable()) {
227 return false; 236 return false;
228 } 237 }
229 } 238 }
230 return true; 239 return true;
231 } 240 }
232 241
233 int received_dtls_client_hellos() const { 242 int received_dtls_client_hellos() const {
234 return received_dtls_client_hellos_; 243 return received_dtls_client_hellos_;
235 } 244 }
(...skipping 13 matching lines...) Expand all
249 if (role == rtc::SSL_CLIENT) { 258 if (role == rtc::SSL_CLIENT) {
250 ASSERT_EQ(0, received_dtls_client_hellos_); 259 ASSERT_EQ(0, received_dtls_client_hellos_);
251 ASSERT_GT(received_dtls_server_hellos_, 0); 260 ASSERT_GT(received_dtls_server_hellos_, 0);
252 } else { 261 } else {
253 ASSERT_GT(received_dtls_client_hellos_, 0); 262 ASSERT_GT(received_dtls_client_hellos_, 0);
254 ASSERT_EQ(0, received_dtls_server_hellos_); 263 ASSERT_EQ(0, received_dtls_server_hellos_);
255 } 264 }
256 } 265 }
257 266
258 void CheckSrtp(int expected_crypto_suite) { 267 void CheckSrtp(int expected_crypto_suite) {
259 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = 268 for (const auto& channel : channels_) {
260 channels_.begin(); it != channels_.end(); ++it) {
261 int crypto_suite; 269 int crypto_suite;
262 270
263 bool rv = (*it)->GetSrtpCryptoSuite(&crypto_suite); 271 bool rv = channel->GetSrtpCryptoSuite(&crypto_suite);
264 if (negotiated_dtls() && expected_crypto_suite) { 272 if (negotiated_dtls() && expected_crypto_suite) {
265 ASSERT_TRUE(rv); 273 ASSERT_TRUE(rv);
266 274
267 ASSERT_EQ(crypto_suite, expected_crypto_suite); 275 ASSERT_EQ(crypto_suite, expected_crypto_suite);
268 } else { 276 } else {
269 ASSERT_FALSE(rv); 277 ASSERT_FALSE(rv);
270 } 278 }
271 } 279 }
272 } 280 }
273 281
274 void CheckSsl() { 282 void CheckSsl() {
275 for (std::vector<cricket::DtlsTransportChannelWrapper*>::iterator it = 283 for (const auto& channel : channels_) {
276 channels_.begin(); it != channels_.end(); ++it) {
277 int cipher; 284 int cipher;
278 285
279 bool rv = (*it)->GetSslCipherSuite(&cipher); 286 bool rv = channel->GetSslCipherSuite(&cipher);
280 if (negotiated_dtls()) { 287 if (negotiated_dtls()) {
281 ASSERT_TRUE(rv); 288 ASSERT_TRUE(rv);
282 289
283 EXPECT_TRUE( 290 EXPECT_TRUE(
284 rtc::SSLStreamAdapter::IsAcceptableCipher(cipher, rtc::KT_DEFAULT)); 291 rtc::SSLStreamAdapter::IsAcceptableCipher(cipher, rtc::KT_DEFAULT));
285 } else { 292 } else {
286 ASSERT_FALSE(rv); 293 ASSERT_FALSE(rv);
287 } 294 }
288 } 295 }
289 } 296 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 ASSERT_TRUE(VerifyEncryptedPacket(data, size)); 423 ASSERT_TRUE(VerifyEncryptedPacket(data, size));
417 } else if (IsRtpLeadByte(data[0])) { 424 } else if (IsRtpLeadByte(data[0])) {
418 ASSERT_TRUE(VerifyPacket(data, size, NULL)); 425 ASSERT_TRUE(VerifyPacket(data, size, NULL));
419 } 426 }
420 } 427 }
421 } 428 }
422 429
423 private: 430 private:
424 std::string name_; 431 std::string name_;
425 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; 432 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
426 std::unique_ptr<cricket::FakeTransport> transport_; 433 std::vector<std::unique_ptr<cricket::FakeTransportChannel>> fake_channels_;
427 std::vector<cricket::DtlsTransportChannelWrapper*> channels_; 434 std::vector<std::unique_ptr<cricket::DtlsTransportChannelWrapper>> channels_;
435 std::unique_ptr<cricket::Transport> transport_;
428 size_t packet_size_ = 0u; 436 size_t packet_size_ = 0u;
429 std::set<int> received_; 437 std::set<int> received_;
430 bool use_dtls_srtp_ = false; 438 bool use_dtls_srtp_ = false;
431 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12; 439 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
432 int received_dtls_client_hellos_ = 0; 440 int received_dtls_client_hellos_ = 0;
433 int received_dtls_server_hellos_ = 0; 441 int received_dtls_server_hellos_ = 0;
434 rtc::SentPacket sent_packet_; 442 rtc::SentPacket sent_packet_;
435 }; 443 };
436 444
437 // Base class for DtlsTransportChannelTest and DtlsEventOrderingTest, which 445 // Base class for DtlsTransportChannelTest and DtlsEventOrderingTest, which
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 } 822 }
815 823
816 // Testing with the legacy DTLS client which doesn't use setup attribute. 824 // Testing with the legacy DTLS client which doesn't use setup attribute.
817 // In this case legacy is the answerer. 825 // In this case legacy is the answerer.
818 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) { 826 TEST_F(DtlsTransportChannelTest, TestDtlsSetupWithLegacyAsAnswerer) {
819 MAYBE_SKIP_TEST(HaveDtlsSrtp); 827 MAYBE_SKIP_TEST(HaveDtlsSrtp);
820 PrepareDtls(true, true, rtc::KT_DEFAULT); 828 PrepareDtls(true, true, rtc::KT_DEFAULT);
821 NegotiateWithLegacy(); 829 NegotiateWithLegacy();
822 rtc::SSLRole channel1_role; 830 rtc::SSLRole channel1_role;
823 rtc::SSLRole channel2_role; 831 rtc::SSLRole channel2_role;
824 EXPECT_TRUE(client1_.transport()->GetSslRole(&channel1_role)); 832 client1_.transport()->GetSslRole(&channel1_role);
825 EXPECT_TRUE(client2_.transport()->GetSslRole(&channel2_role)); 833 client2_.transport()->GetSslRole(&channel2_role);
826 EXPECT_EQ(rtc::SSL_SERVER, channel1_role); 834 EXPECT_EQ(rtc::SSL_SERVER, channel1_role);
827 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role); 835 EXPECT_EQ(rtc::SSL_CLIENT, channel2_role);
828 } 836 }
829 837
830 // Testing re offer/answer after the session is estbalished. Roles will be 838 // Testing re offer/answer after the session is estbalished. Roles will be
831 // kept same as of the previous negotiation. 839 // kept same as of the previous negotiation.
832 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) { 840 TEST_F(DtlsTransportChannelTest, TestDtlsReOfferFromOfferer) {
833 MAYBE_SKIP_TEST(HaveDtlsSrtp); 841 MAYBE_SKIP_TEST(HaveDtlsSrtp);
834 SetChannelCount(2); 842 SetChannelCount(2);
835 PrepareDtls(true, true, rtc::KT_DEFAULT); 843 PrepareDtls(true, true, rtc::KT_DEFAULT);
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; 933 rtc::scoped_refptr<rtc::RTCCertificate> certificate2;
926 std::unique_ptr<rtc::SSLCertificate> remote_cert1; 934 std::unique_ptr<rtc::SSLCertificate> remote_cert1;
927 std::unique_ptr<rtc::SSLCertificate> remote_cert2; 935 std::unique_ptr<rtc::SSLCertificate> remote_cert2;
928 936
929 // After negotiation, each side has a distinct local certificate, but still no 937 // After negotiation, each side has a distinct local certificate, but still no
930 // remote certificate, because connection has not yet occurred. 938 // remote certificate, because connection has not yet occurred.
931 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); 939 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1));
932 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); 940 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2));
933 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), 941 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(),
934 certificate2->ssl_certificate().ToPEMString()); 942 certificate2->ssl_certificate().ToPEMString());
935 ASSERT_FALSE(client1_.transport()->GetRemoteSSLCertificate()); 943 ASSERT_FALSE(client1_.GetDtlsChannel(0)->GetRemoteSSLCertificate());
936 ASSERT_FALSE(client2_.transport()->GetRemoteSSLCertificate()); 944 ASSERT_FALSE(client2_.GetDtlsChannel(0)->GetRemoteSSLCertificate());
937 } 945 }
938 946
939 // Test Certificates state after connection. 947 // Test Certificates state after connection.
940 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) { 948 TEST_F(DtlsTransportChannelTest, TestCertificatesAfterConnect) {
941 MAYBE_SKIP_TEST(HaveDtls); 949 MAYBE_SKIP_TEST(HaveDtls);
942 PrepareDtls(true, true, rtc::KT_DEFAULT); 950 PrepareDtls(true, true, rtc::KT_DEFAULT);
943 ASSERT_TRUE(Connect()); 951 ASSERT_TRUE(Connect());
944 952
945 rtc::scoped_refptr<rtc::RTCCertificate> certificate1; 953 rtc::scoped_refptr<rtc::RTCCertificate> certificate1;
946 rtc::scoped_refptr<rtc::RTCCertificate> certificate2; 954 rtc::scoped_refptr<rtc::RTCCertificate> certificate2;
947 955
948 // After connection, each side has a distinct local certificate. 956 // After connection, each side has a distinct local certificate.
949 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1)); 957 ASSERT_TRUE(client1_.transport()->GetLocalCertificate(&certificate1));
950 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2)); 958 ASSERT_TRUE(client2_.transport()->GetLocalCertificate(&certificate2));
951 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(), 959 ASSERT_NE(certificate1->ssl_certificate().ToPEMString(),
952 certificate2->ssl_certificate().ToPEMString()); 960 certificate2->ssl_certificate().ToPEMString());
953 961
954 // Each side's remote certificate is the other side's local certificate. 962 // Each side's remote certificate is the other side's local certificate.
955 std::unique_ptr<rtc::SSLCertificate> remote_cert1 = 963 std::unique_ptr<rtc::SSLCertificate> remote_cert1 =
956 client1_.transport()->GetRemoteSSLCertificate(); 964 client1_.GetDtlsChannel(0)->GetRemoteSSLCertificate();
957 ASSERT_TRUE(remote_cert1); 965 ASSERT_TRUE(remote_cert1);
958 ASSERT_EQ(remote_cert1->ToPEMString(), 966 ASSERT_EQ(remote_cert1->ToPEMString(),
959 certificate2->ssl_certificate().ToPEMString()); 967 certificate2->ssl_certificate().ToPEMString());
960 std::unique_ptr<rtc::SSLCertificate> remote_cert2 = 968 std::unique_ptr<rtc::SSLCertificate> remote_cert2 =
961 client2_.transport()->GetRemoteSSLCertificate(); 969 client2_.GetDtlsChannel(0)->GetRemoteSSLCertificate();
962 ASSERT_TRUE(remote_cert2); 970 ASSERT_TRUE(remote_cert2);
963 ASSERT_EQ(remote_cert2->ToPEMString(), 971 ASSERT_EQ(remote_cert2->ToPEMString(),
964 certificate1->ssl_certificate().ToPEMString()); 972 certificate1->ssl_certificate().ToPEMString());
965 } 973 }
966 974
967 // Test that packets are retransmitted according to the expected schedule. 975 // Test that packets are retransmitted according to the expected schedule.
968 // Each time a timeout occurs, the retransmission timer should be doubled up to 976 // Each time a timeout occurs, the retransmission timer should be doubled up to
969 // 60 seconds. The timer defaults to 1 second, but for WebRTC we should be 977 // 60 seconds. The timer defaults to 1 second, but for WebRTC we should be
970 // initializing it to 50ms. 978 // initializing it to 50ms.
971 TEST_F(DtlsTransportChannelTest, TestRetransmissionSchedule) { 979 TEST_F(DtlsTransportChannelTest, TestRetransmissionSchedule) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 std::vector<DtlsTransportEvent>{ 1179 std::vector<DtlsTransportEvent>{
1172 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT, 1180 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT,
1173 CALLER_WRITABLE, HANDSHAKE_FINISHES}, 1181 CALLER_WRITABLE, HANDSHAKE_FINISHES},
1174 std::vector<DtlsTransportEvent>{ 1182 std::vector<DtlsTransportEvent>{
1175 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE, 1183 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE,
1176 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES}, 1184 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES},
1177 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO, 1185 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO,
1178 CALLER_WRITABLE, HANDSHAKE_FINISHES, 1186 CALLER_WRITABLE, HANDSHAKE_FINISHES,
1179 CALLER_RECEIVES_FINGERPRINT}), 1187 CALLER_RECEIVES_FINGERPRINT}),
1180 ::testing::Bool())); 1188 ::testing::Bool()));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698