Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: chromecast/media/cma/test/mock_frame_consumer.h

Issue 1875623002: Convert //chromecast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_CONSUMER_H_ 5 #ifndef CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_CONSUMER_H_
6 #define CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_CONSUMER_H_ 6 #define CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_CONSUMER_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/callback.h" 13 #include "base/callback.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h"
15 15
16 namespace media { 16 namespace media {
17 class AudioDecoderConfig; 17 class AudioDecoderConfig;
18 class VideoDecoderConfig; 18 class VideoDecoderConfig;
19 } 19 }
20 20
21 namespace chromecast { 21 namespace chromecast {
22 namespace media { 22 namespace media {
23 class CodedFrameProvider; 23 class CodedFrameProvider;
24 class DecoderBufferBase; 24 class DecoderBufferBase;
25 class FrameGeneratorForTest; 25 class FrameGeneratorForTest;
26 26
27 class MockFrameConsumer { 27 class MockFrameConsumer {
28 public: 28 public:
29 explicit MockFrameConsumer(CodedFrameProvider* coded_frame_provider); 29 explicit MockFrameConsumer(CodedFrameProvider* coded_frame_provider);
30 ~MockFrameConsumer(); 30 ~MockFrameConsumer();
31 31
32 void Configure(const std::vector<bool>& delayed_task_pattern, 32 void Configure(const std::vector<bool>& delayed_task_pattern,
33 bool last_read_aborted_by_flush, 33 bool last_read_aborted_by_flush,
34 scoped_ptr<FrameGeneratorForTest> frame_generator); 34 std::unique_ptr<FrameGeneratorForTest> frame_generator);
35 35
36 // Starts consuming frames. Invoke |done_cb| when all the expected frames 36 // Starts consuming frames. Invoke |done_cb| when all the expected frames
37 // have been received. 37 // have been received.
38 void Start(const base::Closure& done_cb); 38 void Start(const base::Closure& done_cb);
39 39
40 private: 40 private:
41 void ReadFrame(); 41 void ReadFrame();
42 void OnNewFrame(const scoped_refptr<DecoderBufferBase>& buffer, 42 void OnNewFrame(const scoped_refptr<DecoderBufferBase>& buffer,
43 const ::media::AudioDecoderConfig& audio_config, 43 const ::media::AudioDecoderConfig& audio_config,
44 const ::media::VideoDecoderConfig& video_config); 44 const ::media::VideoDecoderConfig& video_config);
45 45
46 void OnFlushCompleted(); 46 void OnFlushCompleted();
47 47
48 CodedFrameProvider* const coded_frame_provider_; 48 CodedFrameProvider* const coded_frame_provider_;
49 49
50 base::Closure done_cb_; 50 base::Closure done_cb_;
51 51
52 // Parameterization of the frame consumer: 52 // Parameterization of the frame consumer:
53 // |delayed_task_pattern_| indicates the pattern for fetching frames, 53 // |delayed_task_pattern_| indicates the pattern for fetching frames,
54 // i.e. after receiving a frame, either fetch a frame right away 54 // i.e. after receiving a frame, either fetch a frame right away
55 // or wait some time before fetching another frame. 55 // or wait some time before fetching another frame.
56 // |pattern_idx_| is the current index in the pattern. 56 // |pattern_idx_| is the current index in the pattern.
57 // |last_read_aborted_by_flush_| indicates whether the last buffer request 57 // |last_read_aborted_by_flush_| indicates whether the last buffer request
58 // should be aborted by a Flush. 58 // should be aborted by a Flush.
59 std::vector<bool> delayed_task_pattern_; 59 std::vector<bool> delayed_task_pattern_;
60 size_t pattern_idx_; 60 size_t pattern_idx_;
61 bool last_read_aborted_by_flush_; 61 bool last_read_aborted_by_flush_;
62 62
63 // Expected results. 63 // Expected results.
64 scoped_ptr<FrameGeneratorForTest> frame_generator_; 64 std::unique_ptr<FrameGeneratorForTest> frame_generator_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(MockFrameConsumer); 66 DISALLOW_COPY_AND_ASSIGN(MockFrameConsumer);
67 }; 67 };
68 68
69 } // namespace media 69 } // namespace media
70 } // namespace chromecast 70 } // namespace chromecast
71 71
72 #endif // CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_CONSUMER_H_ 72 #endif // CHROMECAST_MEDIA_CMA_TEST_MOCK_FRAME_CONSUMER_H_
OLDNEW
« no previous file with comments | « chromecast/media/cma/test/frame_segmenter_for_test.cc ('k') | chromecast/media/cma/test/mock_frame_consumer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698