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 MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_
6 #define MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "media/cast/cast_environment.h"
11 #include "media/cast/net/cast_transport_config.h"
14 class SingleThreadTaskRunner;
25 // Class that sends the packet to a receiver through a stack of PacketPipes.
26 class LoopBackTransport : public PacketSender {
28 explicit LoopBackTransport(
29 scoped_refptr<CastEnvironment> cast_environment);
30 virtual ~LoopBackTransport();
32 virtual bool SendPacket(PacketRef packet,
33 const base::Closure& cb) OVERRIDE;
35 // Initiailize this loopback transport.
36 // Establish a flow of packets from |pipe| to |packet_receiver|.
37 // The data flow looks like:
38 // SendPacket() -> |pipe| -> Fake loopback pipe -> |packet_receiver|.
40 scoped_ptr<test::PacketPipe> pipe,
41 const PacketReceiverCallback& packet_receiver,
42 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
43 base::TickClock* clock);
46 const scoped_refptr<CastEnvironment> cast_environment_;
47 scoped_ptr<test::PacketPipe> packet_pipe_;
49 DISALLOW_COPY_AND_ASSIGN(LoopBackTransport);
55 #endif // MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_