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

Side by Side Diff: webrtc/p2p/base/faketransportcontroller.h

Issue 2166873002: Modified PeerConnection and WebRtcSession for end-to-end QuicDataChannel usage. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Change the comments and minor fix. Created 4 years, 4 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/media/base/mediaengine.h ('k') | webrtc/p2p/quic/quictransportchannel.h » ('j') | 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 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 11 matching lines...) Expand all
22 #include "webrtc/p2p/base/transportcontroller.h" 22 #include "webrtc/p2p/base/transportcontroller.h"
23 #include "webrtc/p2p/base/transportchannelimpl.h" 23 #include "webrtc/p2p/base/transportchannelimpl.h"
24 #include "webrtc/base/bind.h" 24 #include "webrtc/base/bind.h"
25 #include "webrtc/base/buffer.h" 25 #include "webrtc/base/buffer.h"
26 #include "webrtc/base/fakesslidentity.h" 26 #include "webrtc/base/fakesslidentity.h"
27 #include "webrtc/base/messagequeue.h" 27 #include "webrtc/base/messagequeue.h"
28 #include "webrtc/base/sigslot.h" 28 #include "webrtc/base/sigslot.h"
29 #include "webrtc/base/sslfingerprint.h" 29 #include "webrtc/base/sslfingerprint.h"
30 #include "webrtc/base/thread.h" 30 #include "webrtc/base/thread.h"
31 31
32 #ifdef HAVE_QUIC
33 #include "webrtc/p2p/quic/quictransport.h"
34 #endif
35
32 namespace cricket { 36 namespace cricket {
33 37
34 class FakeTransport; 38 class FakeTransport;
35 39
36 namespace { 40 namespace {
37 struct PacketMessageData : public rtc::MessageData { 41 struct PacketMessageData : public rtc::MessageData {
38 PacketMessageData(const char* data, size_t len) : packet(data, len) {} 42 PacketMessageData(const char* data, size_t len) : packet(data, len) {}
39 rtc::Buffer packet; 43 rtc::Buffer packet;
40 }; 44 };
41 } // namespace 45 } // namespace
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // This map just tracks the FakeTransportChannels created by this class. 450 // This map just tracks the FakeTransportChannels created by this class.
447 // It's mainly needed so that we can access a FakeTransportChannel directly, 451 // It's mainly needed so that we can access a FakeTransportChannel directly,
448 // even if wrapped by a DtlsTransportChannelWrapper. 452 // even if wrapped by a DtlsTransportChannelWrapper.
449 ChannelMap channels_; 453 ChannelMap channels_;
450 FakeTransport* dest_ = nullptr; 454 FakeTransport* dest_ = nullptr;
451 bool async_ = false; 455 bool async_ = false;
452 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; 456 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
453 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12; 457 rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
454 }; 458 };
455 459
460 #ifdef HAVE_QUIC
461 class FakeQuicTransport : public QuicTransport {
462 public:
463 FakeQuicTransport(const std::string& transport_name)
464 : QuicTransport(transport_name, nullptr, nullptr) {}
465
466 protected:
467 QuicTransportChannel* CreateTransportChannel(int component) override {
468 FakeTransportChannel* fake_ice_transport_channel =
469 new FakeTransportChannel(name(), component);
470 return new QuicTransportChannel(fake_ice_transport_channel);
471 }
472 };
473 #endif
474
456 // Fake candidate pair class, which can be passed to BaseChannel for testing 475 // Fake candidate pair class, which can be passed to BaseChannel for testing
457 // purposes. 476 // purposes.
458 class FakeCandidatePair : public CandidatePairInterface { 477 class FakeCandidatePair : public CandidatePairInterface {
459 public: 478 public:
460 FakeCandidatePair(const Candidate& local_candidate, 479 FakeCandidatePair(const Candidate& local_candidate,
461 const Candidate& remote_candidate) 480 const Candidate& remote_candidate)
462 : local_candidate_(local_candidate), 481 : local_candidate_(local_candidate),
463 remote_candidate_(remote_candidate) {} 482 remote_candidate_(remote_candidate) {}
464 const Candidate& local_candidate() const override { return local_candidate_; } 483 const Candidate& local_candidate() const override { return local_candidate_; }
465 const Candidate& remote_candidate() const override { 484 const Candidate& remote_candidate() const override {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 "foundation", remote_network_id, 0); 553 "foundation", remote_network_id, 0);
535 return new FakeCandidatePair(local_candidate, remote_candidate); 554 return new FakeCandidatePair(local_candidate, remote_candidate);
536 } 555 }
537 556
538 void set_fail_channel_creation(bool fail_channel_creation) { 557 void set_fail_channel_creation(bool fail_channel_creation) {
539 fail_create_channel_ = fail_channel_creation; 558 fail_create_channel_ = fail_channel_creation;
540 } 559 }
541 560
542 protected: 561 protected:
543 Transport* CreateTransport_n(const std::string& transport_name) override { 562 Transport* CreateTransport_n(const std::string& transport_name) override {
563 #ifdef HAVE_QUIC
564 if (quic()) {
565 return new FakeQuicTransport(transport_name);
566 }
567 #endif
544 return new FakeTransport(transport_name); 568 return new FakeTransport(transport_name);
545 } 569 }
546 570
547 void Connect_n(FakeTransportController* dest) { 571 void Connect_n(FakeTransportController* dest) {
548 // Simulate the exchange of candidates. 572 // Simulate the exchange of candidates.
549 ConnectChannels_n(); 573 ConnectChannels_n();
550 dest->ConnectChannels_n(); 574 dest->ConnectChannels_n();
551 for (auto& kv : transports()) { 575 for (auto& kv : transports()) {
552 FakeTransport* transport = static_cast<FakeTransport*>(kv.second); 576 FakeTransport* transport = static_cast<FakeTransport*>(kv.second);
553 transport->SetDestination(dest->GetTransport_n(kv.first)); 577 transport->SetDestination(dest->GetTransport_n(kv.first));
(...skipping 18 matching lines...) Expand all
572 } 596 }
573 } 597 }
574 598
575 private: 599 private:
576 bool fail_create_channel_; 600 bool fail_create_channel_;
577 }; 601 };
578 602
579 } // namespace cricket 603 } // namespace cricket
580 604
581 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_ 605 #endif // WEBRTC_P2P_BASE_FAKETRANSPORTCONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/media/base/mediaengine.h ('k') | webrtc/p2p/quic/quictransportchannel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698