| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ | 5 #ifndef REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ |
| 6 #define REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ | 6 #define REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "remoting/protocol/port_allocator_base.h" | |
| 14 #include "remoting/protocol/port_allocator_factory.h" | 13 #include "remoting/protocol/port_allocator_factory.h" |
| 15 | 14 #include "third_party/webrtc/p2p/client/basicportallocator.h" |
| 16 namespace rtc { | |
| 17 class NetworkManager; | |
| 18 } // namespace rtc | |
| 19 | 15 |
| 20 namespace remoting { | 16 namespace remoting { |
| 21 | 17 |
| 22 class FakeNetworkDispatcher; | 18 class FakeNetworkDispatcher; |
| 23 class FakePacketSocketFactory; | 19 class FakePacketSocketFactory; |
| 24 | 20 |
| 25 class FakePortAllocator : public protocol::PortAllocatorBase { | 21 class FakePortAllocator : public cricket::BasicPortAllocator { |
| 26 public: | 22 public: |
| 27 FakePortAllocator(rtc::NetworkManager* network_manager, | 23 FakePortAllocator(rtc::NetworkManager* network_manager, |
| 28 FakePacketSocketFactory* socket_factory); | 24 rtc::PacketSocketFactory* socket_factory); |
| 29 ~FakePortAllocator() override; | 25 ~FakePortAllocator() override; |
| 30 | 26 |
| 31 // cricket::BasicPortAllocator overrides. | 27 // cricket::BasicPortAllocator overrides. |
| 32 cricket::PortAllocatorSession* CreateSessionInternal( | 28 cricket::PortAllocatorSession* CreateSessionInternal( |
| 33 const std::string& content_name, | 29 const std::string& content_name, |
| 34 int component, | 30 int component, |
| 35 const std::string& ice_username_fragment, | 31 const std::string& ice_username_fragment, |
| 36 const std::string& ice_password) override; | 32 const std::string& ice_password) override; |
| 37 | 33 |
| 38 private: | 34 private: |
| 39 DISALLOW_COPY_AND_ASSIGN(FakePortAllocator); | 35 DISALLOW_COPY_AND_ASSIGN(FakePortAllocator); |
| 40 }; | 36 }; |
| 41 | 37 |
| 42 class FakePortAllocatorFactory : public protocol::PortAllocatorFactory { | 38 class FakePortAllocatorFactory : public protocol::PortAllocatorFactory { |
| 43 public: | 39 public: |
| 44 FakePortAllocatorFactory( | 40 FakePortAllocatorFactory( |
| 45 scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher); | 41 scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher); |
| 46 ~FakePortAllocatorFactory() override; | 42 ~FakePortAllocatorFactory() override; |
| 47 | 43 |
| 48 FakePacketSocketFactory* socket_factory() { return socket_factory_.get(); } | 44 FakePacketSocketFactory* socket_factory() { return socket_factory_.get(); } |
| 49 | 45 |
| 50 // PortAllocatorFactory interface. | 46 // PortAllocatorFactory interface. |
| 51 scoped_ptr<protocol::PortAllocatorBase> CreatePortAllocator() override; | 47 scoped_ptr<cricket::PortAllocator> CreatePortAllocator( |
| 48 scoped_refptr<protocol::TransportContext> transport_context) override; |
| 52 | 49 |
| 53 private: | 50 private: |
| 54 scoped_ptr<rtc::NetworkManager> network_manager_; | 51 scoped_ptr<rtc::NetworkManager> network_manager_; |
| 55 scoped_ptr<FakePacketSocketFactory> socket_factory_; | 52 scoped_ptr<FakePacketSocketFactory> socket_factory_; |
| 56 | 53 |
| 57 DISALLOW_COPY_AND_ASSIGN(FakePortAllocatorFactory); | 54 DISALLOW_COPY_AND_ASSIGN(FakePortAllocatorFactory); |
| 58 }; | 55 }; |
| 59 | 56 |
| 60 } // namespace remoting | 57 } // namespace remoting |
| 61 | 58 |
| 62 #endif // REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ | 59 #endif // REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_ |
| OLD | NEW |