OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 FakeDtlsTransport* GetFakeDtlsTransport_n(const std::string& transport_name, | 606 FakeDtlsTransport* GetFakeDtlsTransport_n(const std::string& transport_name, |
607 int component) { | 607 int component) { |
608 return static_cast<FakeDtlsTransport*>( | 608 return static_cast<FakeDtlsTransport*>( |
609 get_channel_for_testing(transport_name, component)); | 609 get_channel_for_testing(transport_name, component)); |
610 } | 610 } |
611 | 611 |
612 // Simulate the exchange of transport descriptions, and the gathering and | 612 // Simulate the exchange of transport descriptions, and the gathering and |
613 // exchange of ICE candidates. | 613 // exchange of ICE candidates. |
614 void Connect(FakeTransportController* dest) { | 614 void Connect(FakeTransportController* dest) { |
615 for (const std::string& transport_name : transport_names_for_testing()) { | 615 for (const std::string& transport_name : transport_names_for_testing()) { |
| 616 std::unique_ptr<rtc::SSLFingerprint> local_fingerprint; |
| 617 std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint; |
| 618 if (certificate_for_testing()) { |
| 619 local_fingerprint.reset(rtc::SSLFingerprint::CreateFromCertificate( |
| 620 certificate_for_testing())); |
| 621 } |
| 622 if (dest->certificate_for_testing()) { |
| 623 remote_fingerprint.reset(rtc::SSLFingerprint::CreateFromCertificate( |
| 624 dest->certificate_for_testing())); |
| 625 } |
616 TransportDescription local_desc( | 626 TransportDescription local_desc( |
617 std::vector<std::string>(), | 627 std::vector<std::string>(), |
618 rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH), | 628 rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH), |
619 rtc::CreateRandomString(cricket::ICE_PWD_LENGTH), | 629 rtc::CreateRandomString(cricket::ICE_PWD_LENGTH), |
620 cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE, | 630 cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE, |
621 certificate_for_testing() | 631 local_fingerprint.get()); |
622 ? rtc::SSLFingerprint::CreateFromCertificate( | |
623 certificate_for_testing()) | |
624 : nullptr); | |
625 TransportDescription remote_desc( | 632 TransportDescription remote_desc( |
626 std::vector<std::string>(), | 633 std::vector<std::string>(), |
627 rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH), | 634 rtc::CreateRandomString(cricket::ICE_UFRAG_LENGTH), |
628 rtc::CreateRandomString(cricket::ICE_PWD_LENGTH), | 635 rtc::CreateRandomString(cricket::ICE_PWD_LENGTH), |
629 cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE, | 636 cricket::ICEMODE_FULL, cricket::CONNECTIONROLE_NONE, |
630 dest->certificate_for_testing() | 637 remote_fingerprint.get()); |
631 ? rtc::SSLFingerprint::CreateFromCertificate( | |
632 dest->certificate_for_testing()) | |
633 : nullptr); | |
634 std::string err; | 638 std::string err; |
635 SetLocalTransportDescription(transport_name, local_desc, | 639 SetLocalTransportDescription(transport_name, local_desc, |
636 cricket::CA_OFFER, &err); | 640 cricket::CA_OFFER, &err); |
637 dest->SetRemoteTransportDescription(transport_name, local_desc, | 641 dest->SetRemoteTransportDescription(transport_name, local_desc, |
638 cricket::CA_OFFER, &err); | 642 cricket::CA_OFFER, &err); |
639 dest->SetLocalTransportDescription(transport_name, remote_desc, | 643 dest->SetLocalTransportDescription(transport_name, remote_desc, |
640 cricket::CA_ANSWER, &err); | 644 cricket::CA_ANSWER, &err); |
641 SetRemoteTransportDescription(transport_name, remote_desc, | 645 SetRemoteTransportDescription(transport_name, remote_desc, |
642 cricket::CA_ANSWER, &err); | 646 cricket::CA_ANSWER, &err); |
643 } | 647 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 bool asymmetric = false; | 697 bool asymmetric = false; |
694 local->SetDestination(remote, asymmetric); | 698 local->SetDestination(remote, asymmetric); |
695 } | 699 } |
696 } | 700 } |
697 } | 701 } |
698 }; | 702 }; |
699 | 703 |
700 } // namespace cricket | 704 } // namespace cricket |
701 | 705 |
702 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ | 706 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ |
OLD | NEW |