Index: remoting/test/fake_port_allocator.cc |
diff --git a/remoting/test/fake_port_allocator.cc b/remoting/test/fake_port_allocator.cc |
index 6fcc33fb17eb2b19e50fd0ea09bf41c5d74842ec..65d904714e40483a38d715e477706fc436a1e08d 100644 |
--- a/remoting/test/fake_port_allocator.cc |
+++ b/remoting/test/fake_port_allocator.cc |
@@ -5,6 +5,7 @@ |
#include "remoting/test/fake_port_allocator.h" |
#include "base/macros.h" |
+#include "remoting/protocol/transport_context.h" |
#include "remoting/test/fake_network_dispatcher.h" |
#include "remoting/test/fake_network_manager.h" |
#include "remoting/test/fake_socket_factory.h" |
@@ -14,73 +15,46 @@ namespace remoting { |
namespace { |
-class FakePortAllocatorSession : public protocol::PortAllocatorSessionBase { |
+class FakePortAllocatorSession : public cricket::BasicPortAllocatorSession { |
public: |
- FakePortAllocatorSession( |
- protocol::PortAllocatorBase* allocator, |
- const std::string& content_name, |
- int component, |
- const std::string& ice_username_fragment, |
- const std::string& ice_password, |
- const std::vector<rtc::SocketAddress>& stun_hosts, |
- const std::vector<std::string>& relay_hosts, |
- const std::string& relay); |
+ FakePortAllocatorSession(FakePortAllocator* allocator, |
+ const std::string& content_name, |
+ int component, |
+ const std::string& ice_username_fragment, |
+ const std::string& ice_password); |
~FakePortAllocatorSession() override; |
- // protocol::PortAllocatorBase overrides. |
- void ConfigReady(cricket::PortConfiguration* config) override; |
- void SendSessionRequest(const std::string& host) override; |
- |
private: |
DISALLOW_COPY_AND_ASSIGN(FakePortAllocatorSession); |
}; |
FakePortAllocatorSession::FakePortAllocatorSession( |
- protocol::PortAllocatorBase* allocator, |
+ FakePortAllocator* allocator, |
const std::string& content_name, |
int component, |
const std::string& ice_username_fragment, |
- const std::string& ice_password, |
- const std::vector<rtc::SocketAddress>& stun_hosts, |
- const std::vector<std::string>& relay_hosts, |
- const std::string& relay) |
- : PortAllocatorSessionBase(allocator, |
- content_name, |
- component, |
- ice_username_fragment, |
- ice_password, |
- stun_hosts, |
- relay_hosts, |
- relay) {} |
+ const std::string& ice_password) |
+ : BasicPortAllocatorSession(allocator, |
+ content_name, |
+ component, |
+ ice_username_fragment, |
+ ice_password) {} |
FakePortAllocatorSession::~FakePortAllocatorSession() {} |
-void FakePortAllocatorSession::ConfigReady( |
- cricket::PortConfiguration* config) { |
- // Filter out non-UDP relay ports, so that we don't try using TCP. |
- for (cricket::PortConfiguration::RelayList::iterator relay = |
- config->relays.begin(); relay != config->relays.end(); ++relay) { |
- cricket::PortList filtered_ports; |
- for (cricket::PortList::iterator port = |
- relay->ports.begin(); port != relay->ports.end(); ++port) { |
- if (port->proto == cricket::PROTO_UDP) { |
- filtered_ports.push_back(*port); |
- } |
- } |
- relay->ports = filtered_ports; |
- } |
- cricket::BasicPortAllocatorSession::ConfigReady(config); |
-} |
+} // namespace |
-void FakePortAllocatorSession::SendSessionRequest(const std::string& host) { |
- ReceiveSessionResponse(std::string()); |
+FakePortAllocator::FakePortAllocator( |
+ rtc::NetworkManager* network_manager, |
+ rtc::PacketSocketFactory* socket_factory) |
+ : BasicPortAllocator(network_manager, socket_factory) { |
+ set_flags(cricket::PORTALLOCATOR_DISABLE_TCP | |
+ cricket::PORTALLOCATOR_ENABLE_SHARED_UFRAG | |
+ cricket::PORTALLOCATOR_ENABLE_IPV6 | |
+ cricket::PORTALLOCATOR_DISABLE_STUN | |
+ cricket::PORTALLOCATOR_DISABLE_RELAY); |
} |
-} // namespace |
- |
-FakePortAllocator::FakePortAllocator(rtc::NetworkManager* network_manager, |
- FakePacketSocketFactory* socket_factory) |
- : PortAllocatorBase(network_manager, socket_factory) {} |
FakePortAllocator::~FakePortAllocator() {} |
cricket::PortAllocatorSession* FakePortAllocator::CreateSessionInternal( |
@@ -88,9 +62,8 @@ cricket::PortAllocatorSession* FakePortAllocator::CreateSessionInternal( |
int component, |
const std::string& ice_username_fragment, |
const std::string& ice_password) { |
- return new FakePortAllocatorSession( |
- this, content_name, component, ice_username_fragment, ice_password, |
- stun_hosts(), relay_hosts(), relay_token()); |
+ return new FakePortAllocatorSession(this, content_name, component, |
+ ice_username_fragment, ice_password); |
} |
FakePortAllocatorFactory::FakePortAllocatorFactory( |
@@ -102,8 +75,9 @@ FakePortAllocatorFactory::FakePortAllocatorFactory( |
FakePortAllocatorFactory::~FakePortAllocatorFactory() {} |
-scoped_ptr<protocol::PortAllocatorBase> |
-FakePortAllocatorFactory::CreatePortAllocator() { |
+scoped_ptr<cricket::PortAllocator> |
+FakePortAllocatorFactory::CreatePortAllocator( |
+ scoped_refptr<protocol::TransportContext> transport_context) { |
return make_scoped_ptr( |
new FakePortAllocator(network_manager_.get(), socket_factory_.get())); |
} |