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_SOCKET_FACTORY_H_ | 5 #ifndef REMOTING_TEST_FAKE_SOCKET_FACTORY_H_ |
6 #define REMOTING_TEST_FAKE_SOCKET_FACTORY_H_ | 6 #define REMOTING_TEST_FAKE_SOCKET_FACTORY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
11 | 12 |
12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "remoting/test/fake_network_dispatcher.h" | 17 #include "remoting/test/fake_network_dispatcher.h" |
18 #include "third_party/webrtc/p2p/base/packetsocketfactory.h" | 18 #include "third_party/webrtc/p2p/base/packetsocketfactory.h" |
19 | 19 |
20 namespace remoting { | 20 namespace remoting { |
21 | 21 |
22 class FakeNetworkDispatcher; | 22 class FakeNetworkDispatcher; |
23 class LeakyBucket; | 23 class LeakyBucket; |
24 | 24 |
25 class FakePacketSocketFactory : public rtc::PacketSocketFactory, | 25 class FakePacketSocketFactory : public rtc::PacketSocketFactory, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 int data_size)> ReceiveCallback; | 102 int data_size)> ReceiveCallback; |
103 typedef std::map<uint16_t, ReceiveCallback> UdpSocketsMap; | 103 typedef std::map<uint16_t, ReceiveCallback> UdpSocketsMap; |
104 | 104 |
105 void DoReceivePacket(); | 105 void DoReceivePacket(); |
106 | 106 |
107 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 107 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
108 scoped_refptr<FakeNetworkDispatcher> dispatcher_; | 108 scoped_refptr<FakeNetworkDispatcher> dispatcher_; |
109 | 109 |
110 rtc::IPAddress address_; | 110 rtc::IPAddress address_; |
111 | 111 |
112 scoped_ptr<LeakyBucket> leaky_bucket_; | 112 std::unique_ptr<LeakyBucket> leaky_bucket_; |
113 base::TimeDelta latency_average_; | 113 base::TimeDelta latency_average_; |
114 base::TimeDelta latency_stddev_; | 114 base::TimeDelta latency_stddev_; |
115 double out_of_order_rate_; | 115 double out_of_order_rate_; |
116 | 116 |
117 UdpSocketsMap udp_sockets_; | 117 UdpSocketsMap udp_sockets_; |
118 uint16_t next_port_; | 118 uint16_t next_port_; |
119 | 119 |
120 std::list<PendingPacket> pending_packets_; | 120 std::list<PendingPacket> pending_packets_; |
121 | 121 |
122 base::WeakPtrFactory<FakePacketSocketFactory> weak_factory_; | 122 base::WeakPtrFactory<FakePacketSocketFactory> weak_factory_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(FakePacketSocketFactory); | 124 DISALLOW_COPY_AND_ASSIGN(FakePacketSocketFactory); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace remoting | 127 } // namespace remoting |
128 | 128 |
129 #endif // REMOTING_TEST_FAKE_SOCKET_FACTORY_H_ | 129 #endif // REMOTING_TEST_FAKE_SOCKET_FACTORY_H_ |
OLD | NEW |