Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / cast / test / loopback_transport.h
blob478004c1b57e85a47911ef882a2941b34f04dfb6
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"
13 namespace base {
14 class SingleThreadTaskRunner;
15 class TickClock;
16 } // namespace base
18 namespace media {
19 namespace cast {
21 namespace test {
22 class PacketPipe;
23 } // namespace test
25 // Class that sends the packet to a receiver through a stack of PacketPipes.
26 class LoopBackTransport : public PacketSender {
27 public:
28 explicit LoopBackTransport(
29 scoped_refptr<CastEnvironment> cast_environment);
30 ~LoopBackTransport() final;
32 bool SendPacket(PacketRef packet, const base::Closure& cb) final;
34 int64 GetBytesSent() final;
36 // Initiailize this loopback transport.
37 // Establish a flow of packets from |pipe| to |packet_receiver|.
39 // The data flow looks like:
40 // SendPacket() -> |pipe| -> Fake loopback pipe -> |packet_receiver|.
42 // If |pipe| is NULL then the data flow looks like:
43 // SendPacket() -> Fake loopback pipe -> |packet_receiver|.
44 void Initialize(
45 scoped_ptr<test::PacketPipe> pipe,
46 const PacketReceiverCallback& packet_receiver,
47 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
48 base::TickClock* clock);
50 private:
51 const scoped_refptr<CastEnvironment> cast_environment_;
52 scoped_ptr<test::PacketPipe> packet_pipe_;
53 int64 bytes_sent_;
55 DISALLOW_COPY_AND_ASSIGN(LoopBackTransport);
58 } // namespace cast
59 } // namespace media
61 #endif // MEDIA_CAST_TEST_LOOPBACK_TRANSPORT_H_