Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: ipc/ipc_test_base.h

Issue 2455823002: Support generic synchronization against an IPC::Channel (Closed)
Patch Set: . Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/ipc_test.mojom ('k') | ipc/ipc_test_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_test_base.h
diff --git a/ipc/ipc_test_base.h b/ipc/ipc_test_base.h
index 8a84fb672786daf12173017fac8e8d799be87e0e..3cce91053154fdc1ec5574e9bdcd786569842e02 100644
--- a/ipc/ipc_test_base.h
+++ b/ipc/ipc_test_base.h
@@ -137,6 +137,30 @@ class IPCTestBase : public base::MultiProcessTest {
class IPCChannelMojoTestBase : public testing::Test {
public:
+ class ClientHandle {
+ public:
+ ClientHandle();
+ ~ClientHandle();
+
+ void Init(const std::string& test_client_name);
+ void CreateChannel(IPC::Listener* listener);
+ bool ConnectChannel();
+ void DestroyChannel();
+ bool WaitForShutdown();
+
+ mojo::ScopedMessagePipeHandle TakeHandle();
+
+ IPC::Channel* channel() { return channel_.get(); }
+ const base::Process& process() const { return helper_.test_child(); }
+
+ private:
+ mojo::ScopedMessagePipeHandle pipe_;
+ mojo::edk::test::MultiprocessTestHelper helper_;
+ std::unique_ptr<IPC::Channel> channel_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientHandle);
+ };
+
IPCChannelMojoTestBase();
~IPCChannelMojoTestBase() override;
@@ -153,19 +177,17 @@ class IPCChannelMojoTestBase : public testing::Test {
void DestroyChannel();
IPC::Sender* sender() { return channel(); }
- IPC::Channel* channel() { return channel_.get(); }
- const base::Process& client_process() const { return helper_.test_child(); }
+ IPC::Channel* channel() { return primary_client_.channel(); }
+ const base::Process& client_process() const {
+ return primary_client_.process();
+ }
protected:
mojo::ScopedMessagePipeHandle TakeHandle();
private:
base::MessageLoop message_loop_;
-
- mojo::ScopedMessagePipeHandle handle_;
- mojo::edk::test::MultiprocessTestHelper helper_;
-
- std::unique_ptr<IPC::Channel> channel_;
+ ClientHandle primary_client_;
DISALLOW_COPY_AND_ASSIGN(IPCChannelMojoTestBase);
};
« no previous file with comments | « ipc/ipc_test.mojom ('k') | ipc/ipc_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698