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

Unified Diff: media/filters/audio_decoder_selector_unittest.cc

Issue 140823012: Reland: Add Stop() to AudioDecoder. (https://codereview.chromium.org/126793002/) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove extra scope Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/filters/audio_decoder_selector.cc ('k') | media/filters/audio_renderer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_decoder_selector_unittest.cc
diff --git a/media/filters/audio_decoder_selector_unittest.cc b/media/filters/audio_decoder_selector_unittest.cc
index be2daff6385b972cb2bb99b5fd213039d5e1d11c..27915c85e642e2a635c5bd1e99ad524ac2cb6617 100644
--- a/media/filters/audio_decoder_selector_unittest.cc
+++ b/media/filters/audio_decoder_selector_unittest.cc
@@ -8,6 +8,7 @@
#include "base/message_loop/message_loop.h"
#include "media/base/gmock_callback_support.h"
#include "media/base/mock_filters.h"
+#include "media/base/test_helpers.h"
#include "media/filters/audio_decoder_selector.h"
#include "media/filters/decrypting_demuxer_stream.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,6 +42,19 @@ class AudioDecoderSelectorTest : public ::testing::Test {
decoder_2_(new StrictMock<MockAudioDecoder>()) {
all_decoders_.push_back(decoder_1_);
all_decoders_.push_back(decoder_2_);
+
+ EXPECT_CALL(*decoder_1_, Stop(_))
+ .WillRepeatedly(RunClosure<0>());
+ EXPECT_CALL(*decoder_2_, Stop(_))
+ .WillRepeatedly(RunClosure<0>());
+ }
+
+ ~AudioDecoderSelectorTest() {
+ if (selected_decoder_) {
+ selected_decoder_->Stop(NewExpectedClosure());
+ }
+
+ message_loop_.RunUntilIdle();
}
MOCK_METHOD1(OnStatistics, void(const PipelineStatistics&));
@@ -52,6 +66,7 @@ class AudioDecoderSelectorTest : public ::testing::Test {
scoped_ptr<AudioDecoder> decoder,
scoped_ptr<DecryptingDemuxerStream> stream) {
OnDecoderSelected(decoder.get(), stream.get());
+ selected_decoder_ = decoder.Pass();
}
void UseClearStream() {
@@ -91,8 +106,9 @@ class AudioDecoderSelectorTest : public ::testing::Test {
.WillRepeatedly(RunCallback<1>(true));
}
} else if (decryptor_capability == kHoldSetDecryptor) {
- // Set DecryptorReadyCB but the callback is never fired.
- EXPECT_CALL(*this, SetDecryptorReadyCallback(_));
+ // Set and cancel DecryptorReadyCB but the callback is never fired.
+ EXPECT_CALL(*this, SetDecryptorReadyCallback(_))
+ .Times(2);
}
DCHECK_GE(all_decoders_.size(), static_cast<size_t>(num_decoders));
@@ -132,6 +148,7 @@ class AudioDecoderSelectorTest : public ::testing::Test {
StrictMock<MockAudioDecoder>* decoder_1_;
StrictMock<MockAudioDecoder>* decoder_2_;
ScopedVector<AudioDecoder> all_decoders_;
+ scoped_ptr<AudioDecoder> selected_decoder_;
base::MessageLoop message_loop_;
private:
« no previous file with comments | « media/filters/audio_decoder_selector.cc ('k') | media/filters/audio_renderer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698