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

Unified Diff: content/renderer/media/rtc_video_decoder_unittest.cc

Issue 10918172: Remove VideoDecoder::PrepareForShutdownHack() and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: blah Created 8 years, 3 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 | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/rtc_video_decoder_unittest.cc
diff --git a/content/renderer/media/rtc_video_decoder_unittest.cc b/content/renderer/media/rtc_video_decoder_unittest.cc
index 726c2e46f7b8fb969919a50077e9d7438992381e..0aacdab8dfa4e768f8fb1a4d94fced57f5417ea6 100644
--- a/content/renderer/media/rtc_video_decoder_unittest.cc
+++ b/content/renderer/media/rtc_video_decoder_unittest.cc
@@ -195,11 +195,9 @@ class RTCVideoDecoderTest : public testing::Test {
}
virtual void TearDown() OVERRIDE {
- EXPECT_CALL(*video_track_, RemoveRenderer(decoder_.get()));
- decoder_->Stop(media::NewExpectedClosure());
-
- message_loop_.RunAllPending();
- EXPECT_EQ(RTCVideoDecoder::kStopped, decoder_->state_);
+ if (decoder_->state_ == RTCVideoDecoder::kStopped)
+ return;
+ Stop();
}
void InitializeDecoderSuccessfully() {
@@ -210,6 +208,14 @@ class RTCVideoDecoderTest : public testing::Test {
message_loop_.RunAllPending();
}
+ void Stop() {
+ EXPECT_CALL(*video_track_, RemoveRenderer(decoder_.get()));
+ decoder_->Stop(media::NewExpectedClosure());
+
+ message_loop_.RunAllPending();
+ EXPECT_EQ(RTCVideoDecoder::kStopped, decoder_->state_);
+ }
+
StatisticsCB NewStatisticsCB() {
return base::Bind(&MockStatisticsCB::OnStatistics,
base::Unretained(&statistics_cb_));
@@ -307,12 +313,13 @@ TEST_F(RTCVideoDecoderTest, ReadAndShutdown) {
InitializeDecoderSuccessfully();
EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
- scoped_refptr<media::VideoFrame>())).Times(2);
- decoder_->Read(read_cb_);
- EXPECT_FALSE(decoder_->shutting_down_);
- decoder_->PrepareForShutdownHack();
- EXPECT_TRUE(decoder_->shutting_down_);
+ scoped_refptr<media::VideoFrame>()));
decoder_->Read(read_cb_);
+ Stop();
+ // Any read after stopping should be immediately satisfied.
+ EXPECT_CALL(*this, FrameReady(media::VideoDecoder::kOk,
+ scoped_refptr<media::VideoFrame>()));
+ decoder_->Read(read_cb_);
message_loop_.RunAllPending();
}
« no previous file with comments | « content/renderer/media/rtc_video_decoder.cc ('k') | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698