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

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

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

Powered by Google App Engine
This is Rietveld 408576698