Index: webrtc/p2p/base/faketransportcontroller.h |
diff --git a/webrtc/p2p/base/faketransportcontroller.h b/webrtc/p2p/base/faketransportcontroller.h |
index b8c67ecd17aacaab29e459ed264ed6afb3508b54..9cec2cd47d37afa1c9a82fab52e00c135bd63892 100644 |
--- a/webrtc/p2p/base/faketransportcontroller.h |
+++ b/webrtc/p2p/base/faketransportcontroller.h |
@@ -29,6 +29,10 @@ |
#include "webrtc/base/sslfingerprint.h" |
#include "webrtc/base/thread.h" |
+#ifdef HAVE_QUIC |
+#include "webrtc/p2p/quic/quictransport.h" |
+#endif |
+ |
namespace cricket { |
class FakeTransport; |
@@ -453,6 +457,26 @@ class FakeTransport : public Transport { |
rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12; |
}; |
+#ifdef HAVE_QUIC |
+class FakeQuicTransport : public QuicTransport { |
+ public: |
+ FakeQuicTransport(const std::string& transport_name, |
+ FakeTransportChannel* fake_ice_transport_channel) |
+ : QuicTransport(transport_name, nullptr, nullptr), |
+ fake_ice_transport_channel_(fake_ice_transport_channel) {} |
+ |
+ protected: |
+ QuicTransportChannel* CreateTransportChannel(int component) override { |
+ LOG(INFO) << "creating quic transport channel:" |
+ << fake_ice_transport_channel_; |
+ return new QuicTransportChannel(fake_ice_transport_channel_); |
+ } |
+ |
+ private: |
+ FakeTransportChannel* fake_ice_transport_channel_; |
+}; |
+#endif |
+ |
// Fake candidate pair class, which can be passed to BaseChannel for testing |
// purposes. |
class FakeCandidatePair : public CandidatePairInterface { |
@@ -503,6 +527,14 @@ class FakeTransportController : public TransportController { |
SetIceRole(role); |
} |
+ FakeTransportController(const std::string& transport_name) |
+ : TransportController(rtc::Thread::Current(), |
+ rtc::Thread::Current(), |
+ nullptr), |
+ fail_create_channel_(false), |
+ fake_ice_transport_channel_( |
+ new FakeTransportChannel(transport_name, 1)) {} |
+ |
FakeTransport* GetTransport_n(const std::string& transport_name) { |
return static_cast<FakeTransport*>( |
TransportController::GetTransport_n(transport_name)); |
@@ -539,8 +571,18 @@ class FakeTransportController : public TransportController { |
fail_create_channel_ = fail_channel_creation; |
} |
+ FakeTransportChannel* fake_ice_transport_channel() { |
+ return fake_ice_transport_channel_; |
+ } |
+ |
protected: |
Transport* CreateTransport_n(const std::string& transport_name) override { |
+#ifdef HAVE_QUIC |
+ if (quic()) { |
+ LOG(INFO) << "creating quic transport."; |
+ return new FakeQuicTransport(transport_name, fake_ice_transport_channel_); |
+ } |
+#endif |
return new FakeTransport(transport_name); |
} |
@@ -574,6 +616,7 @@ class FakeTransportController : public TransportController { |
private: |
bool fail_create_channel_; |
+ FakeTransportChannel* fake_ice_transport_channel_; |
Taylor Brandstetter
2016/08/01 18:05:03
I don't think having the FakeTransportController o
Zhi Huang
2016/08/01 23:56:22
This is a good point!
I like the idea to expose th
|
}; |
} // namespace cricket |