| 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 MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 5 #ifndef MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
| 6 #define MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 6 #define MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "media/cast/transport/cast_transport_config.h" | 16 #include "media/cast/net/cast_transport_config.h" |
| 17 #include "net/base/ip_endpoint.h" | 17 #include "net/base/ip_endpoint.h" |
| 18 #include "third_party/mt19937ar/mt19937ar.h" | 18 #include "third_party/mt19937ar/mt19937ar.h" |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class NetLog; | 21 class NetLog; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class TickClock; | 25 class TickClock; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 namespace media { | 28 namespace media { |
| 29 namespace cast { | 29 namespace cast { |
| 30 namespace test { | 30 namespace test { |
| 31 | 31 |
| 32 class PacketPipe { | 32 class PacketPipe { |
| 33 public: | 33 public: |
| 34 PacketPipe(); | 34 PacketPipe(); |
| 35 virtual ~PacketPipe(); | 35 virtual ~PacketPipe(); |
| 36 virtual void Send(scoped_ptr<transport::Packet> packet) = 0; | 36 virtual void Send(scoped_ptr<Packet> packet) = 0; |
| 37 // Allows injection of fake test runner for testing. | 37 // Allows injection of fake test runner for testing. |
| 38 virtual void InitOnIOThread( | 38 virtual void InitOnIOThread( |
| 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 39 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 40 base::TickClock* clock); | 40 base::TickClock* clock); |
| 41 virtual void AppendToPipe(scoped_ptr<PacketPipe> pipe); | 41 virtual void AppendToPipe(scoped_ptr<PacketPipe> pipe); |
| 42 protected: | 42 protected: |
| 43 scoped_ptr<PacketPipe> pipe_; | 43 scoped_ptr<PacketPipe> pipe_; |
| 44 // Allows injection of fake task runner for testing. | 44 // Allows injection of fake task runner for testing. |
| 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 45 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 46 base::TickClock* clock_; | 46 base::TickClock* clock_; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 // This method builds a stack of PacketPipes to emulate a crappy wifi network. | 167 // This method builds a stack of PacketPipes to emulate a crappy wifi network. |
| 168 // ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered. | 168 // ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered. |
| 169 // 300ms drouputs every ~2 seconds. | 169 // 300ms drouputs every ~2 seconds. |
| 170 scoped_ptr<PacketPipe> EvilNetwork(); | 170 scoped_ptr<PacketPipe> EvilNetwork(); |
| 171 | 171 |
| 172 } // namespace test | 172 } // namespace test |
| 173 } // namespace cast | 173 } // namespace cast |
| 174 } // namespace media | 174 } // namespace media |
| 175 | 175 |
| 176 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ | 176 #endif // MEDIA_CAST_TEST_UTILITY_UDP_PROXY_H_ |
| OLD | NEW |