Commit 2309cfe9 authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Switch to QuitClosure from QuitWhenIdleClosure in pipeline tests.

There's no reason to wait for idleness in these tests, the ended,
error, or seek completion signals should be sufficient to quit
immediately.

BUG=1014646
R=gab

Change-Id: I066c7c5718ee9efeb9ab1ef38fdab642619cb423
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1888830Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710508}
parent 7ae71809
......@@ -293,13 +293,12 @@ PipelineStatus PipelineIntegrationTestBase::StartInternal(
EXPECT_CALL(*this, OnVideoConfigChange(_)).Times(AnyNumber());
base::RunLoop run_loop;
pipeline_->Start(
Pipeline::StartType::kNormal, demuxer_.get(),
renderer_factory_->CreateRenderer(prepend_video_decoders_cb,
prepend_audio_decoders_cb),
this,
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this), run_loop.QuitWhenIdleClosure()));
pipeline_->Start(Pipeline::StartType::kNormal, demuxer_.get(),
renderer_factory_->CreateRenderer(prepend_video_decoders_cb,
prepend_audio_decoders_cb),
this,
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this), run_loop.QuitClosure()));
RunUntilQuitOrEndedOrError(&run_loop);
return pipeline_status_;
}
......@@ -376,7 +375,7 @@ bool PipelineIntegrationTestBase::Suspend() {
base::RunLoop run_loop;
pipeline_->Suspend(base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this),
run_loop.QuitWhenIdleClosure()));
run_loop.QuitClosure()));
RunUntilQuitOrError(&run_loop);
return (pipeline_status_ == PIPELINE_OK);
}
......@@ -434,8 +433,7 @@ bool PipelineIntegrationTestBase::WaitUntilCurrentTimeIsAfter(
task_environment_.GetMainThreadTaskRunner()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask,
base::Unretained(this), wait_time,
run_loop.QuitWhenIdleClosure()),
base::Unretained(this), wait_time, run_loop.QuitClosure()),
base::TimeDelta::FromMilliseconds(10));
RunUntilQuitOrEndedOrError(&run_loop);
......@@ -618,7 +616,7 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource(
source->set_demuxer_failure_cb(
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this), run_loop.QuitWhenIdleClosure()));
base::Unretained(this), run_loop.QuitClosure()));
demuxer_ = source->GetDemuxer();
// DemuxerStreams may signal config changes.
......@@ -642,13 +640,12 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource(
EXPECT_CALL(*this, OnWaiting(WaitingReason::kNoDecryptionKey)).Times(0);
}
pipeline_->Start(
Pipeline::StartType::kNormal, demuxer_.get(),
renderer_factory_->CreateRenderer(CreateVideoDecodersCB(),
CreateAudioDecodersCB()),
this,
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this), run_loop.QuitWhenIdleClosure()));
pipeline_->Start(Pipeline::StartType::kNormal, demuxer_.get(),
renderer_factory_->CreateRenderer(CreateVideoDecodersCB(),
CreateAudioDecodersCB()),
this,
base::Bind(&PipelineIntegrationTestBase::OnStatusCallback,
base::Unretained(this), run_loop.QuitClosure()));
if (encrypted_media) {
source->set_encrypted_media_init_data_cb(
......@@ -667,7 +664,7 @@ PipelineStatus PipelineIntegrationTestBase::StartPipelineWithMediaSource(
void PipelineIntegrationTestBase::RunUntilQuitOrError(base::RunLoop* run_loop) {
// We always install an error handler to avoid test hangs.
on_error_closure_ = run_loop->QuitWhenIdleClosure();
on_error_closure_ = run_loop->QuitClosure();
run_loop->Run();
on_ended_closure_ = base::OnceClosure();
......@@ -680,7 +677,7 @@ void PipelineIntegrationTestBase::RunUntilQuitOrEndedOrError(
DCHECK(on_ended_closure_.is_null());
DCHECK(on_error_closure_.is_null());
on_ended_closure_ = run_loop->QuitWhenIdleClosure();
on_ended_closure_ = run_loop->QuitClosure();
RunUntilQuitOrError(run_loop);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment