summaryrefslogtreecommitdiff
path: root/chromium/media/base/pipeline_impl_unittest.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-12 15:59:20 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-25 06:57:22 +0000
commitf7eaed5286974984ba5f9e3189d8f49d03e99f81 (patch)
treecaed19b2af2024f35449fb0b781d0a25e09d4f8f /chromium/media/base/pipeline_impl_unittest.cc
parent9729c4479fe23554eae6e6dd1f30ff488f470c84 (diff)
downloadqtwebengine-chromium-f7eaed5286974984ba5f9e3189d8f49d03e99f81.tar.gz
BASELINE: Update Chromium to 100.0.4896.167
Change-Id: I98cbeb5d7543d966ffe04d8cefded0c493a11333 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/base/pipeline_impl_unittest.cc')
-rw-r--r--chromium/media/base/pipeline_impl_unittest.cc49
1 files changed, 28 insertions, 21 deletions
diff --git a/chromium/media/base/pipeline_impl_unittest.cc b/chromium/media/base/pipeline_impl_unittest.cc
index a38d6d74757..07c95300f21 100644
--- a/chromium/media/base/pipeline_impl_unittest.cc
+++ b/chromium/media/base/pipeline_impl_unittest.cc
@@ -189,6 +189,7 @@ class PipelineImplTest : public ::testing::Test {
void SetRendererPostStartExpectations() {
EXPECT_CALL(*renderer_, SetPlaybackRate(0.0));
EXPECT_CALL(*renderer_, SetVolume(1.0f));
+ EXPECT_CALL(*renderer_, SetWasPlayedWithUserActivation(false));
EXPECT_CALL(*renderer_, StartPlayingFrom(start_time_))
.WillOnce(SetBufferingState(&renderer_client_, BUFFERING_HAVE_ENOUGH,
BUFFERING_CHANGE_REASON_UNKNOWN));
@@ -209,7 +210,7 @@ class PipelineImplTest : public ::testing::Test {
PipelineStatus start_status,
Pipeline::StartType start_type = Pipeline::StartType::kNormal,
PostStartStatus post_start_status = PostStartStatus::kNormal) {
- EXPECT_CALL(callbacks_, OnStart(start_status));
+ EXPECT_CALL(callbacks_, OnStart(SameStatusCode(start_status)));
if (start_status == PIPELINE_OK) {
EXPECT_CALL(callbacks_, OnMetadata(_)).WillOnce(SaveArg<0>(&metadata_));
@@ -272,7 +273,7 @@ class PipelineImplTest : public ::testing::Test {
BUFFERING_CHANGE_REASON_UNKNOWN));
// We expect a successful seek callback followed by a buffering update.
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_OK)));
EXPECT_CALL(callbacks_,
OnBufferingStateChange(BUFFERING_HAVE_ENOUGH,
BUFFERING_CHANGE_REASON_UNKNOWN));
@@ -287,7 +288,7 @@ class PipelineImplTest : public ::testing::Test {
void ExpectSuspend() {
EXPECT_CALL(*demuxer_, AbortPendingReads());
EXPECT_CALL(*renderer_, SetPlaybackRate(0));
- EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnSuspend(HasStatusCode(PIPELINE_OK)));
}
void DoSuspend() {
@@ -315,13 +316,14 @@ class PipelineImplTest : public ::testing::Test {
.WillOnce(RunOnceCallback<1>(PIPELINE_OK));
EXPECT_CALL(*renderer_, SetPlaybackRate(_));
EXPECT_CALL(*renderer_, SetVolume(_));
+ EXPECT_CALL(*renderer_, SetWasPlayedWithUserActivation(false));
EXPECT_CALL(*renderer_, StartPlayingFrom(seek_time))
.WillOnce(SetBufferingState(&renderer_client_, BUFFERING_HAVE_ENOUGH,
BUFFERING_CHANGE_REASON_UNKNOWN));
EXPECT_CALL(callbacks_,
OnBufferingStateChange(BUFFERING_HAVE_ENOUGH,
BUFFERING_CHANGE_REASON_UNKNOWN));
- EXPECT_CALL(callbacks_, OnResume(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnResume(HasStatusCode(PIPELINE_OK)));
}
void DoResume(const base::TimeDelta& seek_time) {
@@ -552,7 +554,7 @@ TEST_F(PipelineImplTest, EncryptedStream_SetCdmAfterStart) {
run_loop.Run();
ExpectRendererInitialization();
- EXPECT_CALL(callbacks_, OnStart(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnStart(HasStatusCode(PIPELINE_OK)));
SetRendererPostStartExpectations();
SetCdmAndExpect(true);
}
@@ -583,7 +585,7 @@ TEST_F(PipelineImplTest, SeekAfterError) {
OnDemuxerError();
base::RunLoop().RunUntilIdle();
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_INVALID_STATE));
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_ERROR_INVALID_STATE)));
pipeline_->Seek(
base::Milliseconds(100),
base::BindOnce(&CallbackHelper::OnSeek, base::Unretained(&callbacks_)));
@@ -646,7 +648,8 @@ TEST_F(PipelineImplTest, SetVolumeDuringStartup) {
// The audio renderer should receive two calls to SetVolume().
float expected = 0.5f;
EXPECT_CALL(*renderer_, SetVolume(expected)).Times(2);
- EXPECT_CALL(callbacks_, OnStart(PIPELINE_OK));
+ EXPECT_CALL(*renderer_, SetWasPlayedWithUserActivation(false));
+ EXPECT_CALL(callbacks_, OnStart(HasStatusCode(PIPELINE_OK)));
EXPECT_CALL(callbacks_, OnMetadata(_))
.WillOnce(RunOnceClosure(base::BindOnce(&PipelineImpl::SetVolume,
base::Unretained(pipeline_.get()),
@@ -791,7 +794,7 @@ TEST_F(PipelineImplTest, DemuxerErrorDuringSeek) {
pipeline_->Seek(seek_time, base::BindOnce(&CallbackHelper::OnSeek,
base::Unretained(&callbacks_)));
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ))
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_ERROR_READ)))
.WillOnce(Stop(pipeline_.get()));
base::RunLoop().RunUntilIdle();
}
@@ -810,7 +813,7 @@ TEST_F(PipelineImplTest, PipelineErrorDuringSeek) {
EXPECT_CALL(*demuxer_, AbortPendingReads());
EXPECT_CALL(*demuxer_, OnSeek(seek_time, _))
.WillOnce(RunOnceCallback<1>(PIPELINE_OK));
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_DECODE));
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_ERROR_DECODE)));
// Triggers pipeline error during pending seek.
pipeline_->Seek(seek_time, base::BindOnce(&CallbackHelper::OnSeek,
@@ -827,7 +830,7 @@ TEST_F(PipelineImplTest, PipelineErrorDuringSuspend) {
// Set expectations for suspend.
EXPECT_CALL(*demuxer_, AbortPendingReads());
EXPECT_CALL(*renderer_, SetPlaybackRate(0));
- EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_ERROR_DECODE));
+ EXPECT_CALL(callbacks_, OnSuspend(HasStatusCode(PIPELINE_ERROR_DECODE)));
// Triggers pipeline error during pending suspend. The order matters for
// reproducing crbug.com/1250636. Otherwise OnError() is ignored if already in
@@ -939,7 +942,7 @@ TEST_F(PipelineImplTest, RendererErrorsReset) {
StartPipelineAndExpect(PIPELINE_OK);
// Trigger two errors. The second error will be ignored.
- EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_READ)).Times(1);
+ EXPECT_CALL(callbacks_, OnError(HasStatusCode(PIPELINE_ERROR_READ))).Times(1);
renderer_client_->OnError(PIPELINE_ERROR_READ);
renderer_client_->OnError(PIPELINE_ERROR_READ);
@@ -956,7 +959,7 @@ TEST_F(PipelineImplTest, RendererErrorsReset) {
StartPipelineAndExpect(PIPELINE_OK);
// New errors should propagate and not be ignored.
- EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_READ)).Times(1);
+ EXPECT_CALL(callbacks_, OnError(HasStatusCode(PIPELINE_ERROR_READ))).Times(1);
renderer_client_->OnError(PIPELINE_ERROR_READ);
base::RunLoop().RunUntilIdle();
@@ -1036,7 +1039,8 @@ class PipelineTeardownTest : public PipelineImplTest {
} else {
EXPECT_CALL(*demuxer_, OnInitialize(_, _))
.WillOnce(PostCallback<1>(DEMUXER_ERROR_COULD_NOT_OPEN));
- EXPECT_CALL(callbacks_, OnStart(DEMUXER_ERROR_COULD_NOT_OPEN))
+ EXPECT_CALL(callbacks_,
+ OnStart(HasStatusCode(DEMUXER_ERROR_COULD_NOT_OPEN)))
.WillOnce(Stop(pipeline_.get()));
}
@@ -1048,6 +1052,7 @@ class PipelineTeardownTest : public PipelineImplTest {
CreateVideoStream();
SetDemuxerExpectations(base::Seconds(3000));
EXPECT_CALL(*renderer_, SetVolume(1.0f));
+ EXPECT_CALL(*renderer_, SetWasPlayedWithUserActivation(false));
if (state == kInitRenderer) {
if (stop_or_error == kStop) {
@@ -1058,7 +1063,9 @@ class PipelineTeardownTest : public PipelineImplTest {
} else {
EXPECT_CALL(*renderer_, OnInitialize(_, _, _))
.WillOnce(PostCallback<2>(PIPELINE_ERROR_INITIALIZATION_FAILED));
- EXPECT_CALL(callbacks_, OnStart(PIPELINE_ERROR_INITIALIZATION_FAILED))
+ EXPECT_CALL(
+ callbacks_,
+ OnStart(HasStatusCode(PIPELINE_ERROR_INITIALIZATION_FAILED)))
.WillOnce(Stop(pipeline_.get()));
}
@@ -1072,7 +1079,7 @@ class PipelineTeardownTest : public PipelineImplTest {
DoAll(SaveArg<1>(&renderer_client_), PostCallback<2>(PIPELINE_OK)));
// If we get here it's a successful initialization.
- EXPECT_CALL(callbacks_, OnStart(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnStart(HasStatusCode(PIPELINE_OK)));
EXPECT_CALL(callbacks_, OnMetadata(_));
EXPECT_CALL(*renderer_, SetPlaybackRate(0.0));
@@ -1108,7 +1115,7 @@ class PipelineTeardownTest : public PipelineImplTest {
EXPECT_CALL(*renderer_, OnFlush(_))
.WillOnce(DoAll(SetError(&renderer_client_, PIPELINE_ERROR_READ),
RunOnceClosure<0>()));
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ))
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_ERROR_READ)))
.WillOnce(Stop(pipeline_.get()));
}
return;
@@ -1125,7 +1132,7 @@ class PipelineTeardownTest : public PipelineImplTest {
} else {
EXPECT_CALL(*demuxer_, OnSeek(_, _))
.WillOnce(RunOnceCallback<1>(PIPELINE_ERROR_READ));
- EXPECT_CALL(callbacks_, OnSeek(PIPELINE_ERROR_READ))
+ EXPECT_CALL(callbacks_, OnSeek(HasStatusCode(PIPELINE_ERROR_READ)))
.WillOnce(Stop(pipeline_.get()));
}
return;
@@ -1156,7 +1163,7 @@ class PipelineTeardownTest : public PipelineImplTest {
void SetSuspendExpectations(TeardownState state, StopOrError stop_or_error) {
EXPECT_CALL(*renderer_, SetPlaybackRate(0));
EXPECT_CALL(*demuxer_, AbortPendingReads());
- EXPECT_CALL(callbacks_, OnSuspend(PIPELINE_OK));
+ EXPECT_CALL(callbacks_, OnSuspend(HasStatusCode(PIPELINE_OK)));
if (state == kResuming) {
if (stop_or_error == kStop) {
EXPECT_CALL(*demuxer_, OnSeek(_, _))
@@ -1166,7 +1173,7 @@ class PipelineTeardownTest : public PipelineImplTest {
} else {
EXPECT_CALL(*demuxer_, OnSeek(_, _))
.WillOnce(RunOnceCallback<1>(PIPELINE_ERROR_READ));
- EXPECT_CALL(callbacks_, OnResume(PIPELINE_ERROR_READ))
+ EXPECT_CALL(callbacks_, OnResume(HasStatusCode(PIPELINE_ERROR_READ)))
.WillOnce(Stop(pipeline_.get()));
}
} else if (state != kSuspended && state != kSuspending) {
@@ -1184,7 +1191,7 @@ class PipelineTeardownTest : public PipelineImplTest {
case kError:
if (expect_errors) {
EXPECT_CALL(*demuxer_, Stop());
- EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_READ))
+ EXPECT_CALL(callbacks_, OnError(HasStatusCode(PIPELINE_ERROR_READ)))
.WillOnce(Stop(pipeline_.get()));
}
renderer_client_->OnError(PIPELINE_ERROR_READ);
@@ -1193,7 +1200,7 @@ class PipelineTeardownTest : public PipelineImplTest {
case kErrorAndStop:
EXPECT_CALL(*demuxer_, Stop());
if (expect_errors)
- EXPECT_CALL(callbacks_, OnError(PIPELINE_ERROR_READ));
+ EXPECT_CALL(callbacks_, OnError(HasStatusCode(PIPELINE_ERROR_READ)));
renderer_client_->OnError(PIPELINE_ERROR_READ);
base::RunLoop().RunUntilIdle();
pipeline_->Stop();