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

Unified Diff: media/test/pipeline_integration_test_base.cc

Issue 2479633002: Fix pipeline integration tests for seek / duration changes. (Closed)
Patch Set: Created 4 years, 1 month 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/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test_base.cc
diff --git a/media/test/pipeline_integration_test_base.cc b/media/test/pipeline_integration_test_base.cc
index 72ecf7da6d873b13f336eb8ccae9da6345467096..42b43f3d3347f4fe585be949bf688a537c0f348b 100644
--- a/media/test/pipeline_integration_test_base.cc
+++ b/media/test/pipeline_integration_test_base.cc
@@ -50,7 +50,8 @@ PipelineIntegrationTestBase::PipelineIntegrationTestBase()
ended_(false),
pipeline_status_(PIPELINE_OK),
last_video_frame_format_(PIXEL_FORMAT_UNKNOWN),
- last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED) {
+ last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED),
+ current_duration_(kInfiniteDuration) {
ResetVideoHash();
}
@@ -143,7 +144,13 @@ PipelineStatus PipelineIntegrationTestBase::StartInternal(
.Times(AnyNumber());
EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_NOTHING))
.Times(AnyNumber());
- EXPECT_CALL(*this, OnDurationChange()).Times(AtMost(1));
+ // Permit at most two calls to OnDurationChange. CheckDuration will make sure
+ // that no more than one of them is a finite duration. This allows the
+ // pipeline to call back at the end of the media with the known duration.
+ EXPECT_CALL(*this, OnDurationChange())
+ .Times(AtMost(2))
+ .WillRepeatedly(
+ Invoke(this, &PipelineIntegrationTestBase::CheckDuration));
EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(AtMost(1));
EXPECT_CALL(*this, OnVideoOpacityChange(_)).Times(AtMost(1));
CreateDemuxer(std::move(data_source));
@@ -392,6 +399,18 @@ void PipelineIntegrationTestBase::OnVideoFramePaint(
VideoFrame::HashFrameForTesting(&md5_context_, frame);
}
+void PipelineIntegrationTestBase::CheckDuration() {
+ // Allow the pipeline to specify indefinite duration, then reduce it once
+ // it becomes known.
+ ASSERT_EQ(kInfiniteDuration, current_duration_);
+ base::TimeDelta new_duration = pipeline_->GetMediaDuration();
+ current_duration_ = new_duration;
+}
+
+base::TimeDelta PipelineIntegrationTestBase::GetStartTime() {
+ return demuxer_->GetStartTime();
+}
+
void PipelineIntegrationTestBase::ResetVideoHash() {
DVLOG(1) << __FUNCTION__;
base::MD5Init(&md5_context_);
« no previous file with comments | « media/test/pipeline_integration_test_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698