Guarantee CleanUpAfterPage gets run even if CloseConnection fails.
[chromium-blink-merge.git] / ipc / ipc_security_test_util.cc
blob4ae5a06096de207d4ad31905090f35b0e869c504
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ipc/ipc_security_test_util.h"
7 #include "base/bind.h"
8 #include "base/bind_helpers.h"
9 #include "base/run_loop.h"
10 #include "ipc/ipc_channel_proxy.h"
12 namespace IPC {
14 void IpcSecurityTestUtil::PwnMessageReceived(ChannelProxy* channel,
15 const IPC::Message& message) {
16 base::RunLoop run_loop;
17 base::Closure inject_message = base::Bind(
18 base::IgnoreResult(&IPC::ChannelProxy::Context::OnMessageReceived),
19 channel->context(), message);
20 channel->context()->ipc_task_runner()->PostTaskAndReply(
21 FROM_HERE, inject_message, run_loop.QuitClosure());
22 run_loop.Run();
25 } // namespace IPC