Commit 2b9db0f9 authored by Raymond Toy's avatar Raymond Toy Committed by Commit Bot

[Code Health] Replace more PipelineStatusCB in media/base

This replaces PipelineStatusCB with PipelineStatusCallback in the last
places except for error_cb_, which seems like it can be called more
than once in a test.

Bug: 1007799
Change-Id: Ib60a01634267ea4f5313b8ac8f495925a6f3d989
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1993423Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Commit-Queue: Raymond Toy <rtoy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748348}
parent fe20a483
...@@ -80,10 +80,10 @@ base::Closure WaitableMessageLoopEvent::GetClosure() { ...@@ -80,10 +80,10 @@ base::Closure WaitableMessageLoopEvent::GetClosure() {
PIPELINE_OK)); PIPELINE_OK));
} }
PipelineStatusCB WaitableMessageLoopEvent::GetPipelineStatusCB() { PipelineStatusCallback WaitableMessageLoopEvent::GetPipelineStatusCB() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return BindToCurrentLoop(base::Bind( return BindToCurrentLoop(base::BindOnce(&WaitableMessageLoopEvent::OnCallback,
&WaitableMessageLoopEvent::OnCallback, base::Unretained(this))); base::Unretained(this)));
} }
void WaitableMessageLoopEvent::RunAndWait() { void WaitableMessageLoopEvent::RunAndWait() {
......
...@@ -52,7 +52,7 @@ class WaitableMessageLoopEvent { ...@@ -52,7 +52,7 @@ class WaitableMessageLoopEvent {
// Returns a thread-safe closure that will signal |this| when executed. // Returns a thread-safe closure that will signal |this| when executed.
base::Closure GetClosure(); base::Closure GetClosure();
PipelineStatusCB GetPipelineStatusCB(); PipelineStatusCallback GetPipelineStatusCB();
// Runs the current message loop until |this| has been signaled. // Runs the current message loop until |this| has been signaled.
// //
......
...@@ -208,12 +208,13 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient { ...@@ -208,12 +208,13 @@ class AudioRendererImplTest : public ::testing::Test, public RendererClient {
MOCK_METHOD1(OnRemotePlayStateChange, void(MediaStatus::State state)); MOCK_METHOD1(OnRemotePlayStateChange, void(MediaStatus::State state));
void InitializeRenderer(DemuxerStream* demuxer_stream, void InitializeRenderer(DemuxerStream* demuxer_stream,
const PipelineStatusCB& pipeline_status_cb) { PipelineStatusCallback pipeline_status_cb) {
EXPECT_CALL(*this, OnWaiting(_)).Times(0); EXPECT_CALL(*this, OnWaiting(_)).Times(0);
EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(0); EXPECT_CALL(*this, OnVideoNaturalSizeChange(_)).Times(0);
EXPECT_CALL(*this, OnVideoOpacityChange(_)).Times(0); EXPECT_CALL(*this, OnVideoOpacityChange(_)).Times(0);
EXPECT_CALL(*this, OnVideoConfigChange(_)).Times(0); EXPECT_CALL(*this, OnVideoConfigChange(_)).Times(0);
renderer_->Initialize(demuxer_stream, nullptr, this, pipeline_status_cb); renderer_->Initialize(demuxer_stream, nullptr, this,
std::move(pipeline_status_cb));
} }
void Initialize() { void Initialize() {
......
...@@ -222,10 +222,11 @@ class VideoRendererImplTest : public testing::Test { ...@@ -222,10 +222,11 @@ class VideoRendererImplTest : public testing::Test {
SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected)); SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected));
WaitableMessageLoopEvent event; WaitableMessageLoopEvent event;
PipelineStatusCB error_cb = event.GetPipelineStatusCB(); PipelineStatusCallback error_cb = event.GetPipelineStatusCB();
EXPECT_CALL(mock_cb_, OnError(_)) EXPECT_CALL(mock_cb_, OnError(_))
.WillOnce(Invoke( .WillOnce(Invoke([cb = &error_cb](PipelineStatus status) {
[error_cb](PipelineStatus status) { error_cb.Run(status); })); std::move(*cb).Run(status);
}));
event.RunAndWaitForStatus(expected); event.RunAndWaitForStatus(expected);
} }
......
...@@ -192,7 +192,7 @@ class ReusableMessageLoopEvent { ...@@ -192,7 +192,7 @@ class ReusableMessageLoopEvent {
base::RepeatingClosure GetClosure() const { return event_->GetClosure(); } base::RepeatingClosure GetClosure() const { return event_->GetClosure(); }
media::PipelineStatusCB GetPipelineStatusCB() const { media::PipelineStatusCallback GetPipelineStatusCB() const {
return event_->GetPipelineStatusCB(); return event_->GetPipelineStatusCB();
} }
......
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