| Index: ipc/ipc_channel_mojo_unittest.cc
|
| diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc
|
| index 041672023a6a84f173bc45e4c82c27d7ab6b89d2..f7652e7156c6d2eab2c4480e58a0a7c511ba07f9 100644
|
| --- a/ipc/ipc_channel_mojo_unittest.cc
|
| +++ b/ipc/ipc_channel_mojo_unittest.cc
|
| @@ -758,6 +758,10 @@ class IPCChannelProxyMojoTest : public IPCChannelMojoTestBase {
|
| }
|
| void CreateProxy(IPC::Listener* listener) { runner_->CreateProxy(listener); }
|
| void RunProxy() { runner_->RunProxy(); }
|
| + void DestroyProxy() {
|
| + runner_.reset();
|
| + base::RunLoop().RunUntilIdle();
|
| + }
|
|
|
| IPC::ChannelProxy* proxy() { return runner_->proxy(); }
|
|
|
| @@ -808,6 +812,7 @@ class ListenerWithSimpleProxyAssociatedInterface
|
| void RequestQuit(const RequestQuitCallback& callback) override {
|
| received_quit_ = true;
|
| callback.Run();
|
| + binding_.Close();
|
| base::MessageLoop::current()->QuitWhenIdle();
|
| }
|
|
|
| @@ -838,7 +843,7 @@ TEST_F(IPCChannelProxyMojoTest, ProxyThreadAssociatedInterface) {
|
| EXPECT_TRUE(WaitForClientShutdown());
|
| EXPECT_TRUE(listener.received_all_messages());
|
|
|
| - base::RunLoop().RunUntilIdle();
|
| + DestroyProxy();
|
| }
|
|
|
| class ChannelProxyClient {
|
| @@ -848,6 +853,10 @@ class ChannelProxyClient {
|
| }
|
| void CreateProxy(IPC::Listener* listener) { runner_->CreateProxy(listener); }
|
| void RunProxy() { runner_->RunProxy(); }
|
| + void DestroyProxy() {
|
| + runner_.reset();
|
| + base::RunLoop().RunUntilIdle();
|
| + }
|
|
|
| IPC::ChannelProxy* proxy() { return runner_->proxy(); }
|
|
|
| @@ -856,26 +865,17 @@ class ChannelProxyClient {
|
| std::unique_ptr<ChannelProxyRunner> runner_;
|
| };
|
|
|
| -class ListenerThatWaitsForConnect : public IPC::Listener {
|
| +class DummyListener : public IPC::Listener {
|
| public:
|
| - explicit ListenerThatWaitsForConnect(const base::Closure& connect_handler)
|
| - : connect_handler_(connect_handler) {}
|
| -
|
| // IPC::Listener
|
| bool OnMessageReceived(const IPC::Message& message) override { return true; }
|
| - void OnChannelConnected(int32_t) override { connect_handler_.Run(); }
|
| -
|
| - private:
|
| - base::Closure connect_handler_;
|
| };
|
|
|
| DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ProxyThreadAssociatedInterfaceClient,
|
| ChannelProxyClient) {
|
| - base::RunLoop connect_loop;
|
| - ListenerThatWaitsForConnect listener(connect_loop.QuitClosure());
|
| + DummyListener listener;
|
| CreateProxy(&listener);
|
| RunProxy();
|
| - connect_loop.Run();
|
|
|
| // Send a bunch of interleaved messages, alternating between the associated
|
| // interface and a legacy IPC::Message.
|
| @@ -889,6 +889,8 @@ DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ProxyThreadAssociatedInterfaceClient,
|
| }
|
| driver->RequestQuit(base::MessageLoop::QuitWhenIdleClosure());
|
| base::RunLoop().Run();
|
| +
|
| + DestroyProxy();
|
| }
|
|
|
| #if defined(OS_POSIX)
|
|
|