OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_TEST_HELPERS_H_ | 5 #ifndef MEDIA_BASE_TEST_HELPERS_H_ |
6 #define MEDIA_BASE_TEST_HELPERS_H_ | 6 #define MEDIA_BASE_TEST_HELPERS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "media/base/pipeline_status.h" | 10 #include "media/base/pipeline_status.h" |
11 #include "media/base/sample_format.h" | 11 #include "media/base/sample_format.h" |
12 #include "media/base/video_decoder_config.h" | 12 #include "media/base/video_decoder_config.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class MessageLoop; | 17 class MessageLoop; |
18 class TimeDelta; | 18 class TimeDelta; |
19 } | 19 } |
20 | 20 |
21 namespace media { | 21 namespace media { |
22 | 22 |
23 class AudioBuffer; | 23 class AudioBuffer; |
| 24 class DecoderBuffer; |
24 | 25 |
25 // Return a callback that expects to be run once. | 26 // Return a callback that expects to be run once. |
26 base::Closure NewExpectedClosure(); | 27 base::Closure NewExpectedClosure(); |
27 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status); | 28 PipelineStatusCB NewExpectedStatusCB(PipelineStatus status); |
28 | 29 |
29 // Helper class for running a message loop until a callback has run. Useful for | 30 // Helper class for running a message loop until a callback has run. Useful for |
30 // testing classes that run on more than a single thread. | 31 // testing classes that run on more than a single thread. |
31 // | 32 // |
32 // Events are intended for single use and cannot be reset. | 33 // Events are intended for single use and cannot be reset. |
33 class WaitableMessageLoopEvent { | 34 class WaitableMessageLoopEvent { |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // to 1 second per frame, to simplify calculations. | 122 // to 1 second per frame, to simplify calculations. |
122 template <class T> | 123 template <class T> |
123 scoped_refptr<AudioBuffer> MakePlanarAudioBuffer( | 124 scoped_refptr<AudioBuffer> MakePlanarAudioBuffer( |
124 SampleFormat format, | 125 SampleFormat format, |
125 int channels, | 126 int channels, |
126 T start, | 127 T start, |
127 T increment, | 128 T increment, |
128 int frames, | 129 int frames, |
129 base::TimeDelta start_time); | 130 base::TimeDelta start_time); |
130 | 131 |
| 132 // Create a fake video DecoderBuffer for testing purpose. The buffer contains |
| 133 // part of video decoder config info embedded so that the testing code can do |
| 134 // some sanity check. |
| 135 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( |
| 136 const VideoDecoderConfig& config, |
| 137 base::TimeDelta timestamp, |
| 138 base::TimeDelta duration); |
| 139 |
| 140 // Verify if a fake video DecoderBuffer is valid. |
| 141 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer, |
| 142 const VideoDecoderConfig& config); |
| 143 |
131 } // namespace media | 144 } // namespace media |
132 | 145 |
133 #endif // MEDIA_BASE_TEST_HELPERS_H_ | 146 #endif // MEDIA_BASE_TEST_HELPERS_H_ |
OLD | NEW |