| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 template <class T> | 124 template <class T> |
| 124 scoped_refptr<AudioBuffer> MakePlanarAudioBuffer( | 125 scoped_refptr<AudioBuffer> MakePlanarAudioBuffer( |
| 125 SampleFormat format, | 126 SampleFormat format, |
| 126 int channels, | 127 int channels, |
| 127 T start, | 128 T start, |
| 128 T increment, | 129 T increment, |
| 129 int frames, | 130 int frames, |
| 130 base::TimeDelta start_time, | 131 base::TimeDelta start_time, |
| 131 base::TimeDelta duration); | 132 base::TimeDelta duration); |
| 132 | 133 |
| 134 // Create a fake video DecoderBuffer for testing purpose. The buffer contains |
| 135 // part of video decoder config info embedded so that the testing code can do |
| 136 // some sanity check. |
| 137 scoped_refptr<DecoderBuffer> CreateFakeVideoBufferForTest( |
| 138 const VideoDecoderConfig& config, |
| 139 base::TimeDelta timestamp, |
| 140 base::TimeDelta duration); |
| 141 |
| 142 // Verify if a fake video DecoderBuffer is valid. |
| 143 bool VerifyFakeVideoBufferForTest(const scoped_refptr<DecoderBuffer>& buffer, |
| 144 const VideoDecoderConfig& config); |
| 145 |
| 133 } // namespace media | 146 } // namespace media |
| 134 | 147 |
| 135 #endif // MEDIA_BASE_TEST_HELPERS_H_ | 148 #endif // MEDIA_BASE_TEST_HELPERS_H_ |
| OLD | NEW |