OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_REMOTING_FAKE_REMOTING_CONTROLLER_H_ | 5 #ifndef MEDIA_REMOTING_FAKE_REMOTING_CONTROLLER_H_ |
6 #define MEDIA_REMOTING_FAKE_REMOTING_CONTROLLER_H_ | 6 #define MEDIA_REMOTING_FAKE_REMOTING_CONTROLLER_H_ |
7 | 7 |
8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
9 #include "media/mojo/interfaces/remoting.mojom.h" | 9 #include "media/mojo/interfaces/remoting.mojom.h" |
10 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 class RemotingController; | 14 class RemotingSourceImpl; |
15 | 15 |
16 class FakeRemotingDataStreamSender : public mojom::RemotingDataStreamSender { | 16 class FakeRemotingDataStreamSender : public mojom::RemotingDataStreamSender { |
17 public: | 17 public: |
18 FakeRemotingDataStreamSender( | 18 FakeRemotingDataStreamSender( |
19 mojom::RemotingDataStreamSenderRequest request, | 19 mojom::RemotingDataStreamSenderRequest request, |
20 mojo::ScopedDataPipeConsumerHandle consumer_handle); | 20 mojo::ScopedDataPipeConsumerHandle consumer_handle); |
21 ~FakeRemotingDataStreamSender() override; | 21 ~FakeRemotingDataStreamSender() override; |
22 | 22 |
23 uint32_t consume_data_chunk_count() const { | 23 uint32_t consume_data_chunk_count() const { |
24 return consume_data_chunk_count_; | 24 return consume_data_chunk_count_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 private: | 70 private: |
71 void Started(); | 71 void Started(); |
72 void StartFailed(); | 72 void StartFailed(); |
73 void Stopped(mojom::RemotingStopReason reason); | 73 void Stopped(mojom::RemotingStopReason reason); |
74 | 74 |
75 mojom::RemotingSourcePtr source_; | 75 mojom::RemotingSourcePtr source_; |
76 bool start_will_fail_; | 76 bool start_will_fail_; |
77 | 77 |
78 std::unique_ptr<FakeRemotingDataStreamSender> audio_stream_sender_; | 78 std::unique_ptr<FakeRemotingDataStreamSender> audio_stream_sender_; |
79 std::unique_ptr<FakeRemotingDataStreamSender> video_stream_sender_; | 79 std::unique_ptr<FakeRemotingDataStreamSender> video_stream_sender_; |
| 80 |
| 81 base::WeakPtrFactory<FakeRemoter> weak_factory_; |
| 82 |
80 DISALLOW_COPY_AND_ASSIGN(FakeRemoter); | 83 DISALLOW_COPY_AND_ASSIGN(FakeRemoter); |
81 }; | 84 }; |
82 | 85 |
83 class FakeRemoterFactory final : public mojom::RemoterFactory { | 86 class FakeRemoterFactory final : public mojom::RemoterFactory { |
84 public: | 87 public: |
85 // |start_will_fail| indicates whether starting remoting will fail. | 88 // |start_will_fail| indicates whether starting remoting will fail. |
86 explicit FakeRemoterFactory(bool start_will_fail); | 89 explicit FakeRemoterFactory(bool start_will_fail); |
87 ~FakeRemoterFactory() override; | 90 ~FakeRemoterFactory() override; |
88 | 91 |
89 // mojom::RemoterFactory implementation. | 92 // mojom::RemoterFactory implementation. |
90 void Create(mojom::RemotingSourcePtr source, | 93 void Create(mojom::RemotingSourcePtr source, |
91 mojom::RemoterRequest request) override; | 94 mojom::RemoterRequest request) override; |
92 | 95 |
93 private: | 96 private: |
94 bool start_will_fail_; | 97 bool start_will_fail_; |
95 | 98 |
96 DISALLOW_COPY_AND_ASSIGN(FakeRemoterFactory); | 99 DISALLOW_COPY_AND_ASSIGN(FakeRemoterFactory); |
97 }; | 100 }; |
98 | 101 |
99 std::unique_ptr<RemotingController> CreateRemotingController( | 102 scoped_refptr<RemotingSourceImpl> CreateRemotingSourceImpl( |
100 bool start_will_fail); | 103 bool start_will_fail); |
101 | 104 |
102 } // namespace media | 105 } // namespace media |
103 | 106 |
104 #endif // MEDIA_REMOTING_FAKE_REMOTING_CONTROLLER_H_ | 107 #endif // MEDIA_REMOTING_FAKE_REMOTING_CONTROLLER_H_ |
OLD | NEW |