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

Unified Diff: media/renderers/renderer_impl_unittest.cc

Issue 2199913002: Notify demux stream clients when a stream is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't pass DemuxerStream into the status callback Created 4 years, 4 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/renderers/renderer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/renderers/renderer_impl_unittest.cc
diff --git a/media/renderers/renderer_impl_unittest.cc b/media/renderers/renderer_impl_unittest.cc
index 62d6f85595fb5251bcfebf44b1bbe124101182b5..1a280e19fcbb4164c1804fa78159a389954fcfd8 100644
--- a/media/renderers/renderer_impl_unittest.cc
+++ b/media/renderers/renderer_impl_unittest.cc
@@ -87,7 +87,8 @@ class RendererImplTest : public ::testing::Test {
DemuxerStream::Type type) {
std::unique_ptr<StrictMock<MockDemuxerStream>> stream(
new StrictMock<MockDemuxerStream>(type));
- EXPECT_CALL(*stream, SetStreamRestartedCB(_)).Times(testing::AnyNumber());
+ EXPECT_CALL(*stream, SetStreamStatusChangeCB(_))
+ .Times(testing::AnyNumber());
return stream;
}
@@ -713,4 +714,31 @@ TEST_F(RendererImplTest, VideoUnderflowWithAudioFlush) {
base::RunLoop().RunUntilIdle();
}
+TEST_F(RendererImplTest, StreamStatusNotificationHandling) {
+ CreateAudioAndVideoStream();
+
+ DemuxerStream::StreamStatusChangeCB audio_stream_status_change_cb;
+ DemuxerStream::StreamStatusChangeCB video_stream_status_change_cb;
+ EXPECT_CALL(*audio_stream_, SetStreamStatusChangeCB(_))
+ .WillOnce(SaveArg<0>(&audio_stream_status_change_cb));
+ EXPECT_CALL(*video_stream_, SetStreamStatusChangeCB(_))
+ .WillOnce(SaveArg<0>(&video_stream_status_change_cb));
+ SetAudioRendererInitializeExpectations(PIPELINE_OK);
+ SetVideoRendererInitializeExpectations(PIPELINE_OK);
+ InitializeAndExpect(PIPELINE_OK);
+ Play();
+
+ // Verify that DemuxerStream status changes cause the corresponding
+ // audio/video renderer to be flushed and restarted.
+ base::TimeDelta time0;
+ EXPECT_CALL(time_source_, StopTicking());
+ EXPECT_CALL(*audio_renderer_, Flush(_)).WillOnce(RunClosure<0>());
+ EXPECT_CALL(*audio_renderer_, StartPlaying()).Times(1);
+ audio_stream_status_change_cb.Run(false, time0);
+
+ EXPECT_CALL(*video_renderer_, Flush(_)).WillOnce(RunClosure<0>());
+ EXPECT_CALL(*video_renderer_, StartPlayingFrom(_)).Times(1);
+ video_stream_status_change_cb.Run(false, time0);
+}
+
} // namespace media
« no previous file with comments | « media/renderers/renderer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698