| 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_LOOPBACK_TRANSPORT_H_ | 5 #ifndef MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_ |
| 6 #define MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_ | 6 #define MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class LoopBackTransport : public PacketSender { | 29 class LoopBackTransport : public PacketSender { |
| 30 public: | 30 public: |
| 31 explicit LoopBackTransport( | 31 explicit LoopBackTransport( |
| 32 scoped_refptr<CastEnvironment> cast_environment); | 32 scoped_refptr<CastEnvironment> cast_environment); |
| 33 ~LoopBackTransport() final; | 33 ~LoopBackTransport() final; |
| 34 | 34 |
| 35 bool SendPacket(PacketRef packet, const base::Closure& cb) final; | 35 bool SendPacket(PacketRef packet, const base::Closure& cb) final; |
| 36 | 36 |
| 37 int64_t GetBytesSent() final; | 37 int64_t GetBytesSent() final; |
| 38 | 38 |
| 39 void StartReceiving( |
| 40 const PacketReceiverCallbackWithStatus& packet_receiver) final {} |
| 41 |
| 42 void StopReceiving() final {} |
| 43 |
| 39 // Initiailize this loopback transport. | 44 // Initiailize this loopback transport. |
| 40 // Establish a flow of packets from |pipe| to |packet_receiver|. | 45 // Establish a flow of packets from |pipe| to |packet_receiver|. |
| 41 // | 46 // |
| 42 // The data flow looks like: | 47 // The data flow looks like: |
| 43 // SendPacket() -> |pipe| -> Fake loopback pipe -> |packet_receiver|. | 48 // SendPacket() -> |pipe| -> Fake loopback pipe -> |packet_receiver|. |
| 44 // | 49 // |
| 45 // If |pipe| is NULL then the data flow looks like: | 50 // If |pipe| is NULL then the data flow looks like: |
| 46 // SendPacket() -> Fake loopback pipe -> |packet_receiver|. | 51 // SendPacket() -> Fake loopback pipe -> |packet_receiver|. |
| 47 void Initialize( | 52 void Initialize( |
| 48 scoped_ptr<test::PacketPipe> pipe, | 53 scoped_ptr<test::PacketPipe> pipe, |
| 49 const PacketReceiverCallback& packet_receiver, | 54 const PacketReceiverCallback& packet_receiver, |
| 50 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 55 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 51 base::TickClock* clock); | 56 base::TickClock* clock); |
| 52 | 57 |
| 53 private: | 58 private: |
| 54 const scoped_refptr<CastEnvironment> cast_environment_; | 59 const scoped_refptr<CastEnvironment> cast_environment_; |
| 55 scoped_ptr<test::PacketPipe> packet_pipe_; | 60 scoped_ptr<test::PacketPipe> packet_pipe_; |
| 56 int64_t bytes_sent_; | 61 int64_t bytes_sent_; |
| 57 | 62 |
| 58 DISALLOW_COPY_AND_ASSIGN(LoopBackTransport); | 63 DISALLOW_COPY_AND_ASSIGN(LoopBackTransport); |
| 59 }; | 64 }; |
| 60 | 65 |
| 61 } // namespace cast | 66 } // namespace cast |
| 62 } // namespace media | 67 } // namespace media |
| 63 | 68 |
| 64 #endif // MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_ | 69 #endif // MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_ |
| OLD | NEW |