Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2017 The WebRTC Project Authors. All rights reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_P2P_BASE_FAKECANDIDATEPAIR_H_ | |
| 12 #define WEBRTC_P2P_BASE_FAKECANDIDATEPAIR_H_ | |
| 13 | |
| 14 #include <memory> | |
| 15 | |
| 16 #include "webrtc/p2p/base/candidate.h" | |
| 17 #include "webrtc/p2p/base/candidatepairinterface.h" | |
| 18 | |
| 19 namespace cricket { | |
| 20 | |
| 21 // Fake candidate pair class, which can be passed to BaseChannel for testing | |
| 22 // purposes. | |
| 23 class FakeCandidatePair : public CandidatePairInterface { | |
| 24 public: | |
| 25 FakeCandidatePair(const Candidate& local_candidate, | |
| 26 const Candidate& remote_candidate) | |
| 27 : local_candidate_(local_candidate), | |
| 28 remote_candidate_(remote_candidate) {} | |
| 29 const Candidate& local_candidate() const override { return local_candidate_; } | |
| 30 const Candidate& remote_candidate() const override { | |
| 31 return remote_candidate_; | |
| 32 } | |
| 33 | |
| 34 static std::unique_ptr<FakeCandidatePair> Create( | |
| 35 const rtc::SocketAddress& local_address, | |
| 36 int16_t local_network_id, | |
| 37 const rtc::SocketAddress& remote_address, | |
| 38 int16_t remote_network_id) { | |
| 39 Candidate local_candidate(0, "udp", local_address, 0u, "", "", "local", 0, | |
| 40 "foundation", local_network_id, 0); | |
| 41 Candidate remote_candidate(0, "udp", remote_address, 0u, "", "", "local", 0, | |
| 42 "foundation", remote_network_id, 0); | |
| 43 return std::unique_ptr<FakeCandidatePair>( | |
| 44 new FakeCandidatePair(local_candidate, remote_candidate)); | |
| 45 } | |
| 46 | |
| 47 private: | |
| 48 Candidate local_candidate_; | |
| 49 Candidate remote_candidate_; | |
| 50 }; | |
| 51 | |
| 52 } // namespace cricket | |
| 53 | |
| 54 #endif // WEBRTC_P2P_BASE_FAKECANDIDATEPAIR_H_ | |
|
Taylor Brandstetter
2017/01/24 02:00:05
Just moved from faketransportcontroller.h.
| |
| OLD | NEW |