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

Unified Diff: media/base/pipeline_unittest.cc

Issue 10796074: Move VideoRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 8 years, 5 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
Index: media/base/pipeline_unittest.cc
diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc
index b3ae483cd9196cab2ad55088e0c0ba5c9e3ff19e..187e0c461cb8a34c148227f16fbf06fb81e14820 100644
--- a/media/base/pipeline_unittest.cc
+++ b/media/base/pipeline_unittest.cc
@@ -9,8 +9,6 @@
#include "base/stl_util.h"
#include "base/threading/simple_thread.h"
#include "media/base/clock.h"
-#include "media/base/filter_host.h"
-#include "media/base/filters.h"
#include "media/base/media_log.h"
#include "media/base/pipeline.h"
#include "media/base/mock_callback.h"
@@ -180,9 +178,9 @@ class PipelineTest : public ::testing::Test {
// Sets up expectations to allow the video renderer to initialize.
void InitializeVideoRenderer() {
- EXPECT_CALL(*mocks_->video_renderer(), SetHost(NotNull()));
EXPECT_CALL(*mocks_->video_renderer(), Initialize(
- scoped_refptr<VideoDecoder>(mocks_->video_decoder()), _, _, _))
+ scoped_refptr<VideoDecoder>(mocks_->video_decoder()),
+ _, _, _, _, _, _, _, _))
.WillOnce(RunPipelineStatusCB1());
EXPECT_CALL(*mocks_->video_renderer(), SetPlaybackRate(0.0f));
@@ -585,8 +583,7 @@ TEST_F(PipelineTest, DisableAudioRenderer) {
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(callbacks_, OnEnded(PIPELINE_OK));
- FilterHost* host = pipeline_;
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
}
TEST_F(PipelineTest, DisableAudioRendererDuringInit) {
@@ -614,8 +611,7 @@ TEST_F(PipelineTest, DisableAudioRendererDuringInit) {
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(callbacks_, OnEnded(PIPELINE_OK));
- FilterHost* host = pipeline_;
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
}
TEST_F(PipelineTest, EndedCallback) {
@@ -632,27 +628,24 @@ TEST_F(PipelineTest, EndedCallback) {
InitializeVideoRenderer();
InitializePipeline(PIPELINE_OK);
- // For convenience to simulate filters calling the methods.
- FilterHost* host = pipeline_;
-
// Due to short circuit evaluation we only need to test a subset of cases.
InSequence s;
EXPECT_CALL(*mocks_->audio_renderer(), HasEnded())
.WillOnce(Return(false));
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
EXPECT_CALL(*mocks_->audio_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(false));
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
EXPECT_CALL(*mocks_->audio_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(callbacks_, OnEnded(PIPELINE_OK));
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
}
// Static function & time variable used to simulate changes in wallclock time.
@@ -681,10 +674,7 @@ TEST_F(PipelineTest, AudioStreamShorterThanVideo) {
InitializeVideoRenderer();
InitializePipeline(PIPELINE_OK);
- // For convenience to simulate filters calling the methods.
- FilterHost* host = pipeline_;
-
- EXPECT_EQ(0, host->GetTime().ToInternalValue());
+ EXPECT_EQ(0, pipeline_->GetCurrentTime().ToInternalValue());
float playback_rate = 1.0f;
EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(playback_rate));
@@ -697,24 +687,24 @@ TEST_F(PipelineTest, AudioStreamShorterThanVideo) {
// Verify that the clock doesn't advance since it hasn't been started by
// a time update from the audio stream.
- int64 start_time = host->GetTime().ToInternalValue();
+ int64 start_time = pipeline_->GetCurrentTime().ToInternalValue();
g_static_clock_time +=
base::TimeDelta::FromMilliseconds(100).ToInternalValue();
- EXPECT_EQ(host->GetTime().ToInternalValue(), start_time);
+ EXPECT_EQ(pipeline_->GetCurrentTime().ToInternalValue(), start_time);
// Signal end of audio stream.
EXPECT_CALL(*mocks_->audio_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(false));
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
message_loop_.RunAllPending();
// Verify that the clock advances.
- start_time = host->GetTime().ToInternalValue();
+ start_time = pipeline_->GetCurrentTime().ToInternalValue();
g_static_clock_time +=
base::TimeDelta::FromMilliseconds(100).ToInternalValue();
- EXPECT_GT(host->GetTime().ToInternalValue(), start_time);
+ EXPECT_GT(pipeline_->GetCurrentTime().ToInternalValue(), start_time);
// Signal end of video stream and make sure OnEnded() callback occurs.
EXPECT_CALL(*mocks_->audio_renderer(), HasEnded())
@@ -722,7 +712,7 @@ TEST_F(PipelineTest, AudioStreamShorterThanVideo) {
EXPECT_CALL(*mocks_->video_renderer(), HasEnded())
.WillOnce(Return(true));
EXPECT_CALL(callbacks_, OnEnded(PIPELINE_OK));
- host->NotifyEnded();
+ pipeline_->OnRendererEnded();
}
TEST_F(PipelineTest, ErrorDuringSeek) {

Powered by Google App Engine
This is Rietveld 408576698