| Index: ipc/mojo/ipc_channel_mojo_unittest.cc
|
| diff --git a/ipc/mojo/ipc_channel_mojo_unittest.cc b/ipc/mojo/ipc_channel_mojo_unittest.cc
|
| index 556e65accf59f03ac867f8cd4d11dcc6bc41da12..d0ab5d6e0eba0a8b488f9908c443bcc705b86c69 100644
|
| --- a/ipc/mojo/ipc_channel_mojo_unittest.cc
|
| +++ b/ipc/mojo/ipc_channel_mojo_unittest.cc
|
| @@ -9,6 +9,7 @@
|
| #include "base/message_loop/message_loop.h"
|
| #include "base/path_service.h"
|
| #include "base/pickle.h"
|
| +#include "base/test/test_timeouts.h"
|
| #include "base/threading/thread.h"
|
| #include "ipc/ipc_message.h"
|
| #include "ipc/ipc_test_base.h"
|
| @@ -578,4 +579,50 @@ MULTIPROCESS_IPC_TEST_CLIENT_MAIN(
|
|
|
| #endif
|
|
|
| +#if defined(OS_LINUX)
|
| +
|
| +const base::ProcessId kMagicChildId = 54321;
|
| +
|
| +class ListenerThatVerifiesPeerPid : public IPC::Listener {
|
| + public:
|
| + void OnChannelConnected(int32 peer_pid) override {
|
| + EXPECT_EQ(peer_pid, kMagicChildId);
|
| + base::MessageLoop::current()->Quit();
|
| + }
|
| +
|
| + bool OnMessageReceived(const IPC::Message& message) override {
|
| + NOTREACHED();
|
| + return true;
|
| + }
|
| +};
|
| +
|
| +TEST_F(IPCChannelMojoTest, VerifyGlobalPid) {
|
| + Init("IPCChannelMojoTestVerifyGlobalPidClient");
|
| +
|
| + ListenerThatVerifiesPeerPid listener;
|
| + CreateChannel(&listener);
|
| + ASSERT_TRUE(ConnectChannel());
|
| + ASSERT_TRUE(StartClient());
|
| +
|
| + base::MessageLoop::current()->Run();
|
| + this->channel()->Close();
|
| +
|
| + EXPECT_TRUE(WaitForClientShutdown());
|
| + DestroyChannel();
|
| +}
|
| +
|
| +MULTIPROCESS_IPC_TEST_CLIENT_MAIN(IPCChannelMojoTestVerifyGlobalPidClient) {
|
| + IPC::Channel::SetGlobalPid(kMagicChildId);
|
| + ListenerThatQuits listener;
|
| + ChannelClient client(&listener,
|
| + "IPCChannelMojoTestVerifyGlobalPidClient");
|
| + client.Connect();
|
| +
|
| + base::MessageLoop::current()->Run();
|
| +
|
| + return 0;
|
| +}
|
| +
|
| +#endif // OS_LINUX
|
| +
|
| } // namespace
|
|
|