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

Unified Diff: media/filters/audio_renderer_base_unittest.cc

Issue 404016: Replace hard-coded media_format() methods with Google Mock methods declared in mock_filters.h. (Closed)
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_base_unittest.cc
diff --git a/media/filters/audio_renderer_base_unittest.cc b/media/filters/audio_renderer_base_unittest.cc
index 1827424db32165dc56b920e3be67d336de1ef59a..df4c9f0a6802123e8902a475c89d2492573561b8 100644
--- a/media/filters/audio_renderer_base_unittest.cc
+++ b/media/filters/audio_renderer_base_unittest.cc
@@ -15,6 +15,7 @@ using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::NotNull;
using ::testing::Return;
+using ::testing::ReturnRef;
using ::testing::StrictMock;
namespace media {
@@ -47,12 +48,21 @@ class AudioRendererBaseTest : public ::testing::Test {
// Give the decoder some non-garbage media properties.
AudioRendererBaseTest()
: renderer_(new MockAudioRendererBase()),
- decoder_(new MockAudioDecoder(1, 44100, 16)) {
+ decoder_(new MockAudioDecoder()) {
renderer_->set_host(&host_);
// Queue all reads from the decoder.
EXPECT_CALL(*decoder_, Read(NotNull()))
.WillRepeatedly(Invoke(this, &AudioRendererBaseTest::EnqueueCallback));
+
+ // Sets the essential media format keys for this decoder.
+ decoder_media_format_.SetAsString(MediaFormat::kMimeType,
+ mime_type::kUncompressedAudio);
+ decoder_media_format_.SetAsInteger(MediaFormat::kChannels, 1);
+ decoder_media_format_.SetAsInteger(MediaFormat::kSampleRate, 44100);
+ decoder_media_format_.SetAsInteger(MediaFormat::kSampleBits, 16);
+ EXPECT_CALL(*decoder_, media_format())
+ .WillRepeatedly(ReturnRef(decoder_media_format_));
}
virtual ~AudioRendererBaseTest() {
@@ -71,6 +81,7 @@ class AudioRendererBaseTest : public ::testing::Test {
scoped_refptr<MockAudioDecoder> decoder_;
StrictMock<MockFilterHost> host_;
StrictMock<MockFilterCallback> callback_;
+ MediaFormat decoder_media_format_;
// Receives asynchronous read requests sent to |decoder_|.
std::deque<Callback1<Buffer*>::Type*> read_queue_;
« no previous file with comments | « media/base/pipeline_impl_unittest.cc ('k') | media/filters/video_renderer_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698