Remove MessageLoop references in ipc_test_base.*
MessageLoop is going away soon. Bug: 891670 Change-Id: I98905417dc914afd4fcc0640ace29b88fc591f8b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1964497 Reviewed-by: Ken Rockot <rockot@google.com> Commit-Queue: Carlos Caballero <carlscab@google.com> Cr-Commit-Position: refs/heads/master@{#724573}
This commit is contained in:

committed by
Commit Bot

parent
cf567be69f
commit
f8599f0128
@ -4,11 +4,13 @@
|
||||
|
||||
#include "ipc/ipc_test_base.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/run_loop.h"
|
||||
#include "base/single_thread_task_runner.h"
|
||||
#include "base/test/task_environment.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "ipc/ipc_channel_mojo.h"
|
||||
@ -17,15 +19,9 @@ IPCChannelMojoTestBase::IPCChannelMojoTestBase() = default;
|
||||
IPCChannelMojoTestBase::~IPCChannelMojoTestBase() = default;
|
||||
|
||||
void IPCChannelMojoTestBase::Init(const std::string& test_client_name) {
|
||||
InitWithCustomMessageLoop(test_client_name,
|
||||
std::make_unique<base::MessageLoop>());
|
||||
}
|
||||
|
||||
void IPCChannelMojoTestBase::InitWithCustomMessageLoop(
|
||||
const std::string& test_client_name,
|
||||
std::unique_ptr<base::MessageLoop> message_loop) {
|
||||
handle_ = helper_.StartChild(test_client_name);
|
||||
message_loop_ = std::move(message_loop);
|
||||
task_environment_ =
|
||||
std::make_unique<base::test::SingleThreadTaskEnvironment>();
|
||||
}
|
||||
|
||||
bool IPCChannelMojoTestBase::WaitForClientShutdown() {
|
||||
@ -33,7 +29,7 @@ bool IPCChannelMojoTestBase::WaitForClientShutdown() {
|
||||
}
|
||||
|
||||
void IPCChannelMojoTestBase::TearDown() {
|
||||
if (message_loop_)
|
||||
if (task_environment_)
|
||||
base::RunLoop().RunUntilIdle();
|
||||
}
|
||||
|
||||
|
@ -19,19 +19,12 @@
|
||||
#include "mojo/core/test/mojo_test_base.h"
|
||||
#include "mojo/core/test/multiprocess_test_helper.h"
|
||||
|
||||
namespace base {
|
||||
class MessageLoop;
|
||||
}
|
||||
|
||||
class IPCChannelMojoTestBase : public testing::Test {
|
||||
public:
|
||||
IPCChannelMojoTestBase();
|
||||
~IPCChannelMojoTestBase() override;
|
||||
|
||||
void Init(const std::string& test_client_name);
|
||||
void InitWithCustomMessageLoop(
|
||||
const std::string& test_client_name,
|
||||
std::unique_ptr<base::MessageLoop> message_loop);
|
||||
|
||||
bool WaitForClientShutdown();
|
||||
|
||||
@ -51,7 +44,7 @@ class IPCChannelMojoTestBase : public testing::Test {
|
||||
mojo::ScopedMessagePipeHandle TakeHandle();
|
||||
|
||||
private:
|
||||
std::unique_ptr<base::MessageLoop> message_loop_;
|
||||
std::unique_ptr<base::test::SingleThreadTaskEnvironment> task_environment_;
|
||||
|
||||
mojo::ScopedMessagePipeHandle handle_;
|
||||
mojo::core::test::MultiprocessTestHelper helper_;
|
||||
|
Reference in New Issue
Block a user