Fix crash when sorting WebsitePreferences.
[chromium-blink-merge.git] / remoting / test / fake_port_allocator.h
blobaf6ec3f81f63990f0d63e423c3f98b22e0af9648
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_
6 #define REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_
8 #include <set>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "third_party/webrtc/p2p/client/httpportallocator.h"
14 namespace remoting {
16 class FakeNetworkDispatcher;
17 class FakePacketSocketFactory;
19 class FakePortAllocator : public cricket::HttpPortAllocatorBase {
20 public:
21 static scoped_ptr<FakePortAllocator> Create(
22 scoped_refptr<FakeNetworkDispatcher> fake_network_dispatcher);
24 ~FakePortAllocator() override;
26 FakePacketSocketFactory* socket_factory() { return socket_factory_.get(); }
28 // cricket::BasicPortAllocator overrides.
29 cricket::PortAllocatorSession* CreateSessionInternal(
30 const std::string& content_name,
31 int component,
32 const std::string& ice_username_fragment,
33 const std::string& ice_password) override;
35 private:
36 FakePortAllocator(scoped_ptr<rtc::NetworkManager> network_manager,
37 scoped_ptr<FakePacketSocketFactory> socket_factory);
39 scoped_ptr<rtc::NetworkManager> network_manager_;
40 scoped_ptr<FakePacketSocketFactory> socket_factory_;
42 DISALLOW_COPY_AND_ASSIGN(FakePortAllocator);
45 } // namespace remoting
47 #endif // REMOTING_TEST_FAKE_PORT_ALLOCATOR_H_