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

Unified Diff: media/base/pipeline_unittest.cc

Issue 15993018: Reland: Use a shared thread for media operations (round 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 6 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/base/pipeline.cc ('k') | webkit/mocks/test_media_stream_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « media/base/pipeline.cc ('k') | webkit/mocks/test_media_stream_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698