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 CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ | 5 #ifndef CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ |
6 #define CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ | 6 #define CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "chromecast/media/cma/base/coded_frame_provider.h" | 14 #include "chromecast/media/cma/base/coded_frame_provider.h" |
15 | 15 |
16 namespace chromecast { | 16 namespace chromecast { |
17 namespace media { | 17 namespace media { |
18 class FrameGeneratorForTest; | 18 class FrameGeneratorForTest; |
19 | 19 |
20 class MockFrameProvider : public CodedFrameProvider { | 20 class MockFrameProvider : public CodedFrameProvider { |
21 public: | 21 public: |
22 MockFrameProvider(); | 22 MockFrameProvider(); |
23 ~MockFrameProvider() override; | 23 ~MockFrameProvider() override; |
24 | 24 |
25 void Configure( | 25 void Configure(const std::vector<bool>& delayed_task_pattern, |
26 const std::vector<bool>& delayed_task_pattern, | 26 std::unique_ptr<FrameGeneratorForTest> frame_generator); |
27 scoped_ptr<FrameGeneratorForTest> frame_generator); | |
28 void SetDelayFlush(bool delay_flush); | 27 void SetDelayFlush(bool delay_flush); |
29 | 28 |
30 // CodedFrameProvider implementation. | 29 // CodedFrameProvider implementation. |
31 void Read(const ReadCB& read_cb) override; | 30 void Read(const ReadCB& read_cb) override; |
32 void Flush(const base::Closure& flush_cb) override; | 31 void Flush(const base::Closure& flush_cb) override; |
33 | 32 |
34 private: | 33 private: |
35 void DoRead(const ReadCB& read_cb); | 34 void DoRead(const ReadCB& read_cb); |
36 | 35 |
37 // Parameterization of the frame provider. | 36 // Parameterization of the frame provider. |
38 // |delayed_task_pattern_| indicates the pattern for delivering frames, | 37 // |delayed_task_pattern_| indicates the pattern for delivering frames, |
39 // i.e. after receiving a Read request, either delivers a frame right away | 38 // i.e. after receiving a Read request, either delivers a frame right away |
40 // or wait some time before delivering the frame. | 39 // or wait some time before delivering the frame. |
41 // |pattern_idx_| is the current index in the pattern. | 40 // |pattern_idx_| is the current index in the pattern. |
42 // |delay_flush_| indicates whether to delay flush cb in Flush. Default is | 41 // |delay_flush_| indicates whether to delay flush cb in Flush. Default is |
43 // false. | 42 // false. |
44 std::vector<bool> delayed_task_pattern_; | 43 std::vector<bool> delayed_task_pattern_; |
45 size_t pattern_idx_; | 44 size_t pattern_idx_; |
46 bool delay_flush_; | 45 bool delay_flush_; |
47 | 46 |
48 scoped_ptr<FrameGeneratorForTest> frame_generator_; | 47 std::unique_ptr<FrameGeneratorForTest> frame_generator_; |
49 | 48 |
50 DISALLOW_COPY_AND_ASSIGN(MockFrameProvider); | 49 DISALLOW_COPY_AND_ASSIGN(MockFrameProvider); |
51 }; | 50 }; |
52 | 51 |
53 } // namespace media | 52 } // namespace media |
54 } // namespace chromecast | 53 } // namespace chromecast |
55 | 54 |
56 #endif // CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ | 55 #endif // CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_PROVIDER_H_ |
OLD | NEW |