| Index: media/cast/test/utility/udp_proxy.h
|
| diff --git a/media/cast/test/utility/udp_proxy.h b/media/cast/test/utility/udp_proxy.h
|
| index ef89c99c64b060616287a0ab004bad9ac004de2a..624639064a611da43faf9a82c750574532848384 100644
|
| --- a/media/cast/test/utility/udp_proxy.h
|
| +++ b/media/cast/test/utility/udp_proxy.h
|
| @@ -8,12 +8,12 @@
|
| #include <stddef.h>
|
| #include <stdint.h>
|
|
|
| +#include <memory>
|
| #include <vector>
|
|
|
| #include "base/macros.h"
|
| #include "base/memory/linked_ptr.h"
|
| #include "base/memory/ref_counted.h"
|
| -#include "base/memory/scoped_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "media/cast/net/cast_transport_config.h"
|
| @@ -36,14 +36,15 @@ class PacketPipe {
|
| public:
|
| PacketPipe();
|
| virtual ~PacketPipe();
|
| - virtual void Send(scoped_ptr<Packet> packet) = 0;
|
| + virtual void Send(std::unique_ptr<Packet> packet) = 0;
|
| // Allows injection of fake test runner for testing.
|
| virtual void InitOnIOThread(
|
| const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
|
| base::TickClock* clock);
|
| - virtual void AppendToPipe(scoped_ptr<PacketPipe> pipe);
|
| + virtual void AppendToPipe(std::unique_ptr<PacketPipe> pipe);
|
| +
|
| protected:
|
| - scoped_ptr<PacketPipe> pipe_;
|
| + std::unique_ptr<PacketPipe> pipe_;
|
| // Allows injection of fake task runner for testing.
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
|
| base::TickClock* clock_;
|
| @@ -63,7 +64,7 @@ class InterruptedPoissonProcess {
|
| uint32_t rand_seed);
|
| ~InterruptedPoissonProcess();
|
|
|
| - scoped_ptr<PacketPipe> NewBuffer(size_t size);
|
| + std::unique_ptr<PacketPipe> NewBuffer(size_t size);
|
|
|
| private:
|
| class InternalBuffer;
|
| @@ -116,11 +117,12 @@ class InterruptedPoissonProcess {
|
| class UDPProxy {
|
| public:
|
| virtual ~UDPProxy() {}
|
| - static scoped_ptr<UDPProxy> Create(const net::IPEndPoint& local_port,
|
| - const net::IPEndPoint& destination,
|
| - scoped_ptr<PacketPipe> to_dest_pipe,
|
| - scoped_ptr<PacketPipe> from_dest_pipe,
|
| - net::NetLog* net_log);
|
| + static std::unique_ptr<UDPProxy> Create(
|
| + const net::IPEndPoint& local_port,
|
| + const net::IPEndPoint& destination,
|
| + std::unique_ptr<PacketPipe> to_dest_pipe,
|
| + std::unique_ptr<PacketPipe> from_dest_pipe,
|
| + net::NetLog* net_log);
|
| };
|
|
|
| // The following functions create PacketPipes which can be linked
|
| @@ -130,62 +132,63 @@ class UDPProxy {
|
| // from the buffer at a rate given by |bandwidth| (in megabits per second).
|
| // Packets entering the buffer will be dropped if there is not enough
|
| // room for them.
|
| -scoped_ptr<PacketPipe> NewBuffer(size_t buffer_size, double bandwidth);
|
| +std::unique_ptr<PacketPipe> NewBuffer(size_t buffer_size, double bandwidth);
|
|
|
| // Randomly drops |drop_fraction|*100% of packets.
|
| -scoped_ptr<PacketPipe> NewRandomDrop(double drop_fraction);
|
| +std::unique_ptr<PacketPipe> NewRandomDrop(double drop_fraction);
|
|
|
| // Delays each packet by |delay_seconds|.
|
| -scoped_ptr<PacketPipe> NewConstantDelay(double delay_seconds);
|
| +std::unique_ptr<PacketPipe> NewConstantDelay(double delay_seconds);
|
|
|
| // Delays packets by a random amount between zero and |delay|.
|
| // This PacketPipe can reorder packets.
|
| -scoped_ptr<PacketPipe> NewRandomUnsortedDelay(double delay);
|
| +std::unique_ptr<PacketPipe> NewRandomUnsortedDelay(double delay);
|
|
|
| // Duplicates every packet, one is transmitted immediately,
|
| // one is transmitted after a random delay between |delay_min|
|
| // and |delay_min + random_delay|.
|
| // This PacketPipe will reorder packets.
|
| -scoped_ptr<PacketPipe> NewDuplicateAndDelay(double delay_min,
|
| - double random_delay);
|
| +std::unique_ptr<PacketPipe> NewDuplicateAndDelay(double delay_min,
|
| + double random_delay);
|
|
|
| // This PacketPipe inserts a random delay between each packet.
|
| // This PacketPipe cannot re-order packets. The delay between each
|
| // packet is asically |min_delay| + random( |random_delay| )
|
| // However, every now and then a delay of |big_delay| will be
|
| // inserted (roughly every |seconds_between_big_delay| seconds).
|
| -scoped_ptr<PacketPipe> NewRandomSortedDelay(double random_delay,
|
| - double big_delay,
|
| - double seconds_between_big_delay);
|
| +std::unique_ptr<PacketPipe> NewRandomSortedDelay(
|
| + double random_delay,
|
| + double big_delay,
|
| + double seconds_between_big_delay);
|
|
|
| // This PacketPipe emulates network outages. It basically waits
|
| // for 0-2*|average_work_time| seconds, then kills the network for
|
| // 0-|2*average_outage_time| seconds. Then it starts over again.
|
| -scoped_ptr<PacketPipe> NewNetworkGlitchPipe(double average_work_time,
|
| - double average_outage_time);
|
| +std::unique_ptr<PacketPipe> NewNetworkGlitchPipe(double average_work_time,
|
| + double average_outage_time);
|
|
|
| // This method builds a stack of PacketPipes to emulate a reasonably
|
| // good network. ~50mbit, ~3ms latency, no packet loss unless saturated.
|
| -scoped_ptr<PacketPipe> GoodNetwork();
|
| +std::unique_ptr<PacketPipe> GoodNetwork();
|
|
|
| // This method builds a stack of PacketPipes to emulate a reasonably
|
| // good wifi network. ~20mbit, 1% packet loss, ~3ms latency.
|
| -scoped_ptr<PacketPipe> WifiNetwork();
|
| +std::unique_ptr<PacketPipe> WifiNetwork();
|
|
|
| // This method builds a stack of PacketPipes to emulate a
|
| // bad wifi network. ~5mbit, 5% packet loss, ~7ms latency
|
| // 40ms dropouts every ~2 seconds. Can reorder packets.
|
| -scoped_ptr<PacketPipe> BadNetwork();
|
| +std::unique_ptr<PacketPipe> BadNetwork();
|
|
|
| // This method builds a stack of PacketPipes to emulate a crappy wifi network.
|
| // ~2mbit, 20% packet loss, ~40ms latency and packets can get reordered.
|
| // 300ms drouputs every ~2 seconds.
|
| -scoped_ptr<PacketPipe> EvilNetwork();
|
| +std::unique_ptr<PacketPipe> EvilNetwork();
|
|
|
| // Builds an Interrupted Poisson Process network simulator with default
|
| // settings. It simulates a challenging interference-heavy WiFi environment
|
| // of roughly 2mbits/s.
|
| -scoped_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess();
|
| +std::unique_ptr<InterruptedPoissonProcess> DefaultInterruptedPoissonProcess();
|
|
|
| } // namespace test
|
| } // namespace cast
|
|
|