| Index: media/base/pipeline_unittest.cc
|
| diff --git a/media/base/pipeline_unittest.cc b/media/base/pipeline_unittest.cc
|
| index 725695f966f272c490463027fa20e4f087e6aecf..778a036daa7ffa5d7d505578ed7e688a6f8e7292 100644
|
| --- a/media/base/pipeline_unittest.cc
|
| +++ b/media/base/pipeline_unittest.cc
|
| @@ -105,28 +105,16 @@ class PipelineTest : public ::testing::Test {
|
| }
|
|
|
| virtual ~PipelineTest() {
|
| - // Shutdown sequence.
|
| - if (pipeline_->IsRunning()) {
|
| - EXPECT_CALL(*demuxer_, Stop(_))
|
| - .WillOnce(RunClosure<0>());
|
| + if (!pipeline_ || !pipeline_->IsRunning())
|
| + return;
|
|
|
| - if (audio_stream_)
|
| - EXPECT_CALL(*audio_renderer_, Stop(_))
|
| - .WillOnce(RunClosure<0>());
|
| -
|
| - if (video_stream_)
|
| - EXPECT_CALL(*video_renderer_, Stop(_))
|
| - .WillOnce(RunClosure<0>());
|
| - }
|
| + ExpectStop();
|
|
|
| // Expect a stop callback if we were started.
|
| EXPECT_CALL(callbacks_, OnStop());
|
| pipeline_->Stop(base::Bind(&CallbackHelper::OnStop,
|
| base::Unretained(&callbacks_)));
|
| message_loop_.RunUntilIdle();
|
| -
|
| - filter_collection_.reset();
|
| - pipeline_.reset();
|
| }
|
|
|
| protected:
|
| @@ -285,6 +273,17 @@ class PipelineTest : public ::testing::Test {
|
| EXPECT_EQ(seek_time, pipeline_->GetMediaTime());
|
| }
|
|
|
| + void ExpectStop() {
|
| + if (demuxer_)
|
| + EXPECT_CALL(*demuxer_, Stop(_)).WillOnce(RunClosure<0>());
|
| +
|
| + if (audio_stream_)
|
| + EXPECT_CALL(*audio_renderer_, Stop(_)).WillOnce(RunClosure<0>());
|
| +
|
| + if (video_stream_)
|
| + EXPECT_CALL(*video_renderer_, Stop(_)).WillOnce(RunClosure<0>());
|
| + }
|
| +
|
| // Fixture members.
|
| StrictMock<CallbackHelper> callbacks_;
|
| base::SimpleTestClock test_clock_;
|
| @@ -836,6 +835,25 @@ TEST_F(PipelineTest, AudioTimeUpdateDuringSeek) {
|
| EXPECT_EQ(pipeline_->GetMediaTime(), new_time);
|
| }
|
|
|
| +static void DeletePipeline(scoped_ptr<Pipeline> pipeline) {
|
| + // |pipeline| will go out of scope.
|
| +}
|
| +
|
| +TEST_F(PipelineTest, DeleteAfterStop) {
|
| + CreateAudioStream();
|
| + MockDemuxerStreamVector streams;
|
| + streams.push_back(audio_stream());
|
| + InitializeDemuxer(&streams);
|
| + InitializeAudioRenderer(audio_stream(), false);
|
| + InitializePipeline(PIPELINE_OK);
|
| +
|
| + ExpectStop();
|
| +
|
| + Pipeline* pipeline = pipeline_.get();
|
| + pipeline->Stop(base::Bind(&DeletePipeline, base::Passed(&pipeline_)));
|
| + message_loop_.RunUntilIdle();
|
| +}
|
| +
|
| class PipelineTeardownTest : public PipelineTest {
|
| public:
|
| enum TeardownState {
|
|
|