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

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

Issue 1802013002: A bunch of interfaces: Return scoped_ptr<SSLCertificate> (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: less auto Created 4 years, 8 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
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 "video", &returned_certificate)); 296 "video", &returned_certificate));
297 EXPECT_EQ(certificate1->identity()->certificate().ToPEMString(), 297 EXPECT_EQ(certificate1->identity()->certificate().ToPEMString(),
298 returned_certificate->identity()->certificate().ToPEMString()); 298 returned_certificate->identity()->certificate().ToPEMString());
299 299
300 // Shouldn't be able to change the identity once set. 300 // Shouldn't be able to change the identity once set.
301 EXPECT_FALSE(transport_controller_->SetLocalCertificate(certificate2)); 301 EXPECT_FALSE(transport_controller_->SetLocalCertificate(certificate2));
302 } 302 }
303 303
304 TEST_F(TransportControllerTest, TestGetRemoteSSLCertificate) { 304 TEST_F(TransportControllerTest, TestGetRemoteSSLCertificate) {
305 rtc::FakeSSLCertificate fake_certificate("fake_data"); 305 rtc::FakeSSLCertificate fake_certificate("fake_data");
306 rtc::scoped_ptr<rtc::SSLCertificate> returned_certificate;
307 306
308 FakeTransportChannel* channel = CreateChannel("audio", 1); 307 FakeTransportChannel* channel = CreateChannel("audio", 1);
309 ASSERT_NE(nullptr, channel); 308 ASSERT_NE(nullptr, channel);
310 309
311 channel->SetRemoteSSLCertificate(&fake_certificate); 310 channel->SetRemoteSSLCertificate(&fake_certificate);
312 EXPECT_TRUE(transport_controller_->GetRemoteSSLCertificate( 311 rtc::scoped_ptr<rtc::SSLCertificate> returned_certificate =
313 "audio", returned_certificate.accept())); 312 transport_controller_->GetRemoteSSLCertificate("audio");
313 EXPECT_TRUE(returned_certificate);
314 EXPECT_EQ(fake_certificate.ToPEMString(), 314 EXPECT_EQ(fake_certificate.ToPEMString(),
315 returned_certificate->ToPEMString()); 315 returned_certificate->ToPEMString());
316 316
317 // Should fail if called for a nonexistant transport. 317 // Should fail if called for a nonexistant transport.
318 EXPECT_FALSE(transport_controller_->GetRemoteSSLCertificate( 318 EXPECT_FALSE(transport_controller_->GetRemoteSSLCertificate("video"));
319 "video", returned_certificate.accept()));
320 } 319 }
321 320
322 TEST_F(TransportControllerTest, TestSetLocalTransportDescription) { 321 TEST_F(TransportControllerTest, TestSetLocalTransportDescription) {
323 FakeTransportChannel* channel = CreateChannel("audio", 1); 322 FakeTransportChannel* channel = CreateChannel("audio", 1);
324 ASSERT_NE(nullptr, channel); 323 ASSERT_NE(nullptr, channel);
325 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1, 324 TransportDescription local_desc(std::vector<std::string>(), kIceUfrag1,
326 kIcePwd1, cricket::ICEMODE_FULL, 325 kIcePwd1, cricket::ICEMODE_FULL,
327 cricket::CONNECTIONROLE_ACTPASS, nullptr); 326 cricket::CONNECTIONROLE_ACTPASS, nullptr);
328 std::string err; 327 std::string err;
329 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription( 328 EXPECT_TRUE(transport_controller_->SetLocalTransportDescription(
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // new --> gathering --> complete 676 // new --> gathering --> complete
678 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); 677 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout);
679 EXPECT_EQ(2, gathering_state_signal_count_); 678 EXPECT_EQ(2, gathering_state_signal_count_);
680 679
681 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); 680 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout);
682 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); 681 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout);
683 EXPECT_EQ(2, candidates_signal_count_); 682 EXPECT_EQ(2, candidates_signal_count_);
684 683
685 EXPECT_TRUE(!signaled_on_non_signaling_thread_); 684 EXPECT_TRUE(!signaled_on_non_signaling_thread_);
686 } 685 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698