Revert of Change most IPC tests to use ChannelMojo. (patchset #1 id:100001 of https://codereview.chromium.org/2451953003/ )

Reason for revert:
IPCChannelBadMessageTest.BadMessage is failing on Ubuntu-12.04.

Original issue's description:
> Change most IPC tests to use ChannelMojo.
>
> Most IPC::Channels in production are now ChannelMojo, but most tests
> use the platform-specific Channel implementations. This changes the IPC
> tests other than IPCMultiSendingFdsTest.StressTest and those in
> ipc_channel_unittest.cc and ipc_channel_posix_unittest.cc to use
> ChannelMojo.
>
> BUG=659448
>
> Committed: https://crrev.com/d45a95a8ac88b71b768a850cbeffc2c318a10cf9
> Cr-Commit-Position: refs/heads/master@{#427624}

[email protected],[email protected]
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=659448

Review-Url: https://codereview.chromium.org/2455583002
Cr-Commit-Position: refs/heads/master@{#427642}
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn
index dc369499..161143f 100644
--- a/ipc/BUILD.gn
+++ b/ipc/BUILD.gn
@@ -292,7 +292,6 @@
     deps = [
       "//base",
       "//base/test:test_support",
-      "//mojo/edk/test:test_support",
       "//testing/gtest",
     ]
   }
diff --git a/ipc/DEPS b/ipc/DEPS
index e5e7501952..421d8f7 100644
--- a/ipc/DEPS
+++ b/ipc/DEPS
@@ -7,7 +7,7 @@
 ]
 
 specific_include_rules = {
-  "ipc_test_base\.h": [
+  "ipc_channel_mojo_unittest\.cc": [
     "+mojo/edk/test",
   ],
   "ipc_mojo_(bootstrap_unittest|perftest)\.cc": [
diff --git a/ipc/ipc_channel_mojo_unittest.cc b/ipc/ipc_channel_mojo_unittest.cc
index 229716e..5493ac1 100644
--- a/ipc/ipc_channel_mojo_unittest.cc
+++ b/ipc/ipc_channel_mojo_unittest.cc
@@ -37,6 +37,8 @@
 #include "ipc/ipc_test.mojom.h"
 #include "ipc/ipc_test_base.h"
 #include "ipc/ipc_test_channel_listener.h"
+#include "mojo/edk/test/mojo_test_base.h"
+#include "mojo/edk/test/multiprocess_test_helper.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(OS_POSIX)
@@ -44,6 +46,25 @@
 #include "ipc/ipc_platform_file_attachment_posix.h"
 #endif
 
+#define DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(client_name, test_base)           \
+  class client_name##_MainFixture : public test_base {                        \
+   public:                                                                    \
+    void Main();                                                              \
+  };                                                                          \
+  MULTIPROCESS_TEST_MAIN_WITH_SETUP(                                          \
+      client_name##TestChildMain,                                             \
+      ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) {                \
+    client_name##_MainFixture test;                                           \
+    test.Init(                                                                \
+        std::move(mojo::edk::test::MultiprocessTestHelper::primordial_pipe)); \
+    test.Main();                                                              \
+    return (::testing::Test::HasFatalFailure() ||                             \
+            ::testing::Test::HasNonfatalFailure())                            \
+               ? 1                                                            \
+               : 0;                                                           \
+  }                                                                           \
+  void client_name##_MainFixture::Main()
+
 namespace {
 
 void SendString(IPC::Sender* sender, const std::string& str) {
@@ -87,7 +108,73 @@
   bool received_ok_;
 };
 
-using IPCChannelMojoTest = IPCChannelMojoTestBase;
+class ChannelClient {
+ public:
+  void Init(mojo::ScopedMessagePipeHandle handle) {
+    handle_ = std::move(handle);
+  }
+
+  void Connect(IPC::Listener* listener) {
+    channel_ = IPC::ChannelMojo::Create(
+        std::move(handle_), IPC::Channel::MODE_CLIENT, listener,
+        base::ThreadTaskRunnerHandle::Get());
+    CHECK(channel_->Connect());
+  }
+
+  void Close() {
+    channel_->Close();
+
+    base::RunLoop run_loop;
+    base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+                                                  run_loop.QuitClosure());
+    run_loop.Run();
+  }
+
+  IPC::ChannelMojo* channel() const { return channel_.get(); }
+
+ private:
+  base::MessageLoopForIO main_message_loop_;
+  mojo::ScopedMessagePipeHandle handle_;
+  std::unique_ptr<IPC::ChannelMojo> channel_;
+};
+
+class IPCChannelMojoTestBase : public testing::Test {
+ public:
+  void InitWithMojo(const std::string& test_client_name) {
+    handle_ = helper_.StartChild(test_client_name);
+  }
+
+  bool WaitForClientShutdown() { return helper_.WaitForChildTestShutdown(); }
+
+ protected:
+  mojo::ScopedMessagePipeHandle TakeHandle() { return std::move(handle_); }
+
+ private:
+  mojo::ScopedMessagePipeHandle handle_;
+  mojo::edk::test::MultiprocessTestHelper helper_;
+};
+
+class IPCChannelMojoTest : public IPCChannelMojoTestBase {
+ public:
+  void TearDown() override { base::RunLoop().RunUntilIdle(); }
+
+  void CreateChannel(IPC::Listener* listener) {
+    channel_ = IPC::ChannelMojo::Create(
+        TakeHandle(), IPC::Channel::MODE_SERVER, listener,
+        base::ThreadTaskRunnerHandle::Get());
+  }
+
+  bool ConnectChannel() { return channel_->Connect(); }
+
+  void DestroyChannel() { channel_.reset(); }
+
+  IPC::Sender* sender() { return channel(); }
+  IPC::Channel* channel() { return channel_.get(); }
+
+ private:
+  base::MessageLoop message_loop_;
+  std::unique_ptr<IPC::Channel> channel_;
+};
 
 class TestChannelListenerWithExtraExpectations
     : public IPC::TestChannelListener {
@@ -107,7 +194,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, ConnectedFromClient) {
-  Init("IPCChannelMojoTestClient");
+  InitWithMojo("IPCChannelMojoTestClient");
 
   // Set up IPC channel and start client.
   TestChannelListenerWithExtraExpectations listener;
@@ -129,7 +216,7 @@
 }
 
 // A long running process that connects to us
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestClient, ChannelClient) {
   TestChannelListenerWithExtraExpectations listener;
   Connect(&listener);
   listener.Init(channel());
@@ -171,7 +258,8 @@
 };
 
 // A long running process that connects to us.
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoErraticTestClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoErraticTestClient,
+                                    ChannelClient) {
   ListenerThatQuits listener;
   Connect(&listener);
 
@@ -181,7 +269,7 @@
 }
 
 TEST_F(IPCChannelMojoTest, SendFailWithPendingMessages) {
-  Init("IPCChannelMojoErraticTestClient");
+  InitWithMojo("IPCChannelMojoErraticTestClient");
 
   // Set up IPC channel and start client.
   ListenerExpectingErrors listener;
@@ -325,7 +413,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, SendMessagePipe) {
-  Init("IPCChannelMojoTestSendMessagePipeClient");
+  InitWithMojo("IPCChannelMojoTestSendMessagePipeClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -341,7 +429,8 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestSendMessagePipeClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestSendMessagePipeClient,
+                                    ChannelClient) {
   ListenerThatExpectsMessagePipe listener;
   Connect(&listener);
   listener.set_sender(channel());
@@ -402,7 +491,7 @@
   bool receiving_valid_;
 };
 
-class ParamTraitMessagePipeClient : public IpcChannelMojoTestClient {
+class ParamTraitMessagePipeClient : public ChannelClient {
  public:
   void RunTest(bool receiving_valid_handle) {
     ListenerThatExpectsMessagePipeUsingParamTrait listener(
@@ -417,7 +506,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, ParamTraitValidMessagePipe) {
-  Init("ParamTraitValidMessagePipeClient");
+  InitWithMojo("ParamTraitValidMessagePipeClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -438,14 +527,13 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
-    ParamTraitValidMessagePipeClient,
-    ParamTraitMessagePipeClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ParamTraitValidMessagePipeClient,
+                                    ParamTraitMessagePipeClient) {
   RunTest(true);
 }
 
 TEST_F(IPCChannelMojoTest, ParamTraitInvalidMessagePipe) {
-  Init("ParamTraitInvalidMessagePipeClient");
+  InitWithMojo("ParamTraitInvalidMessagePipeClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -464,14 +552,13 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
-    ParamTraitInvalidMessagePipeClient,
-    ParamTraitMessagePipeClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ParamTraitInvalidMessagePipeClient,
+                                    ParamTraitMessagePipeClient) {
   RunTest(false);
 }
 
 TEST_F(IPCChannelMojoTest, SendFailAfterClose) {
-  Init("IPCChannelMojoTestSendOkClient");
+  InitWithMojo("IPCChannelMojoTestSendOkClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -502,7 +589,8 @@
   IPC::Sender* sender_;
 };
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestSendOkClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestSendOkClient,
+                                    ChannelClient) {
   ListenerSendingOneOk listener;
   Connect(&listener);
   listener.set_sender(channel());
@@ -607,7 +695,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, SimpleAssociatedInterface) {
-  Init("SimpleAssociatedInterfaceClient");
+  InitWithMojo("SimpleAssociatedInterfaceClient");
 
   ListenerWithSimpleAssociatedInterface listener;
   CreateChannel(&listener);
@@ -622,7 +710,8 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(SimpleAssociatedInterfaceClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(SimpleAssociatedInterfaceClient,
+                                    ChannelClient) {
   ListenerSendingAssociatedMessages listener;
   Connect(&listener);
   listener.set_channel(channel());
@@ -677,8 +766,8 @@
 
 class IPCChannelProxyMojoTest : public IPCChannelMojoTestBase {
  public:
-  void Init(const std::string& client_name) {
-    IPCChannelMojoTestBase::Init(client_name);
+  void InitWithMojo(const std::string& client_name) {
+    IPCChannelMojoTestBase::InitWithMojo(client_name);
     runner_.reset(new ChannelProxyRunner(TakeHandle(), true));
   }
   void CreateProxy(IPC::Listener* listener) { runner_->CreateProxy(listener); }
@@ -693,6 +782,7 @@
   IPC::ChannelProxy* proxy() { return runner_->proxy(); }
 
  private:
+  base::MessageLoop message_loop_;
   std::unique_ptr<ChannelProxyRunner> runner_;
 };
 
@@ -768,7 +858,7 @@
 const int ListenerWithSimpleProxyAssociatedInterface::kNumMessages = 1000;
 
 TEST_F(IPCChannelProxyMojoTest, ProxyThreadAssociatedInterface) {
-  Init("ProxyThreadAssociatedInterfaceClient");
+  InitWithMojo("ProxyThreadAssociatedInterfaceClient");
 
   ListenerWithSimpleProxyAssociatedInterface listener;
   CreateProxy(&listener);
@@ -816,9 +906,8 @@
   bool OnMessageReceived(const IPC::Message& message) override { return true; }
 };
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
-    ProxyThreadAssociatedInterfaceClient,
-    ChannelProxyClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ProxyThreadAssociatedInterfaceClient,
+                                    ChannelProxyClient) {
   DummyListener listener;
   CreateProxy(&listener);
   RunProxy();
@@ -888,7 +977,7 @@
   // targeting proxy thread bindings, and the channel will still dispatch
   // messages appropriately.
 
-  Init("ProxyThreadAssociatedInterfaceIndirectClient");
+  InitWithMojo("ProxyThreadAssociatedInterfaceIndirectClient");
 
   ListenerWithIndirectProxyAssociatedInterface listener;
   CreateProxy(&listener);
@@ -904,7 +993,7 @@
   DestroyProxy();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(
     ProxyThreadAssociatedInterfaceIndirectClient,
     ChannelProxyClient) {
   DummyListener listener;
@@ -1021,7 +1110,7 @@
 };
 
 TEST_F(IPCChannelProxyMojoTest, SyncAssociatedInterface) {
-  Init("SyncAssociatedInterface");
+  InitWithMojo("SyncAssociatedInterface");
 
   ListenerWithSyncAssociatedInterface listener;
   CreateProxy(&listener);
@@ -1127,8 +1216,8 @@
   DISALLOW_COPY_AND_ASSIGN(SimpleTestClientImpl);
 };
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(SyncAssociatedInterface,
-                                                        ChannelProxyClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(SyncAssociatedInterface,
+                                    ChannelProxyClient) {
   SimpleTestClientImpl client_impl;
   CreateProxy(&client_impl);
   client_impl.set_sync_sender(proxy());
@@ -1187,7 +1276,7 @@
   // sufficient to leave this up to the consumer to implement since associated
   // interface requests and messages also need to be queued according to the
   // same policy.
-  Init("CreatePausedClient");
+  InitWithMojo("CreatePausedClient");
 
   DummyListener listener;
   CreateProxy(&listener);
@@ -1240,8 +1329,7 @@
   DISALLOW_COPY_AND_ASSIGN(ExpectValueSequenceListener);
 };
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(CreatePausedClient,
-                                                        ChannelProxyClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(CreatePausedClient, ChannelProxyClient) {
   std::queue<int32_t> expected_values;
   ExpectValueSequenceListener listener(&expected_values);
   CreateProxy(&listener);
@@ -1282,7 +1370,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, SendPlatformHandle) {
-  Init("IPCChannelMojoTestSendPlatformHandleClient");
+  InitWithMojo("IPCChannelMojoTestSendPlatformHandleClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -1302,8 +1390,8 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(
-    IPCChannelMojoTestSendPlatformHandleClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestSendPlatformHandleClient,
+                                    ChannelClient) {
   ListenerThatExpectsFile listener;
   Connect(&listener);
   listener.set_sender(channel());
@@ -1338,7 +1426,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, SendPlatformHandleAndPipe) {
-  Init("IPCChannelMojoTestSendPlatformHandleAndPipeClient");
+  InitWithMojo("IPCChannelMojoTestSendPlatformHandleAndPipeClient");
 
   ListenerThatExpectsOK listener;
   CreateChannel(&listener);
@@ -1360,7 +1448,8 @@
 }
 
 DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(
-    IPCChannelMojoTestSendPlatformHandleAndPipeClient) {
+    IPCChannelMojoTestSendPlatformHandleAndPipeClient,
+    ChannelClient) {
   ListenerThatExpectsFileAndPipe listener;
   Connect(&listener);
   listener.set_sender(channel());
@@ -1390,7 +1479,7 @@
 };
 
 TEST_F(IPCChannelMojoTest, VerifyGlobalPid) {
-  Init("IPCChannelMojoTestVerifyGlobalPidClient");
+  InitWithMojo("IPCChannelMojoTestVerifyGlobalPidClient");
 
   ListenerThatVerifiesPeerPid listener;
   CreateChannel(&listener);
@@ -1403,7 +1492,8 @@
   DestroyChannel();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestVerifyGlobalPidClient) {
+DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(IPCChannelMojoTestVerifyGlobalPidClient,
+                                    ChannelClient) {
   IPC::Channel::SetGlobalPid(kMagicChildId);
   ListenerThatQuits listener;
   Connect(&listener);
diff --git a/ipc/ipc_channel_proxy_unittest.cc b/ipc/ipc_channel_proxy_unittest.cc
index 1a70734f..8f31e85 100644
--- a/ipc/ipc_channel_proxy_unittest.cc
+++ b/ipc/ipc_channel_proxy_unittest.cc
@@ -232,13 +232,13 @@
   bool message_filtering_enabled_;
 };
 
-class IPCChannelProxyTest : public IPCChannelMojoTestBase {
+class IPCChannelProxyTest : public IPCTestBase {
  public:
   IPCChannelProxyTest() {}
   ~IPCChannelProxyTest() override {}
 
   void SetUp() override {
-    IPCChannelMojoTestBase::SetUp();
+    IPCTestBase::SetUp();
 
     Init("ChannelProxyClient");
 
@@ -248,16 +248,16 @@
     thread_->StartWithOptions(options);
 
     listener_.reset(new QuitListener());
-    channel_proxy_ = IPC::ChannelProxy::Create(
-        TakeHandle().release(), IPC::Channel::MODE_SERVER, listener_.get(),
-        thread_->task_runner());
+    CreateChannelProxy(listener_.get(), thread_->task_runner().get());
+
+    ASSERT_TRUE(StartClient());
   }
 
   void TearDown() override {
-    channel_proxy_.reset();
+    DestroyChannelProxy();
     thread_.reset();
     listener_.reset();
-    IPCChannelMojoTestBase::TearDown();
+    IPCTestBase::TearDown();
   }
 
   void SendQuitMessageAndWaitForIdle() {
@@ -270,13 +270,9 @@
     return listener_->bad_message_received_;
   }
 
-  IPC::ChannelProxy* channel_proxy() { return channel_proxy_.get(); }
-  IPC::Sender* sender() { return channel_proxy_.get(); }
-
  private:
   std::unique_ptr<base::Thread> thread_;
   std::unique_ptr<QuitListener> listener_;
-  std::unique_ptr<IPC::ChannelProxy> channel_proxy_;
 };
 
 TEST_F(IPCChannelProxyTest, MessageClassFilters) {
@@ -429,13 +425,17 @@
 
 #endif
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(ChannelProxyClient) {
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(ChannelProxyClient) {
+  base::MessageLoopForIO main_message_loop;
   ChannelReflectorListener listener;
-  Connect(&listener);
-  listener.Init(channel());
+  std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
+      IPCTestBase::GetChannelName("ChannelProxyClient"), &listener,
+      main_message_loop.task_runner()));
+  CHECK(channel->Connect());
+  listener.Init(channel.get());
 
   base::RunLoop().Run();
-  Close();
+  return 0;
 }
 
 }  // namespace
diff --git a/ipc/ipc_fuzzing_tests.cc b/ipc/ipc_fuzzing_tests.cc
index e47c691..2cf58950 100644
--- a/ipc/ipc_fuzzing_tests.cc
+++ b/ipc/ipc_fuzzing_tests.cc
@@ -258,15 +258,20 @@
 
 // Runs the fuzzing server child mode. Returns when the preset number of
 // messages have been received.
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(FuzzServerClient) {
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(FuzzServerClient) {
+  base::MessageLoopForIO main_message_loop;
   FuzzerServerListener listener;
-  Connect(&listener);
-  listener.Init(channel());
+  std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
+      IPCTestBase::GetChannelName("FuzzServerClient"), &listener,
+      main_message_loop.task_runner()));
+  CHECK(channel->Connect());
+  listener.Init(channel.get());
   base::RunLoop().Run();
-  Close();
+  return 0;
 }
 
-using IPCFuzzingTest = IPCChannelMojoTestBase;
+class IPCFuzzingTest : public IPCTestBase {
+};
 
 // This test makes sure that the FuzzerClientListener and FuzzerServerListener
 // are working properly by generating two well formed IPC calls.
@@ -277,6 +282,7 @@
   CreateChannel(&listener);
   listener.Init(channel());
   ASSERT_TRUE(ConnectChannel());
+  ASSERT_TRUE(StartClient());
 
   IPC::Message* msg = NULL;
   int value = 43;
@@ -304,6 +310,7 @@
   CreateChannel(&listener);
   listener.Init(channel());
   ASSERT_TRUE(ConnectChannel());
+  ASSERT_TRUE(StartClient());
 
   IPC::Message* msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassIS::ID,
                                        IPC::Message::PRIORITY_NORMAL);
@@ -331,6 +338,7 @@
   CreateChannel(&listener);
   listener.Init(channel());
   ASSERT_TRUE(ConnectChannel());
+  ASSERT_TRUE(StartClient());
 
   IPC::Message* msg = new IPC::Message(MSG_ROUTING_CONTROL, MsgClassSI::ID,
                                        IPC::Message::PRIORITY_NORMAL);
diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc
index 635b80a..f92b119a 100644
--- a/ipc/ipc_send_fds_test.cc
+++ b/ipc/ipc_send_fds_test.cc
@@ -113,13 +113,15 @@
   unsigned num_fds_received_;
 };
 
-class IPCSendFdsTest : public IPCChannelMojoTestBase {
+
+class IPCSendFdsTest : public IPCTestBase {
  protected:
   void RunServer() {
     // Set up IPC channel and start client.
     MyChannelDescriptorListener listener(-1);
     CreateChannel(&listener);
     ASSERT_TRUE(ConnectChannel());
+    ASSERT_TRUE(StartClient());
 
     for (unsigned i = 0; i < kNumMessages; ++i) {
       IPC::Message* message =
@@ -149,34 +151,33 @@
   RunServer();
 }
 
-class SendFdsTestClientFixture : public IpcChannelMojoTestClient {
- protected:
-  void SendFdsClientCommon(const std::string& test_client_name,
-                           ino_t expected_inode_num) {
-    MyChannelDescriptorListener listener(expected_inode_num);
+int SendFdsClientCommon(const std::string& test_client_name,
+                        ino_t expected_inode_num) {
+  base::MessageLoopForIO main_message_loop;
+  MyChannelDescriptorListener listener(expected_inode_num);
 
-    // Set up IPC channel.
-    Connect(&listener);
+  // Set up IPC channel.
+  std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
+      IPCTestBase::GetChannelName(test_client_name), &listener,
+      main_message_loop.task_runner()));
+  CHECK(channel->Connect());
 
-    // Run message loop.
-    base::RunLoop().Run();
+  // Run message loop.
+  base::RunLoop().Run();
 
-    // Verify that the message loop was exited due to getting the correct number
-    // of descriptors, and not because of the channel closing unexpectedly.
-    EXPECT_TRUE(listener.GotExpectedNumberOfDescriptors());
+  // Verify that the message loop was exited due to getting the correct number
+  // of descriptors, and not because of the channel closing unexpectedly.
+  CHECK(listener.GotExpectedNumberOfDescriptors());
 
-    Close();
-  }
-};
+  return 0;
+}
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
-    SendFdsClient,
-    SendFdsTestClientFixture) {
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendFdsClient) {
   struct stat st;
   int fd = open(kDevZeroPath, O_RDONLY);
   fstat(fd, &st);
   EXPECT_GE(IGNORE_EINTR(close(fd)), 0);
-  SendFdsClientCommon("SendFdsClient", st.st_ino);
+  return SendFdsClientCommon("SendFdsClient", st.st_ino);
 }
 
 #if defined(OS_MACOSX)
@@ -187,29 +188,31 @@
   RunServer();
 }
 
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(
-    SendFdsSandboxedClient,
-    SendFdsTestClientFixture) {
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SendFdsSandboxedClient) {
   struct stat st;
   const int fd = open(kDevZeroPath, O_RDONLY);
   fstat(fd, &st);
-  ASSERT_LE(0, IGNORE_EINTR(close(fd)));
+  if (IGNORE_EINTR(close(fd)) < 0)
+    return -1;
 
   // Enable the sandbox.
   char* error_buff = NULL;
   int error = sandbox::Seatbelt::Init(
       sandbox::Seatbelt::kProfilePureComputation, SANDBOX_NAMED, &error_buff);
-  ASSERT_EQ(0, error);
-  ASSERT_FALSE(error_buff);
+  bool success = (error == 0 && error_buff == NULL);
+  if (!success)
+    return -1;
 
   sandbox::Seatbelt::FreeError(error_buff);
 
   // Make sure sandbox is really enabled.
-  ASSERT_EQ(-1, open(kDevZeroPath, O_RDONLY))
-      << "Sandbox wasn't properly enabled";
+  if (open(kDevZeroPath, O_RDONLY) != -1) {
+    LOG(ERROR) << "Sandbox wasn't properly enabled";
+    return -1;
+  }
 
   // See if we can receive a file descriptor.
-  SendFdsClientCommon("SendFdsSandboxedClient", st.st_ino);
+  return SendFdsClientCommon("SendFdsSandboxedClient", st.st_ino);
 }
 #endif  // defined(OS_MACOSX)
 
diff --git a/ipc/ipc_sync_channel_unittest.cc b/ipc/ipc_sync_channel_unittest.cc
index 1929036..24c512c 100644
--- a/ipc/ipc_sync_channel_unittest.cc
+++ b/ipc/ipc_sync_channel_unittest.cc
@@ -8,7 +8,6 @@
 
 #include <memory>
 #include <string>
-#include <utility>
 #include <vector>
 
 #include "base/bind.h"
@@ -29,7 +28,6 @@
 #include "ipc/ipc_sender.h"
 #include "ipc/ipc_sync_message_filter.h"
 #include "ipc/ipc_sync_message_unittest.h"
-#include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::WaitableEvent;
@@ -43,14 +41,14 @@
   // Will create a channel without a name.
   Worker(Channel::Mode mode,
          const std::string& thread_name,
-         mojo::ScopedMessagePipeHandle channel_handle)
+         const std::string& channel_name)
       : done_(
             new WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                               base::WaitableEvent::InitialState::NOT_SIGNALED)),
         channel_created_(
             new WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                               base::WaitableEvent::InitialState::NOT_SIGNALED)),
-        channel_handle_(std::move(channel_handle)),
+        channel_name_(channel_name),
         mode_(mode),
         ipc_thread_((thread_name + "_ipc").c_str()),
         listener_thread_((thread_name + "_listener").c_str()),
@@ -60,17 +58,17 @@
         is_shutdown_(false) {}
 
   // Will create a named channel and use this name for the threads' name.
-  Worker(mojo::ScopedMessagePipeHandle channel_handle, Channel::Mode mode)
+  Worker(const std::string& channel_name, Channel::Mode mode)
       : done_(
             new WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                               base::WaitableEvent::InitialState::NOT_SIGNALED)),
         channel_created_(
             new WaitableEvent(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                               base::WaitableEvent::InitialState::NOT_SIGNALED)),
-        channel_handle_(std::move(channel_handle)),
+        channel_name_(channel_name),
         mode_(mode),
-        ipc_thread_("ipc thread"),
-        listener_thread_("listener thread"),
+        ipc_thread_((channel_name + "_ipc").c_str()),
+        listener_thread_((channel_name + "_listener").c_str()),
         overrided_thread_(NULL),
         shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
                         base::WaitableEvent::InitialState::NOT_SIGNALED),
@@ -135,10 +133,7 @@
     DCHECK_EQ(answer, (succeed ? 10 : 0));
     return result;
   }
-  mojo::MessagePipeHandle TakeChannelHandle() {
-    DCHECK(channel_handle_.is_valid());
-    return channel_handle_.release();
-  }
+  const std::string& channel_name() { return channel_name_; }
   Channel::Mode mode() { return mode_; }
   WaitableEvent* done_event() { return done_.get(); }
   WaitableEvent* shutdown_event() { return &shutdown_event_; }
@@ -176,9 +171,9 @@
   }
 
   virtual SyncChannel* CreateChannel() {
-    std::unique_ptr<SyncChannel> channel =
-        SyncChannel::Create(TakeChannelHandle(), mode_, this,
-                            ipc_thread_.task_runner(), true, &shutdown_event_);
+    std::unique_ptr<SyncChannel> channel = SyncChannel::Create(
+        channel_name_, mode_, this, ipc_thread_.task_runner().get(), true,
+        &shutdown_event_);
     return channel.release();
   }
 
@@ -244,7 +239,7 @@
 
   std::unique_ptr<WaitableEvent> done_;
   std::unique_ptr<WaitableEvent> channel_created_;
-  mojo::ScopedMessagePipeHandle channel_handle_;
+  std::string channel_name_;
   Channel::Mode mode_;
   std::unique_ptr<SyncChannel> channel_;
   base::Thread ipc_thread_;
@@ -296,11 +291,8 @@
 
 class SimpleServer : public Worker {
  public:
-  SimpleServer(bool pump_during_send,
-               mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "simpler_server",
-               std::move(channel_handle)),
+  SimpleServer(bool pump_during_send, const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "simpler_server", channel_name),
         pump_during_send_(pump_during_send) {}
   void Run() override {
     SendAnswerToLife(pump_during_send_, true);
@@ -312,10 +304,8 @@
 
 class SimpleClient : public Worker {
  public:
-  explicit SimpleClient(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "simple_client",
-               std::move(channel_handle)) {}
+  explicit SimpleClient(const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "simple_client", channel_name) {}
 
   void OnAnswer(int* answer) override {
     *answer = 42;
@@ -325,10 +315,8 @@
 
 void Simple(bool pump_during_send) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(
-      new SimpleServer(pump_during_send, std::move(pipe.handle0)));
-  workers.push_back(new SimpleClient(std::move(pipe.handle1)));
+  workers.push_back(new SimpleServer(pump_during_send, "Simple"));
+  workers.push_back(new SimpleClient("Simple"));
   RunTest(workers);
 }
 
@@ -350,11 +338,8 @@
 // ChannelProxy::Init separately) process.
 class TwoStepServer : public Worker {
  public:
-  TwoStepServer(bool create_pipe_now,
-                mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "simpler_server",
-               std::move(channel_handle)),
+  TwoStepServer(bool create_pipe_now, const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "simpler_server", channel_name),
         create_pipe_now_(create_pipe_now) {}
 
   void Run() override {
@@ -364,8 +349,8 @@
 
   SyncChannel* CreateChannel() override {
     SyncChannel* channel =
-        SyncChannel::Create(TakeChannelHandle(), mode(), this,
-                            ipc_thread().task_runner(), create_pipe_now_,
+        SyncChannel::Create(channel_name(), mode(), this,
+                            ipc_thread().task_runner().get(), create_pipe_now_,
                             shutdown_event())
             .release();
     return channel;
@@ -376,11 +361,8 @@
 
 class TwoStepClient : public Worker {
  public:
-  TwoStepClient(bool create_pipe_now,
-                mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "simple_client",
-               std::move(channel_handle)),
+  TwoStepClient(bool create_pipe_now, const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "simple_client", channel_name),
         create_pipe_now_(create_pipe_now) {}
 
   void OnAnswer(int* answer) override {
@@ -390,8 +372,8 @@
 
   SyncChannel* CreateChannel() override {
     SyncChannel* channel =
-        SyncChannel::Create(TakeChannelHandle(), mode(), this,
-                            ipc_thread().task_runner(), create_pipe_now_,
+        SyncChannel::Create(channel_name(), mode(), this,
+                            ipc_thread().task_runner().get(), create_pipe_now_,
                             shutdown_event())
             .release();
     return channel;
@@ -402,11 +384,8 @@
 
 void TwoStep(bool create_server_pipe_now, bool create_client_pipe_now) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(
-      new TwoStepServer(create_server_pipe_now, std::move(pipe.handle0)));
-  workers.push_back(
-      new TwoStepClient(create_client_pipe_now, std::move(pipe.handle1)));
+  workers.push_back(new TwoStepServer(create_server_pipe_now, "TwoStep"));
+  workers.push_back(new TwoStepClient(create_client_pipe_now, "TwoStep"));
   RunTest(workers);
 }
 
@@ -423,10 +402,8 @@
 
 class DelayClient : public Worker {
  public:
-  explicit DelayClient(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "delay_client",
-               std::move(channel_handle)) {}
+  explicit DelayClient(const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "delay_client", channel_name) {}
 
   void OnAnswerDelay(Message* reply_msg) override {
     SyncChannelTestMsg_AnswerToLife::WriteReplyParams(reply_msg, 42);
@@ -437,10 +414,8 @@
 
 void DelayReply(bool pump_during_send) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(
-      new SimpleServer(pump_during_send, std::move(pipe.handle0)));
-  workers.push_back(new DelayClient(std::move(pipe.handle1)));
+  workers.push_back(new SimpleServer(pump_during_send, "DelayReply"));
+  workers.push_back(new DelayClient("DelayReply"));
   RunTest(workers);
 }
 
@@ -456,10 +431,8 @@
  public:
   NoHangServer(WaitableEvent* got_first_reply,
                bool pump_during_send,
-               mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "no_hang_server",
-               std::move(channel_handle)),
+               const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "no_hang_server", channel_name),
         got_first_reply_(got_first_reply),
         pump_during_send_(pump_during_send) {}
   void Run() override {
@@ -476,11 +449,8 @@
 
 class NoHangClient : public Worker {
  public:
-  NoHangClient(WaitableEvent* got_first_reply,
-               mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "no_hang_client",
-               std::move(channel_handle)),
+  NoHangClient(WaitableEvent* got_first_reply, const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "no_hang_client", channel_name),
         got_first_reply_(got_first_reply) {}
 
   void OnAnswerDelay(Message* reply_msg) override {
@@ -501,11 +471,9 @@
       base::WaitableEvent::ResetPolicy::AUTOMATIC,
       base::WaitableEvent::InitialState::NOT_SIGNALED);
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new NoHangServer(&got_first_reply, pump_during_send,
-                                     std::move(pipe.handle0)));
   workers.push_back(
-      new NoHangClient(&got_first_reply, std::move(pipe.handle1)));
+      new NoHangServer(&got_first_reply, pump_during_send, "NoHang"));
+  workers.push_back(new NoHangClient(&got_first_reply, "NoHang"));
   RunTest(workers);
 }
 
@@ -521,10 +489,8 @@
  public:
   UnblockServer(bool pump_during_send,
                 bool delete_during_send,
-                mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "unblock_server",
-               std::move(channel_handle)),
+                const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "unblock_server", channel_name),
         pump_during_send_(pump_during_send),
         delete_during_send_(delete_during_send) {}
   void Run() override {
@@ -555,11 +521,8 @@
 
 class UnblockClient : public Worker {
  public:
-  UnblockClient(bool pump_during_send,
-                mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "unblock_client",
-               std::move(channel_handle)),
+  UnblockClient(bool pump_during_send, const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "unblock_client", channel_name),
         pump_during_send_(pump_during_send) {}
 
   void OnAnswer(int* answer) override {
@@ -573,10 +536,9 @@
 
 void Unblock(bool server_pump, bool client_pump, bool delete_during_send) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new UnblockServer(server_pump, delete_during_send,
-                                      std::move(pipe.handle0)));
-  workers.push_back(new UnblockClient(client_pump, std::move(pipe.handle1)));
+  workers.push_back(
+      new UnblockServer(server_pump, delete_during_send, "Unblock"));
+  workers.push_back(new UnblockClient(client_pump, "Unblock"));
   RunTest(workers);
 }
 
@@ -610,10 +572,8 @@
   RecursiveServer(bool expected_send_result,
                   bool pump_first,
                   bool pump_second,
-                  mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "recursive_server",
-               std::move(channel_handle)),
+                  const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "recursive_server", channel_name),
         expected_send_result_(expected_send_result),
         pump_first_(pump_first),
         pump_second_(pump_second) {}
@@ -634,10 +594,8 @@
  public:
   RecursiveClient(bool pump_during_send,
                   bool close_channel,
-                  mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "recursive_client",
-               std::move(channel_handle)),
+                  const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "recursive_client", channel_name),
         pump_during_send_(pump_during_send),
         close_channel_(close_channel) {}
 
@@ -668,11 +626,9 @@
 void Recursive(
     bool server_pump_first, bool server_pump_second, bool client_pump) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new RecursiveServer(
-      true, server_pump_first, server_pump_second, std::move(pipe.handle0)));
-  workers.push_back(
-      new RecursiveClient(client_pump, false, std::move(pipe.handle1)));
+  workers.push_back(new RecursiveServer(true, server_pump_first,
+                                        server_pump_second, "Recursive"));
+  workers.push_back(new RecursiveClient(client_pump, false, "Recursive"));
   RunTest(workers);
 }
 
@@ -693,11 +649,9 @@
 void RecursiveNoHang(
     bool server_pump_first, bool server_pump_second, bool client_pump) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new RecursiveServer(
-      false, server_pump_first, server_pump_second, std::move(pipe.handle0)));
-  workers.push_back(
-      new RecursiveClient(client_pump, true, std::move(pipe.handle1)));
+  workers.push_back(new RecursiveServer(false, server_pump_first,
+                                        server_pump_second, "RecursiveNoHang"));
+  workers.push_back(new RecursiveClient(client_pump, true, "RecursiveNoHang"));
   RunTest(workers);
 }
 
@@ -718,10 +672,9 @@
 
 class MultipleServer1 : public Worker {
  public:
-  MultipleServer1(bool pump_during_send,
-                  mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER),
-        pump_during_send_(pump_during_send) {}
+  explicit MultipleServer1(bool pump_during_send)
+    : Worker("test_channel1", Channel::MODE_SERVER),
+      pump_during_send_(pump_during_send) { }
 
   void Run() override {
     SendDouble(pump_during_send_, true);
@@ -734,11 +687,10 @@
 class MultipleClient1 : public Worker {
  public:
   MultipleClient1(WaitableEvent* client1_msg_received,
-                  WaitableEvent* client1_can_reply,
-                  mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
-        client1_msg_received_(client1_msg_received),
-        client1_can_reply_(client1_can_reply) {}
+                  WaitableEvent* client1_can_reply) :
+      Worker("test_channel1", Channel::MODE_CLIENT),
+      client1_msg_received_(client1_msg_received),
+      client1_can_reply_(client1_can_reply) { }
 
   void OnDouble(int in, int* out) override {
     client1_msg_received_->Signal();
@@ -753,8 +705,7 @@
 
 class MultipleServer2 : public Worker {
  public:
-  explicit MultipleServer2(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER) {}
+  MultipleServer2() : Worker("test_channel2", Channel::MODE_SERVER) { }
 
   void OnAnswer(int* result) override {
     *result = 42;
@@ -764,14 +715,13 @@
 
 class MultipleClient2 : public Worker {
  public:
-  MultipleClient2(WaitableEvent* client1_msg_received,
-                  WaitableEvent* client1_can_reply,
-                  bool pump_during_send,
-                  mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
-        client1_msg_received_(client1_msg_received),
-        client1_can_reply_(client1_can_reply),
-        pump_during_send_(pump_during_send) {}
+  MultipleClient2(
+    WaitableEvent* client1_msg_received, WaitableEvent* client1_can_reply,
+    bool pump_during_send)
+    : Worker("test_channel2", Channel::MODE_CLIENT),
+      client1_msg_received_(client1_msg_received),
+      client1_can_reply_(client1_can_reply),
+      pump_during_send_(pump_during_send) { }
 
   void Run() override {
     client1_msg_received_->Wait();
@@ -804,21 +754,20 @@
 
   Worker* worker;
 
-  mojo::MessagePipe pipe1, pipe2;
-  worker = new MultipleServer2(std::move(pipe2.handle0));
+  worker = new MultipleServer2();
   worker->OverrideThread(&worker_thread);
   workers.push_back(worker);
 
-  worker = new MultipleClient2(&client1_msg_received, &client1_can_reply,
-                               client_pump, std::move(pipe2.handle1));
+  worker = new MultipleClient2(
+      &client1_msg_received, &client1_can_reply, client_pump);
   workers.push_back(worker);
 
-  worker = new MultipleServer1(server_pump, std::move(pipe1.handle0));
+  worker = new MultipleServer1(server_pump);
   worker->OverrideThread(&worker_thread);
   workers.push_back(worker);
 
-  worker = new MultipleClient1(&client1_msg_received, &client1_can_reply,
-                               std::move(pipe1.handle1));
+  worker = new MultipleClient1(
+      &client1_msg_received, &client1_can_reply);
   workers.push_back(worker);
 
   RunTest(workers);
@@ -841,9 +790,9 @@
 class QueuedReplyServer : public Worker {
  public:
   QueuedReplyServer(base::Thread* listener_thread,
-                    mojo::ScopedMessagePipeHandle channel_handle,
+                    const std::string& channel_name,
                     const std::string& reply_text)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER),
+      : Worker(channel_name, Channel::MODE_SERVER),
         reply_text_(reply_text) {
     Worker::OverrideThread(listener_thread);
   }
@@ -868,10 +817,10 @@
 class QueuedReplyClient : public Worker {
  public:
   QueuedReplyClient(base::Thread* listener_thread,
-                    mojo::ScopedMessagePipeHandle channel_handle,
+                    const std::string& channel_name,
                     const std::string& expected_text,
                     bool pump_during_send)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
+      : Worker(channel_name, Channel::MODE_CLIENT),
         pump_during_send_(pump_during_send),
         expected_text_(expected_text) {
     Worker::OverrideThread(listener_thread);
@@ -907,23 +856,26 @@
 
   Worker* worker;
 
-  mojo::MessagePipe pipe1, pipe2;
   worker = new QueuedReplyServer(&server_worker_thread,
-                                 std::move(pipe1.handle0), "Got first message");
+                                 "QueuedReply_Server1",
+                                 "Got first message");
   workers.push_back(worker);
 
-  worker = new QueuedReplyServer(
-      &server_worker_thread, std::move(pipe2.handle0), "Got second message");
+  worker = new QueuedReplyServer(&server_worker_thread,
+                                 "QueuedReply_Server2",
+                                 "Got second message");
   workers.push_back(worker);
 
-  worker =
-      new QueuedReplyClient(&client_worker_thread, std::move(pipe1.handle1),
-                            "Got first message", client_pump);
+  worker = new QueuedReplyClient(&client_worker_thread,
+                                 "QueuedReply_Server1",
+                                 "Got first message",
+                                 client_pump);
   workers.push_back(worker);
 
-  worker =
-      new QueuedReplyClient(&client_worker_thread, std::move(pipe2.handle1),
-                            "Got second message", client_pump);
+  worker = new QueuedReplyClient(&client_worker_thread,
+                                 "QueuedReply_Server2",
+                                 "Got second message",
+                                 client_pump);
   workers.push_back(worker);
 
   RunTest(workers);
@@ -944,10 +896,8 @@
 
 class ChattyClient : public Worker {
  public:
-  explicit ChattyClient(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_CLIENT,
-               "chatty_client",
-               std::move(channel_handle)) {}
+  explicit ChattyClient(const std::string& channel_name)
+      : Worker(Channel::MODE_CLIENT, "chatty_client", channel_name) {}
 
   void OnAnswer(int* answer) override {
     // The PostMessage limit is 10k.  Send 20% more than that.
@@ -964,10 +914,8 @@
 
 void ChattyServer(bool pump_during_send) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(
-      new UnblockServer(pump_during_send, false, std::move(pipe.handle0)));
-  workers.push_back(new ChattyClient(std::move(pipe.handle1)));
+  workers.push_back(new UnblockServer(pump_during_send, false, "ChattyServer"));
+  workers.push_back(new ChattyClient("ChattyServer"));
   RunTest(workers);
 }
 
@@ -1001,10 +949,8 @@
 
 class DoneEventRaceServer : public Worker {
  public:
-  explicit DoneEventRaceServer(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "done_event_race_server",
-               std::move(channel_handle)) {}
+  explicit DoneEventRaceServer(const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "done_event_race_server", channel_name) {}
 
   void Run() override {
     base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -1032,9 +978,8 @@
 // reply comes back OnObjectSignaled will be called for the first message.
 TEST_F(IPCSyncChannelTest, MAYBE_DoneEventRace) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new DoneEventRaceServer(std::move(pipe.handle0)));
-  workers.push_back(new SimpleClient(std::move(pipe.handle1)));
+  workers.push_back(new DoneEventRaceServer("DoneEventRace"));
+  workers.push_back(new SimpleClient("DoneEventRace"));
   RunTest(workers);
 }
 
@@ -1075,10 +1020,10 @@
 
 class SyncMessageFilterServer : public Worker {
  public:
-  explicit SyncMessageFilterServer(mojo::ScopedMessagePipeHandle channel_handle)
+  explicit SyncMessageFilterServer(const std::string& channel_name)
       : Worker(Channel::MODE_SERVER,
                "sync_message_filter_server",
-               std::move(channel_handle)),
+               channel_name),
         thread_("helper_thread") {
     base::Thread::Options options;
     options.message_loop_type = base::MessageLoop::TYPE_DEFAULT;
@@ -1099,10 +1044,8 @@
 // channel does not crash after the channel has been closed.
 class ServerSendAfterClose : public Worker {
  public:
-  explicit ServerSendAfterClose(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(Channel::MODE_SERVER,
-               "simpler_server",
-               std::move(channel_handle)),
+  explicit ServerSendAfterClose(const std::string& channel_name)
+      : Worker(Channel::MODE_SERVER, "simpler_server", channel_name),
         send_result_(true) {}
 
   bool SendDummy() {
@@ -1134,16 +1077,14 @@
 // Tests basic synchronous call
 TEST_F(IPCSyncChannelTest, SyncMessageFilter) {
   std::vector<Worker*> workers;
-  mojo::MessagePipe pipe;
-  workers.push_back(new SyncMessageFilterServer(std::move(pipe.handle0)));
-  workers.push_back(new SimpleClient(std::move(pipe.handle1)));
+  workers.push_back(new SyncMessageFilterServer("SyncMessageFilter"));
+  workers.push_back(new SimpleClient("SyncMessageFilter"));
   RunTest(workers);
 }
 
 // Test the case when the channel is closed and a Send is attempted after that.
 TEST_F(IPCSyncChannelTest, SendAfterClose) {
-  mojo::MessagePipe pipe;
-  ServerSendAfterClose server(std::move(pipe.handle0));
+  ServerSendAfterClose server("SendAfterClose");
   server.Start();
 
   server.done_event()->Wait();
@@ -1162,11 +1103,10 @@
 class RestrictedDispatchServer : public Worker {
  public:
   RestrictedDispatchServer(WaitableEvent* sent_ping_event,
-                           WaitableEvent* wait_event,
-                           mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER),
+                           WaitableEvent* wait_event)
+      : Worker("restricted_channel", Channel::MODE_SERVER),
         sent_ping_event_(sent_ping_event),
-        wait_event_(wait_event) {}
+        wait_event_(wait_event) { }
 
   void OnDoPing(int ping) {
     // Send an asynchronous message that unblocks the caller.
@@ -1207,9 +1147,8 @@
 
 class NonRestrictedDispatchServer : public Worker {
  public:
-  NonRestrictedDispatchServer(WaitableEvent* signal_event,
-                              mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER),
+  NonRestrictedDispatchServer(WaitableEvent* signal_event)
+      : Worker("non_restricted_channel", Channel::MODE_SERVER),
         signal_event_(signal_event) {}
 
   base::Thread* ListenerThread() { return Worker::ListenerThread(); }
@@ -1235,21 +1174,16 @@
 
 class RestrictedDispatchClient : public Worker {
  public:
-  RestrictedDispatchClient(
-      WaitableEvent* sent_ping_event,
-      RestrictedDispatchServer* server,
-      NonRestrictedDispatchServer* server2,
-      int* success,
-      mojo::ScopedMessagePipeHandle restricted_channel_handle,
-      mojo::ScopedMessagePipeHandle non_restricted_channel_handle)
-      : Worker(std::move(restricted_channel_handle), Channel::MODE_CLIENT),
+  RestrictedDispatchClient(WaitableEvent* sent_ping_event,
+                           RestrictedDispatchServer* server,
+                           NonRestrictedDispatchServer* server2,
+                           int* success)
+      : Worker("restricted_channel", Channel::MODE_CLIENT),
         ping_(0),
         server_(server),
         server2_(server2),
         success_(success),
-        sent_ping_event_(sent_ping_event),
-        non_restricted_channel_handle_(
-            std::move(non_restricted_channel_handle)) {}
+        sent_ping_event_(sent_ping_event) {}
 
   void Run() override {
     // Incoming messages from our channel should only be dispatched when we
@@ -1266,8 +1200,8 @@
       LOG(ERROR) << "Send failed to dispatch incoming message on same channel";
 
     non_restricted_channel_ = SyncChannel::Create(
-        non_restricted_channel_handle_.release(), IPC::Channel::MODE_CLIENT,
-        this, ipc_thread().task_runner(), true, shutdown_event());
+        "non_restricted_channel", IPC::Channel::MODE_CLIENT, this,
+        ipc_thread().task_runner().get(), true, shutdown_event());
 
     server_->ListenerThread()->task_runner()->PostTask(
         FROM_HERE, base::Bind(&RestrictedDispatchServer::OnDoPing, server_, 2));
@@ -1337,7 +1271,6 @@
   int* success_;
   WaitableEvent* sent_ping_event_;
   std::unique_ptr<SyncChannel> non_restricted_channel_;
-  mojo::ScopedMessagePipeHandle non_restricted_channel_handle_;
 };
 
 TEST_F(IPCSyncChannelTest, RestrictedDispatch) {
@@ -1346,20 +1279,17 @@
       base::WaitableEvent::InitialState::NOT_SIGNALED);
   WaitableEvent wait_event(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                            base::WaitableEvent::InitialState::NOT_SIGNALED);
-  mojo::MessagePipe restricted_pipe, non_restricted_pipe;
-  RestrictedDispatchServer* server = new RestrictedDispatchServer(
-      &sent_ping_event, &wait_event, std::move(restricted_pipe.handle0));
-  NonRestrictedDispatchServer* server2 = new NonRestrictedDispatchServer(
-      &wait_event, std::move(non_restricted_pipe.handle0));
+  RestrictedDispatchServer* server =
+      new RestrictedDispatchServer(&sent_ping_event, &wait_event);
+  NonRestrictedDispatchServer* server2 =
+      new NonRestrictedDispatchServer(&wait_event);
 
   int success = 0;
   std::vector<Worker*> workers;
   workers.push_back(server);
   workers.push_back(server2);
-  workers.push_back(
-      new RestrictedDispatchClient(&sent_ping_event, server, server2, &success,
-                                   std::move(restricted_pipe.handle1),
-                                   std::move(non_restricted_pipe.handle1)));
+  workers.push_back(new RestrictedDispatchClient(
+      &sent_ping_event, server, server2, &success));
   RunTest(workers);
   EXPECT_EQ(4, success);
 }
@@ -1398,13 +1328,12 @@
   RestrictedDispatchDeadlockServer(int server_num,
                                    WaitableEvent* server_ready_event,
                                    WaitableEvent** events,
-                                   RestrictedDispatchDeadlockServer* peer,
-                                   mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER),
+                                   RestrictedDispatchDeadlockServer* peer)
+      : Worker(server_num == 1 ? "channel1" : "channel2", Channel::MODE_SERVER),
         server_num_(server_num),
         server_ready_event_(server_ready_event),
         events_(events),
-        peer_(peer) {}
+        peer_(peer) { }
 
   void OnDoServerTask() {
     events_[3]->Signal();
@@ -1451,12 +1380,10 @@
 
 class RestrictedDispatchDeadlockClient2 : public Worker {
  public:
-  RestrictedDispatchDeadlockClient2(
-      RestrictedDispatchDeadlockServer* server,
-      WaitableEvent* server_ready_event,
-      WaitableEvent** events,
-      mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
+  RestrictedDispatchDeadlockClient2(RestrictedDispatchDeadlockServer* server,
+                                    WaitableEvent* server_ready_event,
+                                    WaitableEvent** events)
+      : Worker("channel2", Channel::MODE_CLIENT),
         server_ready_event_(server_ready_event),
         events_(events),
         received_msg_(false),
@@ -1511,13 +1438,11 @@
 
 class RestrictedDispatchDeadlockClient1 : public Worker {
  public:
-  RestrictedDispatchDeadlockClient1(
-      RestrictedDispatchDeadlockServer* server,
-      RestrictedDispatchDeadlockClient2* peer,
-      WaitableEvent* server_ready_event,
-      WaitableEvent** events,
-      mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
+  RestrictedDispatchDeadlockClient1(RestrictedDispatchDeadlockServer* server,
+                                    RestrictedDispatchDeadlockClient2* peer,
+                                    WaitableEvent* server_ready_event,
+                                    WaitableEvent** events)
+      : Worker("channel1", Channel::MODE_CLIENT),
         server_(server),
         peer_(peer),
         server_ready_event_(server_ready_event),
@@ -1603,23 +1528,22 @@
   RestrictedDispatchDeadlockClient1* client1;
   RestrictedDispatchDeadlockClient2* client2;
 
-  mojo::MessagePipe pipe1, pipe2;
-  server2 = new RestrictedDispatchDeadlockServer(
-      2, &server2_ready, events, NULL, std::move(pipe2.handle0));
+  server2 = new RestrictedDispatchDeadlockServer(2, &server2_ready, events,
+                                                 NULL);
   server2->OverrideThread(&worker_thread);
   workers.push_back(server2);
 
-  client2 = new RestrictedDispatchDeadlockClient2(
-      server2, &server2_ready, events, std::move(pipe2.handle1));
+  client2 = new RestrictedDispatchDeadlockClient2(server2, &server2_ready,
+                                                  events);
   workers.push_back(client2);
 
-  server1 = new RestrictedDispatchDeadlockServer(
-      1, &server1_ready, events, server2, std::move(pipe1.handle0));
+  server1 = new RestrictedDispatchDeadlockServer(1, &server1_ready, events,
+                                                 server2);
   server1->OverrideThread(&worker_thread);
   workers.push_back(server1);
 
-  client1 = new RestrictedDispatchDeadlockClient1(
-      server1, client2, &server1_ready, events, std::move(pipe1.handle1));
+  client1 = new RestrictedDispatchDeadlockClient1(server1, client2,
+                                                  &server1_ready, events);
   workers.push_back(client1);
 
   RunTest(workers);
@@ -1635,18 +1559,20 @@
 
 class RestrictedDispatchPipeWorker : public Worker {
  public:
-  RestrictedDispatchPipeWorker(mojo::ScopedMessagePipeHandle channel_handle1,
-                               WaitableEvent* event1,
-                               mojo::ScopedMessagePipeHandle channel_handle2,
-                               WaitableEvent* event2,
-                               int group,
-                               int* success)
-      : Worker(std::move(channel_handle1), Channel::MODE_SERVER),
+  RestrictedDispatchPipeWorker(
+      const std::string &channel1,
+      WaitableEvent* event1,
+      const std::string &channel2,
+      WaitableEvent* event2,
+      int group,
+      int* success)
+      : Worker(channel1, Channel::MODE_SERVER),
         event1_(event1),
         event2_(event2),
-        other_channel_handle_(std::move(channel_handle2)),
+        other_channel_name_(channel2),
         group_(group),
-        success_(success) {}
+        success_(success) {
+  }
 
   void OnPingTTL(int ping, int* ret) {
     *ret = 0;
@@ -1670,8 +1596,8 @@
       event1_->Signal();
     event2_->Wait();
     other_channel_ = SyncChannel::Create(
-        other_channel_handle_.release(), IPC::Channel::MODE_CLIENT, this,
-        ipc_thread().task_runner(), true, shutdown_event());
+        other_channel_name_, IPC::Channel::MODE_CLIENT, this,
+        ipc_thread().task_runner().get(), true, shutdown_event());
     other_channel_->SetRestrictDispatchChannelGroup(group_);
     if (!is_first()) {
       event1_->Signal();
@@ -1704,7 +1630,7 @@
   std::unique_ptr<SyncChannel> other_channel_;
   WaitableEvent* event1_;
   WaitableEvent* event2_;
-  mojo::ScopedMessagePipeHandle other_channel_handle_;
+  std::string other_channel_name_;
   int group_;
   int* success_;
 };
@@ -1726,19 +1652,14 @@
                        base::WaitableEvent::InitialState::NOT_SIGNALED);
   WaitableEvent event3(base::WaitableEvent::ResetPolicy::MANUAL,
                        base::WaitableEvent::InitialState::NOT_SIGNALED);
-  mojo::MessagePipe pipe0, pipe1, pipe2, pipe3;
   workers.push_back(new RestrictedDispatchPipeWorker(
-      std::move(pipe0.handle0), &event0, std::move(pipe1.handle1), &event1, 1,
-      &success));
+        "channel0", &event0, "channel1", &event1, 1, &success));
   workers.push_back(new RestrictedDispatchPipeWorker(
-      std::move(pipe1.handle0), &event1, std::move(pipe2.handle1), &event2, 2,
-      NULL));
+        "channel1", &event1, "channel2", &event2, 2, NULL));
   workers.push_back(new RestrictedDispatchPipeWorker(
-      std::move(pipe2.handle0), &event2, std::move(pipe3.handle1), &event3, 3,
-      NULL));
+        "channel2", &event2, "channel3", &event3, 3, NULL));
   workers.push_back(new RestrictedDispatchPipeWorker(
-      std::move(pipe3.handle0), &event3, std::move(pipe0.handle1), &event0, 4,
-      NULL));
+        "channel3", &event3, "channel0", &event0, 4, NULL));
   RunTest(workers);
   EXPECT_EQ(3, success);
 }
@@ -1755,17 +1676,14 @@
 
 class ReentrantReplyServer1 : public Worker {
  public:
-  ReentrantReplyServer1(WaitableEvent* server_ready,
-                        mojo::ScopedMessagePipeHandle channel_handle1,
-                        mojo::ScopedMessagePipeHandle channel_handle2)
-      : Worker(std::move(channel_handle1), Channel::MODE_SERVER),
-        server_ready_(server_ready),
-        other_channel_handle_(std::move(channel_handle2)) {}
+  ReentrantReplyServer1(WaitableEvent* server_ready)
+      : Worker("reentrant_reply1", Channel::MODE_SERVER),
+        server_ready_(server_ready) { }
 
   void Run() override {
     server2_channel_ = SyncChannel::Create(
-        other_channel_handle_.release(), IPC::Channel::MODE_CLIENT, this,
-        ipc_thread().task_runner(), true, shutdown_event());
+        "reentrant_reply2", IPC::Channel::MODE_CLIENT, this,
+        ipc_thread().task_runner().get(), true, shutdown_event());
     server_ready_->Signal();
     Message* msg = new SyncChannelTestMsg_Reentrant1();
     server2_channel_->Send(msg);
@@ -1795,13 +1713,13 @@
 
   WaitableEvent* server_ready_;
   std::unique_ptr<SyncChannel> server2_channel_;
-  mojo::ScopedMessagePipeHandle other_channel_handle_;
 };
 
 class ReentrantReplyServer2 : public Worker {
  public:
-  ReentrantReplyServer2(mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_SERVER), reply_(NULL) {}
+  ReentrantReplyServer2()
+      : Worker("reentrant_reply2", Channel::MODE_SERVER),
+        reply_(NULL) { }
 
  private:
   bool OnMessageReceived(const Message& message) override {
@@ -1832,10 +1750,9 @@
 
 class ReentrantReplyClient : public Worker {
  public:
-  ReentrantReplyClient(WaitableEvent* server_ready,
-                       mojo::ScopedMessagePipeHandle channel_handle)
-      : Worker(std::move(channel_handle), Channel::MODE_CLIENT),
-        server_ready_(server_ready) {}
+  ReentrantReplyClient(WaitableEvent* server_ready)
+      : Worker("reentrant_reply1", Channel::MODE_CLIENT),
+        server_ready_(server_ready) { }
 
   void Run() override {
     server_ready_->Wait();
@@ -1851,14 +1768,103 @@
   std::vector<Worker*> workers;
   WaitableEvent server_ready(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                              base::WaitableEvent::InitialState::NOT_SIGNALED);
-  mojo::MessagePipe pipe1, pipe2;
-  workers.push_back(new ReentrantReplyServer2(std::move(pipe2.handle0)));
-  workers.push_back(new ReentrantReplyServer1(
-      &server_ready, std::move(pipe1.handle0), std::move(pipe2.handle1)));
-  workers.push_back(
-      new ReentrantReplyClient(&server_ready, std::move(pipe1.handle1)));
+  workers.push_back(new ReentrantReplyServer2());
+  workers.push_back(new ReentrantReplyServer1(&server_ready));
+  workers.push_back(new ReentrantReplyClient(&server_ready));
   RunTest(workers);
 }
 
+//------------------------------------------------------------------------------
+
+// Generate a validated channel ID using Channel::GenerateVerifiedChannelID().
+
+class VerifiedServer : public Worker {
+ public:
+  VerifiedServer(base::Thread* listener_thread,
+                 const std::string& channel_name,
+                 const std::string& reply_text)
+      : Worker(channel_name, Channel::MODE_SERVER),
+        reply_text_(reply_text) {
+    Worker::OverrideThread(listener_thread);
+  }
+
+  void OnNestedTestMsg(Message* reply_msg) override {
+    VLOG(1) << __FUNCTION__ << " Sending reply: " << reply_text_;
+    SyncChannelNestedTestMsg_String::WriteReplyParams(reply_msg, reply_text_);
+    Send(reply_msg);
+    ASSERT_EQ(channel()->GetPeerPID(), base::GetCurrentProcId());
+    Done();
+  }
+
+ private:
+  std::string reply_text_;
+};
+
+class VerifiedClient : public Worker {
+ public:
+  VerifiedClient(base::Thread* listener_thread,
+                 const std::string& channel_name,
+                 const std::string& expected_text)
+      : Worker(channel_name, Channel::MODE_CLIENT),
+        expected_text_(expected_text) {
+    Worker::OverrideThread(listener_thread);
+  }
+
+  void OnChannelConnected(int32_t peer_pid) override {
+    ListenerThread()->task_runner()->PostTask(
+        FROM_HERE, base::Bind(&VerifiedClient::RunTestOnConnected, this));
+  }
+
+  void RunTestOnConnected() {
+    std::string response;
+    SyncMessage* msg = new SyncChannelNestedTestMsg_String(&response);
+    bool result = Send(msg);
+    DCHECK(result);
+    DCHECK_EQ(response, expected_text_);
+    // expected_text_ is only used in the above DCHECK. This line suppresses the
+    // "unused private field" warning in release builds.
+    (void)expected_text_;
+
+    VLOG(1) << __FUNCTION__ << " Received reply: " << response;
+    ASSERT_EQ(channel()->GetPeerPID(), base::GetCurrentProcId());
+    Done();
+  }
+
+ private:
+  std::string expected_text_;
+};
+
+void Verified() {
+  std::vector<Worker*> workers;
+
+  // A shared worker thread for servers
+  base::Thread server_worker_thread("Verified_ServerListener");
+  ASSERT_TRUE(server_worker_thread.Start());
+
+  base::Thread client_worker_thread("Verified_ClientListener");
+  ASSERT_TRUE(client_worker_thread.Start());
+
+  std::string channel_id = Channel::GenerateVerifiedChannelID("Verified");
+  Worker* worker;
+
+  worker = new VerifiedServer(&server_worker_thread,
+                              channel_id,
+                              "Got first message");
+  workers.push_back(worker);
+
+  worker = new VerifiedClient(&client_worker_thread,
+                              channel_id,
+                              "Got first message");
+  workers.push_back(worker);
+
+  RunTest(workers);
+}
+
+// Windows needs to send an out-of-band secret to verify the client end of the
+// channel. Test that we still connect correctly in that case.
+TEST_F(IPCSyncChannelTest, Verified) {
+  Verified();
+}
+
 }  // namespace
 }  // namespace IPC
diff --git a/ipc/ipc_test_base.cc b/ipc/ipc_test_base.cc
index 8bc6bfc7..880e495 100644
--- a/ipc/ipc_test_base.cc
+++ b/ipc/ipc_test_base.cc
@@ -9,12 +9,10 @@
 #include "base/command_line.h"
 #include "base/memory/ptr_util.h"
 #include "base/process/kill.h"
-#include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
-#include "ipc/ipc_channel_mojo.h"
 #include "ipc/ipc_descriptors.h"
 
 #if defined(OS_POSIX)
@@ -170,59 +168,3 @@
     base::SingleThreadTaskRunner* runner) {
   return IPC::ChannelFactory::Create(handle, IPC::Channel::MODE_SERVER, runner);
 }
-IPCChannelMojoTestBase::IPCChannelMojoTestBase() = default;
-IPCChannelMojoTestBase::~IPCChannelMojoTestBase() = default;
-
-void IPCChannelMojoTestBase::Init(const std::string& test_client_name) {
-  handle_ = helper_.StartChild(test_client_name);
-}
-
-bool IPCChannelMojoTestBase::WaitForClientShutdown() {
-  return helper_.WaitForChildTestShutdown();
-}
-
-void IPCChannelMojoTestBase::TearDown() {
-  base::RunLoop().RunUntilIdle();
-}
-
-void IPCChannelMojoTestBase::CreateChannel(IPC::Listener* listener) {
-  channel_ =
-      IPC::ChannelMojo::Create(TakeHandle(), IPC::Channel::MODE_SERVER,
-                               listener, base::ThreadTaskRunnerHandle::Get());
-}
-
-bool IPCChannelMojoTestBase::ConnectChannel() {
-  return channel_->Connect();
-}
-
-void IPCChannelMojoTestBase::DestroyChannel() {
-  channel_.reset();
-}
-
-mojo::ScopedMessagePipeHandle IPCChannelMojoTestBase::TakeHandle() {
-  return std::move(handle_);
-}
-
-IpcChannelMojoTestClient::IpcChannelMojoTestClient() = default;
-
-IpcChannelMojoTestClient::~IpcChannelMojoTestClient() = default;
-
-void IpcChannelMojoTestClient::Init(mojo::ScopedMessagePipeHandle handle) {
-  handle_ = std::move(handle);
-}
-
-void IpcChannelMojoTestClient::Connect(IPC::Listener* listener) {
-  channel_ =
-      IPC::ChannelMojo::Create(std::move(handle_), IPC::Channel::MODE_CLIENT,
-                               listener, base::ThreadTaskRunnerHandle::Get());
-  CHECK(channel_->Connect());
-}
-
-void IpcChannelMojoTestClient::Close() {
-  channel_->Close();
-
-  base::RunLoop run_loop;
-  base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
-                                                run_loop.QuitClosure());
-  run_loop.Run();
-}
diff --git a/ipc/ipc_test_base.h b/ipc/ipc_test_base.h
index 8a84fb67..86dc8fc8 100644
--- a/ipc/ipc_test_base.h
+++ b/ipc/ipc_test_base.h
@@ -16,8 +16,6 @@
 #include "ipc/ipc_channel_factory.h"
 #include "ipc/ipc_channel_proxy.h"
 #include "ipc/ipc_multiprocess_test.h"
-#include "mojo/edk/test/mojo_test_base.h"
-#include "mojo/edk/test/multiprocess_test_helper.h"
 
 namespace base {
 class MessageLoop;
@@ -135,90 +133,8 @@
   DISALLOW_COPY_AND_ASSIGN(IPCTestBase);
 };
 
-class IPCChannelMojoTestBase : public testing::Test {
- public:
-  IPCChannelMojoTestBase();
-  ~IPCChannelMojoTestBase() override;
-
-  void Init(const std::string& test_client_name);
-
-  bool WaitForClientShutdown();
-
-  void TearDown() override;
-
-  void CreateChannel(IPC::Listener* listener);
-
-  bool ConnectChannel();
-
-  void DestroyChannel();
-
-  IPC::Sender* sender() { return channel(); }
-  IPC::Channel* channel() { return channel_.get(); }
-  const base::Process& client_process() const { return helper_.test_child(); }
-
- protected:
-  mojo::ScopedMessagePipeHandle TakeHandle();
-
- private:
-  base::MessageLoop message_loop_;
-
-  mojo::ScopedMessagePipeHandle handle_;
-  mojo::edk::test::MultiprocessTestHelper helper_;
-
-  std::unique_ptr<IPC::Channel> channel_;
-
-  DISALLOW_COPY_AND_ASSIGN(IPCChannelMojoTestBase);
-};
-
-class IpcChannelMojoTestClient {
- public:
-  IpcChannelMojoTestClient();
-  ~IpcChannelMojoTestClient();
-
-  void Init(mojo::ScopedMessagePipeHandle handle);
-
-  void Connect(IPC::Listener* listener);
-
-  void Close();
-
-  IPC::Channel* channel() const { return channel_.get(); }
-
- private:
-  base::MessageLoopForIO main_message_loop_;
-  mojo::ScopedMessagePipeHandle handle_;
-  std::unique_ptr<IPC::Channel> channel_;
-};
-
 // Use this to declare the client side for tests using IPCTestBase.
 #define MULTIPROCESS_IPC_TEST_CLIENT_MAIN(test_client_name) \
     MULTIPROCESS_IPC_TEST_MAIN(test_client_name ## TestClientMain)
 
-// Use this to declare the client side for tests using IPCChannelMojoTestBase
-// when a custom test fixture class is required in the client. |test_base| must
-// be derived from IpcChannelMojoTestClient.
-#define DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE(client_name,  \
-                                                                test_base)    \
-  class client_name##_MainFixture : public test_base {                        \
-   public:                                                                    \
-    void Main();                                                              \
-  };                                                                          \
-  MULTIPROCESS_TEST_MAIN_WITH_SETUP(                                          \
-      client_name##TestChildMain,                                             \
-      ::mojo::edk::test::MultiprocessTestHelper::ChildSetup) {                \
-    client_name##_MainFixture test;                                           \
-    test.Init(                                                                \
-        std::move(mojo::edk::test::MultiprocessTestHelper::primordial_pipe)); \
-    test.Main();                                                              \
-    return (::testing::Test::HasFatalFailure() ||                             \
-            ::testing::Test::HasNonfatalFailure())                            \
-               ? 1                                                            \
-               : 0;                                                           \
-  }                                                                           \
-  void client_name##_MainFixture::Main()
-
-// Use this to declare the client side for tests using IPCChannelMojoTestBase.
-#define DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(client_name)   \
-  DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT_WITH_CUSTOM_FIXTURE( \
-      client_name, IpcChannelMojoTestClient)
-
 #endif  // IPC_IPC_TEST_BASE_H_
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc
index 67253aa..07a920c 100644
--- a/ipc/sync_socket_unittest.cc
+++ b/ipc/sync_socket_unittest.cc
@@ -109,12 +109,16 @@
 
 // Runs the fuzzing server child mode. Returns when the preset number of
 // messages have been received.
-DEFINE_IPC_CHANNEL_MOJO_TEST_CLIENT(SyncSocketServerClient) {
+MULTIPROCESS_IPC_TEST_CLIENT_MAIN(SyncSocketServerClient) {
+  base::MessageLoopForIO main_message_loop;
   SyncSocketServerListener listener;
-  Connect(&listener);
-  listener.Init(channel());
+  std::unique_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
+      IPCTestBase::GetChannelName("SyncSocketServerClient"), &listener,
+      main_message_loop.task_runner()));
+  EXPECT_TRUE(channel->Connect());
+  listener.Init(channel.get());
   base::RunLoop().Run();
-  Close();
+  return 0;
 }
 
 // The SyncSocket client listener only processes one sort of message,
@@ -162,13 +166,15 @@
   DISALLOW_COPY_AND_ASSIGN(SyncSocketClientListener);
 };
 
-using SyncSocketTest = IPCChannelMojoTestBase;
+class SyncSocketTest : public IPCTestBase {
+};
 
 TEST_F(SyncSocketTest, SanityTest) {
   Init("SyncSocketServerClient");
 
   SyncSocketClientListener listener;
   CreateChannel(&listener);
+  ASSERT_TRUE(StartClient());
   // Create a pair of SyncSockets.
   base::SyncSocket pair[2];
   base::SyncSocket::CreatePair(&pair[0], &pair[1]);