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

Unified Diff: media/base/pipeline_unittest.cc

Issue 9968117: Move Demuxer::set_host() to Initialize(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: Created 8 years, 9 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 14d39d9f9e9f5028fc9f5ca45c46336825fdf7a5..b3a3baed05e43383c113dba24be411a694f3e746 100644
--- a/media/base/pipeline_unittest.cc
+++ b/media/base/pipeline_unittest.cc
@@ -20,9 +20,9 @@
using ::testing::_;
using ::testing::DeleteArg;
+using ::testing::DoAll;
using ::testing::InSequence;
using ::testing::Invoke;
-using ::testing::InvokeArgument;
using ::testing::Mock;
using ::testing::NotNull;
using ::testing::Return;
@@ -38,6 +38,16 @@ static const int kTotalBytes = 1024;
// Buffered bytes of the data source.
static const int kBufferedBytes = 1024;
+ACTION_P(InitializeDemuxerWithError, error) {
+ arg1.Run(error);
+}
+
+ACTION_P(SetDemuxerProperties, duration) {
+ arg0->SetTotalBytes(kTotalBytes);
+ arg0->SetBufferedBytes(kBufferedBytes);
+ arg0->SetDuration(duration);
+}
+
// Used for setting expectations on pipeline callbacks. Using a StrictMock
// also lets us test for missing callbacks.
class CallbackHelper {
@@ -97,10 +107,9 @@ class PipelineTest : public ::testing::Test {
typedef std::vector<MockDemuxerStream*> MockDemuxerStreamVector;
void InitializeDemuxer(MockDemuxerStreamVector* streams,
const base::TimeDelta& duration) {
- EXPECT_CALL(*mocks_->demuxer(), Initialize(_))
- .WillOnce(Invoke(&RunPipelineStatusCB));
- mocks_->demuxer()->SetTotalAndBufferedBytesAndDuration(
- kTotalBytes, kBufferedBytes, duration);
+ EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _))
+ .WillOnce(DoAll(SetDemuxerProperties(duration),
+ Invoke(&RunPipelineStatusCB2)));
EXPECT_CALL(*mocks_->demuxer(), SetPlaybackRate(0.0f));
EXPECT_CALL(*mocks_->demuxer(), Seek(mocks_->demuxer()->GetStartTime(), _))
.WillOnce(Invoke(&RunPipelineStatusCB2));
@@ -281,7 +290,7 @@ TEST_F(PipelineTest, NotStarted) {
TEST_F(PipelineTest, NeverInitializes) {
// Don't execute the callback passed into Initialize().
- EXPECT_CALL(*mocks_->demuxer(), Initialize(_));
+ EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _));
EXPECT_CALL(*mocks_->demuxer(), Stop(_))
.WillOnce(Invoke(&RunStopFilterCallback));
@@ -322,9 +331,8 @@ TEST_F(PipelineTest, RequiredFilterMissing) {
}
TEST_F(PipelineTest, URLNotFound) {
- EXPECT_CALL(*mocks_->demuxer(), Initialize(_))
- .WillOnce(RunPipelineStatusCBWithError(
- PIPELINE_ERROR_URL_NOT_FOUND));
+ EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _))
+ .WillOnce(InitializeDemuxerWithError(PIPELINE_ERROR_URL_NOT_FOUND));
EXPECT_CALL(*mocks_->demuxer(), Stop(_))
.WillOnce(Invoke(&RunStopFilterCallback));
@@ -333,8 +341,8 @@ TEST_F(PipelineTest, URLNotFound) {
}
TEST_F(PipelineTest, NoStreams) {
- EXPECT_CALL(*mocks_->demuxer(), Initialize(_))
- .WillOnce(Invoke(&RunPipelineStatusCB));
+ EXPECT_CALL(*mocks_->demuxer(), Initialize(_, _))
+ .WillOnce(Invoke(&RunPipelineStatusCB2));
EXPECT_CALL(*mocks_->demuxer(), Stop(_))
.WillOnce(Invoke(&RunStopFilterCallback));

Powered by Google App Engine
This is Rietveld 408576698