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