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

Unified Diff: media/filters/audio_renderer_impl_unittest.cc

Issue 139513007: Revert of Add Stop() to AudioDecoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_renderer_impl.cc ('k') | media/filters/decrypting_audio_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_impl_unittest.cc
diff --git a/media/filters/audio_renderer_impl_unittest.cc b/media/filters/audio_renderer_impl_unittest.cc
index 834452f331d646cf45fe8ad03e72b7b9c17531fd..5adfbc499f7491f8176e71d4c801104f0fa1cf26 100644
--- a/media/filters/audio_renderer_impl_unittest.cc
+++ b/media/filters/audio_renderer_impl_unittest.cc
@@ -46,8 +46,7 @@
public:
// Give the decoder some non-garbage media properties.
AudioRendererImplTest()
- : needs_stop_(true),
- demuxer_stream_(DemuxerStream::AUDIO),
+ : demuxer_stream_(DemuxerStream::AUDIO),
decoder_(new MockAudioDecoder()) {
AudioDecoderConfig audio_config(kCodec,
kSampleFormat,
@@ -65,9 +64,6 @@
EXPECT_CALL(*decoder_, Reset(_))
.WillRepeatedly(Invoke(this, &AudioRendererImplTest::ResetDecoder));
- EXPECT_CALL(*decoder_, Stop(_))
- .WillRepeatedly(Invoke(this, &AudioRendererImplTest::StopDecoder));
-
// Set up audio properties.
EXPECT_CALL(*decoder_, bits_per_channel())
.WillRepeatedly(Return(audio_config.bits_per_channel()));
@@ -92,11 +88,9 @@
virtual ~AudioRendererImplTest() {
SCOPED_TRACE("~AudioRendererImplTest()");
- if (needs_stop_) {
- WaitableMessageLoopEvent event;
- renderer_->Stop(event.GetClosure());
- event.RunAndWait();
- }
+ WaitableMessageLoopEvent event;
+ renderer_->Stop(event.GetClosure());
+ event.RunAndWait();
}
void ExpectUnsupportedAudioDecoder() {
@@ -382,10 +376,6 @@
scoped_ptr<AudioRendererImpl> renderer_;
scoped_refptr<FakeAudioRendererSink> sink_;
- // Whether or not the test needs the destructor to call Stop() on
- // |renderer_| at destruction.
- bool needs_stop_;
-
private:
TimeTicks GetTime() {
base::AutoLock auto_lock(lock_);
@@ -416,10 +406,6 @@
message_loop_.PostTask(FROM_HERE, reset_cb);
}
- void StopDecoder(const base::Closure& stop_cb) {
- message_loop_.PostTask(FROM_HERE, stop_cb);
- }
-
void DeliverBuffer(AudioDecoder::Status status,
const scoped_refptr<AudioBuffer>& buffer) {
CHECK(!read_cb_.is_null());
@@ -783,6 +769,7 @@
Preroll(1000, PIPELINE_OK);
}
+
TEST_F(AudioRendererImplTest, PendingRead_Flush) {
Initialize();
@@ -811,32 +798,7 @@
Preroll(1000, PIPELINE_OK);
}
-TEST_F(AudioRendererImplTest, PendingRead_Stop) {
- Initialize();
-
- Preroll();
- Play();
-
- // Partially drain internal buffer so we get a pending read.
- EXPECT_TRUE(ConsumeBufferedData(frames_buffered() / 2, NULL));
- WaitForPendingRead();
-
- Pause();
-
- EXPECT_TRUE(IsReadPending());
-
- WaitableMessageLoopEvent stop_event;
- renderer_->Stop(stop_event.GetClosure());
- needs_stop_ = false;
-
- SatisfyPendingRead(kDataSize);
-
- stop_event.RunAndWait();
-
- EXPECT_FALSE(IsReadPending());
-}
-
-TEST_F(AudioRendererImplTest, PendingFlush_Stop) {
+TEST_F(AudioRendererImplTest, StopDuringFlush) {
Initialize();
Preroll();
@@ -856,10 +818,10 @@
SatisfyPendingRead(kDataSize);
- WaitableMessageLoopEvent event;
- renderer_->Stop(event.GetClosure());
- event.RunAndWait();
- needs_stop_ = false;
+ // Request a Stop() before the flush completes.
+ WaitableMessageLoopEvent stop_event;
+ renderer_->Stop(stop_event.GetClosure());
+ stop_event.RunAndWait();
}
} // namespace media
« no previous file with comments | « media/filters/audio_renderer_impl.cc ('k') | media/filters/decrypting_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698