Move scoped_test_dir.* and test_io_thread.* from edk/test to edk/system/test.

R=vardhan@google.com

Review URL: https://codereview.chromium.org/1427633003 .
diff --git a/mojo/edk/embedder/embedder_unittest.cc b/mojo/edk/embedder/embedder_unittest.cc
index cbb6982..8f39b15 100644
--- a/mojo/edk/embedder/embedder_unittest.cc
+++ b/mojo/edk/embedder/embedder_unittest.cc
@@ -17,20 +17,19 @@
 #include "mojo/edk/embedder/platform_channel_pair.h"
 #include "mojo/edk/embedder/test_embedder.h"
 #include "mojo/edk/system/mutex.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
 #include "mojo/edk/test/scoped_ipc_support.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/public/c/system/core.h"
 #include "mojo/public/cpp/system/handle.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "mojo/public/cpp/system/message_pipe.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+using mojo::system::test::TestIOThread;
+
 namespace mojo {
-
-using test::TestIOThread;
-
 namespace embedder {
 namespace {
 
diff --git a/mojo/edk/embedder/platform_channel_pair_unittest.cc b/mojo/edk/embedder/platform_channel_pair_unittest.cc
index 7c28594..9a48c0e 100644
--- a/mojo/edk/embedder/platform_channel_pair_unittest.cc
+++ b/mojo/edk/embedder/platform_channel_pair_unittest.cc
@@ -21,7 +21,7 @@
 #include "mojo/edk/embedder/platform_handle.h"
 #include "mojo/edk/embedder/platform_handle_vector.h"
 #include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/edk/test/scoped_test_dir.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "mojo/public/cpp/system/macros.h"
@@ -127,7 +127,7 @@
 }
 
 TEST_F(PlatformChannelPairTest, SendReceiveFDs) {
-  mojo::test::ScopedTestDir test_dir;
+  mojo::system::test::ScopedTestDir test_dir;
 
   static const char kHello[] = "hello";
 
@@ -190,7 +190,7 @@
 }
 
 TEST_F(PlatformChannelPairTest, AppendReceivedFDs) {
-  mojo::test::ScopedTestDir test_dir;
+  mojo::system::test::ScopedTestDir test_dir;
 
   static const char kHello[] = "hello";
 
diff --git a/mojo/edk/system/channel_test_base.cc b/mojo/edk/system/channel_test_base.cc
index 1069e79..f2a93cd 100644
--- a/mojo/edk/system/channel_test_base.cc
+++ b/mojo/edk/system/channel_test_base.cc
@@ -16,7 +16,7 @@
 namespace test {
 
 ChannelTestBase::ChannelTestBase()
-    : io_thread_(mojo::test::TestIOThread::StartMode::AUTO) {}
+    : io_thread_(TestIOThread::StartMode::AUTO) {}
 
 ChannelTestBase::~ChannelTestBase() {
 }
diff --git a/mojo/edk/system/channel_test_base.h b/mojo/edk/system/channel_test_base.h
index 8b1b932..6c90c7c 100644
--- a/mojo/edk/system/channel_test_base.h
+++ b/mojo/edk/system/channel_test_base.h
@@ -11,7 +11,7 @@
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/ref_ptr.h"
-#include "mojo/edk/test/test_io_thread.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -43,7 +43,7 @@
   void ShutdownChannelOnIOThread(unsigned i);
   void ShutdownAndReleaseChannelOnIOThread(unsigned i);
 
-  mojo::test::TestIOThread* io_thread() { return &io_thread_; }
+  TestIOThread* io_thread() { return &io_thread_; }
   Channel* channel(unsigned i) { return channels_[i].get(); }
   RefPtr<Channel>* mutable_channel(unsigned i) { return &channels_[i]; }
 
@@ -51,7 +51,7 @@
   void SetUpOnIOThread();
 
   embedder::SimplePlatformSupport platform_support_;
-  mojo::test::TestIOThread io_thread_;
+  TestIOThread io_thread_;
   std::unique_ptr<RawChannel> raw_channels_[2];
   RefPtr<Channel> channels_[2];
 
diff --git a/mojo/edk/system/data_pipe_impl_unittest.cc b/mojo/edk/system/data_pipe_impl_unittest.cc
index 2225851..5fbd20e 100644
--- a/mojo/edk/system/data_pipe_impl_unittest.cc
+++ b/mojo/edk/system/data_pipe_impl_unittest.cc
@@ -27,9 +27,9 @@
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/ref_ptr.h"
 #include "mojo/edk/system/test/sleep.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -224,7 +224,7 @@
 class RemoteDataPipeImplTestHelper : public DataPipeImplTestHelper {
  public:
   RemoteDataPipeImplTestHelper()
-      : io_thread_(mojo::test::TestIOThread::StartMode::AUTO) {}
+      : io_thread_(test::TestIOThread::StartMode::AUTO) {}
   ~RemoteDataPipeImplTestHelper() override {}
 
   void SetUp() override {
@@ -345,7 +345,7 @@
   }
 
   embedder::SimplePlatformSupport platform_support_;
-  mojo::test::TestIOThread io_thread_;
+  test::TestIOThread io_thread_;
   RefPtr<Channel> channels_[2];
   RefPtr<MessagePipe> message_pipes_[2];
 
diff --git a/mojo/edk/system/ipc_support_unittest.cc b/mojo/edk/system/ipc_support_unittest.cc
index 73acd19..2ca97a6 100644
--- a/mojo/edk/system/ipc_support_unittest.cc
+++ b/mojo/edk/system/ipc_support_unittest.cc
@@ -23,18 +23,15 @@
 #include "mojo/edk/system/message_pipe.h"
 #include "mojo/edk/system/message_pipe_dispatcher.h"
 #include "mojo/edk/system/process_identifier.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/system/waiter.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace mojo {
-
-using test::TestIOThread;
-
 namespace system {
 namespace {
 
@@ -161,7 +158,7 @@
 // Represents the master's side of its connection to a slave.
 class TestSlaveConnection {
  public:
-  TestSlaveConnection(TestIOThread* test_io_thread,
+  TestSlaveConnection(test::TestIOThread* test_io_thread,
                       IPCSupport* master_ipc_support)
       : test_io_thread_(test_io_thread),
         master_ipc_support_(master_ipc_support),
@@ -207,7 +204,7 @@
   const ConnectionIdentifier& connection_id() const { return connection_id_; }
 
  private:
-  TestIOThread* const test_io_thread_;
+  test::TestIOThread* const test_io_thread_;
   IPCSupport* const master_ipc_support_;
   const ConnectionIdentifier connection_id_;
   // The master's message pipe dispatcher.
@@ -225,7 +222,7 @@
  public:
   // Note: Before destruction, |ShutdownIPCSupport()| must be called.
   TestSlave(embedder::PlatformSupport* platform_support,
-            TestIOThread* test_io_thread,
+            test::TestIOThread* test_io_thread,
             embedder::ScopedPlatformHandle platform_handle)
       : test_io_thread_(test_io_thread),
         slave_ipc_support_(platform_support,
@@ -273,7 +270,7 @@
   }
 
  private:
-  TestIOThread* const test_io_thread_;
+  test::TestIOThread* const test_io_thread_;
   TestSlaveProcessDelegate slave_process_delegate_;
   IPCSupport slave_ipc_support_;
   base::WaitableEvent event_;
@@ -285,7 +282,7 @@
 class TestSlaveSetup {
  public:
   TestSlaveSetup(embedder::SimplePlatformSupport* platform_support,
-                 TestIOThread* test_io_thread,
+                 test::TestIOThread* test_io_thread,
                  TestMasterProcessDelegate* master_process_delegate,
                  IPCSupport* master_ipc_support)
       : platform_support_(platform_support),
@@ -351,7 +348,7 @@
 
  private:
   embedder::SimplePlatformSupport* const platform_support_;
-  TestIOThread* const test_io_thread_;
+  test::TestIOThread* const test_io_thread_;
   TestMasterProcessDelegate* const master_process_delegate_;
   IPCSupport* const master_ipc_support_;
 
@@ -368,7 +365,7 @@
  public:
   // Note: Run master process delegate methods on the I/O thread.
   IPCSupportTest()
-      : test_io_thread_(TestIOThread::StartMode::AUTO),
+      : test_io_thread_(test::TestIOThread::StartMode::AUTO),
         master_ipc_support_(&platform_support_,
                             embedder::ProcessType::MASTER,
                             test_io_thread_.task_runner(),
@@ -394,7 +391,7 @@
   embedder::SimplePlatformSupport& platform_support() {
     return platform_support_;
   }
-  TestIOThread& test_io_thread() { return test_io_thread_; }
+  test::TestIOThread& test_io_thread() { return test_io_thread_; }
   TestMasterProcessDelegate& master_process_delegate() {
     return master_process_delegate_;
   }
@@ -402,7 +399,7 @@
 
  private:
   embedder::SimplePlatformSupport platform_support_;
-  TestIOThread test_io_thread_;
+  test::TestIOThread test_io_thread_;
 
   // All tests require a master.
   TestMasterProcessDelegate master_process_delegate_;
@@ -675,7 +672,7 @@
   ASSERT_TRUE(client_platform_handle.is_valid());
 
   embedder::SimplePlatformSupport platform_support;
-  TestIOThread test_io_thread(TestIOThread::StartMode::AUTO);
+  test::TestIOThread test_io_thread(test::TestIOThread::StartMode::AUTO);
   TestSlaveProcessDelegate slave_process_delegate;
   // Note: Run process delegate methods on the I/O thread.
   IPCSupport ipc_support(&platform_support, embedder::ProcessType::SLAVE,
diff --git a/mojo/edk/system/message_pipe_test_utils.cc b/mojo/edk/system/message_pipe_test_utils.cc
index 7fb142c..290ca72 100644
--- a/mojo/edk/system/message_pipe_test_utils.cc
+++ b/mojo/edk/system/message_pipe_test_utils.cc
@@ -38,7 +38,7 @@
 
 ChannelThread::ChannelThread(embedder::PlatformSupport* platform_support)
     : platform_support_(platform_support),
-      test_io_thread_(mojo::test::TestIOThread::StartMode::MANUAL) {}
+      test_io_thread_(TestIOThread::StartMode::MANUAL) {}
 
 ChannelThread::~ChannelThread() {
   Stop();
diff --git a/mojo/edk/system/message_pipe_test_utils.h b/mojo/edk/system/message_pipe_test_utils.h
index 0cdc96e..2472e37 100644
--- a/mojo/edk/system/message_pipe_test_utils.h
+++ b/mojo/edk/system/message_pipe_test_utils.h
@@ -8,8 +8,8 @@
 #include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/edk/system/channel.h"
 #include "mojo/edk/system/ref_ptr.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/test/multiprocess_test_helper.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
@@ -42,7 +42,7 @@
   void ShutdownChannelOnIOThread();
 
   embedder::PlatformSupport* const platform_support_;
-  mojo::test::TestIOThread test_io_thread_;
+  TestIOThread test_io_thread_;
   RefPtr<Channel> channel_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(ChannelThread);
diff --git a/mojo/edk/system/multiprocess_message_pipe_unittest.cc b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
index f9d4875..50b9ec7 100644
--- a/mojo/edk/system/multiprocess_message_pipe_unittest.cc
+++ b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
@@ -24,7 +24,7 @@
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/ref_ptr.h"
 #include "mojo/edk/system/shared_buffer_dispatcher.h"
-#include "mojo/edk/test/scoped_test_dir.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -446,7 +446,7 @@
       public testing::WithParamInterface<size_t> {};
 
 TEST_P(MultiprocessMessagePipeTestWithPipeCount, PlatformHandlePassing) {
-  mojo::test::ScopedTestDir test_dir;
+  test::ScopedTestDir test_dir;
 
   helper()->StartChild("CheckPlatformHandleFile");
 
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
index 7d70d75..1681979 100644
--- a/mojo/edk/system/platform_handle_dispatcher_unittest.cc
+++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -7,7 +7,7 @@
 #include <stdio.h>
 
 #include "base/memory/ref_counted.h"
-#include "mojo/edk/test/scoped_test_dir.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -17,7 +17,7 @@
 namespace {
 
 TEST(PlatformHandleDispatcherTest, Basic) {
-  mojo::test::ScopedTestDir test_dir;
+  test::ScopedTestDir test_dir;
 
   static const char kHelloWorld[] = "hello world";
 
@@ -56,7 +56,7 @@
 }
 
 TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
-  mojo::test::ScopedTestDir test_dir;
+  test::ScopedTestDir test_dir;
 
   static const char kFooBar[] = "foo bar";
 
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
index 2a0916b..1b5e7e2 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -20,11 +20,11 @@
 #include "mojo/edk/system/message_in_transit.h"
 #include "mojo/edk/system/mutex.h"
 #include "mojo/edk/system/test/random.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/system/test/simple_test_thread.h"
 #include "mojo/edk/system/test/sleep.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/transport_data.h"
-#include "mojo/edk/test/scoped_test_dir.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/make_unique.h"
 #include "mojo/edk/util/scoped_file.h"
@@ -72,7 +72,7 @@
 
 class RawChannelTest : public testing::Test {
  public:
-  RawChannelTest() : io_thread_(mojo::test::TestIOThread::StartMode::MANUAL) {}
+  RawChannelTest() : io_thread_(test::TestIOThread::StartMode::MANUAL) {}
   ~RawChannelTest() override {}
 
   void SetUp() override {
@@ -89,12 +89,12 @@
   }
 
  protected:
-  mojo::test::TestIOThread* io_thread() { return &io_thread_; }
+  test::TestIOThread* io_thread() { return &io_thread_; }
 
   embedder::ScopedPlatformHandle handles[2];
 
  private:
-  mojo::test::TestIOThread io_thread_;
+  test::TestIOThread io_thread_;
 
   MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelTest);
 };
@@ -779,7 +779,7 @@
 };
 
 TEST_F(RawChannelTest, ReadWritePlatformHandles) {
-  mojo::test::ScopedTestDir test_dir;
+  test::ScopedTestDir test_dir;
 
   WriteOnlyRawChannelDelegate write_delegate;
   std::unique_ptr<RawChannel> rc_write(RawChannel::Create(handles[0].Pass()));
diff --git a/mojo/edk/system/remote_data_pipe_impl_unittest.cc b/mojo/edk/system/remote_data_pipe_impl_unittest.cc
index 69ac3f8..72283ff 100644
--- a/mojo/edk/system/remote_data_pipe_impl_unittest.cc
+++ b/mojo/edk/system/remote_data_pipe_impl_unittest.cc
@@ -23,9 +23,9 @@
 #include "mojo/edk/system/message_pipe.h"
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/ref_ptr.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/public/cpp/system/macros.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
@@ -39,8 +39,7 @@
 
 class RemoteDataPipeImplTest : public testing::Test {
  public:
-  RemoteDataPipeImplTest()
-      : io_thread_(mojo::test::TestIOThread::StartMode::AUTO) {}
+  RemoteDataPipeImplTest() : io_thread_(test::TestIOThread::StartMode::AUTO) {}
   ~RemoteDataPipeImplTest() override {}
 
   void SetUp() override {
@@ -114,7 +113,7 @@
   }
 
   embedder::SimplePlatformSupport platform_support_;
-  mojo::test::TestIOThread io_thread_;
+  test::TestIOThread io_thread_;
   RefPtr<Channel> channels_[2];
   RefPtr<MessagePipe> message_pipes_[2];
 
diff --git a/mojo/edk/system/remote_message_pipe_unittest.cc b/mojo/edk/system/remote_message_pipe_unittest.cc
index 8d02506..31488d5 100644
--- a/mojo/edk/system/remote_message_pipe_unittest.cc
+++ b/mojo/edk/system/remote_message_pipe_unittest.cc
@@ -27,11 +27,11 @@
 #include "mojo/edk/system/raw_channel.h"
 #include "mojo/edk/system/ref_ptr.h"
 #include "mojo/edk/system/shared_buffer_dispatcher.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 #include "mojo/edk/system/test/sleep.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 #include "mojo/edk/system/test/timeouts.h"
 #include "mojo/edk/system/waiter.h"
-#include "mojo/edk/test/scoped_test_dir.h"
-#include "mojo/edk/test/test_io_thread.h"
 #include "mojo/edk/test/test_utils.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "mojo/public/cpp/system/macros.h"
@@ -47,8 +47,7 @@
 
 class RemoteMessagePipeTest : public testing::Test {
  public:
-  RemoteMessagePipeTest()
-      : io_thread_(mojo::test::TestIOThread::StartMode::AUTO) {}
+  RemoteMessagePipeTest() : io_thread_(test::TestIOThread::StartMode::AUTO) {}
   ~RemoteMessagePipeTest() override {}
 
   void SetUp() override {
@@ -90,7 +89,7 @@
   }
 
   embedder::PlatformSupport* platform_support() { return &platform_support_; }
-  mojo::test::TestIOThread* io_thread() { return &io_thread_; }
+  test::TestIOThread* io_thread() { return &io_thread_; }
   // Warning: It's up to the caller to ensure that the returned channel
   // is/remains valid.
   Channel* channels(size_t i) { return channels_[i].get(); }
@@ -161,7 +160,7 @@
   }
 
   embedder::SimplePlatformSupport platform_support_;
-  mojo::test::TestIOThread io_thread_;
+  test::TestIOThread io_thread_;
   embedder::ScopedPlatformHandle platform_handles_[2];
   RefPtr<Channel> channels_[2];
 
@@ -1014,7 +1013,7 @@
 }
 
 TEST_F(RemoteMessagePipeTest, PlatformHandlePassing) {
-  mojo::test::ScopedTestDir test_dir;
+  test::ScopedTestDir test_dir;
 
   static const char kHello[] = "hello";
   static const char kWorld[] = "world";
diff --git a/mojo/edk/system/test/BUILD.gn b/mojo/edk/system/test/BUILD.gn
index a31c3da..e91db65 100644
--- a/mojo/edk/system/test/BUILD.gn
+++ b/mojo/edk/system/test/BUILD.gn
@@ -10,12 +10,16 @@
   sources = [
     "random.cc",
     "random.h",
+    "scoped_test_dir.cc",
+    "scoped_test_dir.h",
     "simple_test_thread.cc",
     "simple_test_thread.h",
     "sleep.cc",
     "sleep.h",
     "stopwatch.cc",
     "stopwatch.h",
+    "test_io_thread.cc",
+    "test_io_thread.h",
     "timeouts.cc",
     "timeouts.h",
   ]
@@ -30,7 +34,10 @@
     "//base/test:test_support",
   ]
 
-  mojo_edk_deps = [ "mojo/edk/embedder:platform" ]
+  mojo_edk_deps = [
+    "mojo/edk/embedder:platform",
+    "mojo/edk/util",
+  ]
 }
 
 mojo_edk_source_set("unittests") {
diff --git a/mojo/edk/test/scoped_test_dir.cc b/mojo/edk/system/test/scoped_test_dir.cc
similarity index 87%
rename from mojo/edk/test/scoped_test_dir.cc
rename to mojo/edk/system/test/scoped_test_dir.cc
index 5bd768b..7f7f2bc 100644
--- a/mojo/edk/test/scoped_test_dir.cc
+++ b/mojo/edk/system/test/scoped_test_dir.cc
@@ -2,13 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/edk/test/scoped_test_dir.h"
+#include "mojo/edk/system/test/scoped_test_dir.h"
 
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
 
 namespace mojo {
+namespace system {
 namespace test {
 
 ScopedTestDir::ScopedTestDir() {
@@ -24,4 +25,5 @@
 }
 
 }  // namespace test
+}  // namespace system
 }  // namespace mojo
diff --git a/mojo/edk/test/scoped_test_dir.h b/mojo/edk/system/test/scoped_test_dir.h
similarity index 79%
rename from mojo/edk/test/scoped_test_dir.h
rename to mojo/edk/system/test/scoped_test_dir.h
index 4db372f..9f4db1b 100644
--- a/mojo/edk/test/scoped_test_dir.h
+++ b/mojo/edk/system/test/scoped_test_dir.h
@@ -2,14 +2,15 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_EDK_TEST_SCOPED_TEST_DIR_H_
-#define MOJO_EDK_TEST_SCOPED_TEST_DIR_H_
+#ifndef MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_
+#define MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_
 
 #include "base/files/scoped_temp_dir.h"
 #include "mojo/edk/util/scoped_file.h"
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
+namespace system {
 namespace test {
 
 // Creates/destroyes a temporary directory for test purposes. (Unlike
@@ -28,6 +29,7 @@
 };
 
 }  // namespace test
+}  // namespace system
 }  // namespace mojo
 
-#endif  // MOJO_EDK_TEST_SCOPED_TEST_DIR_H_
+#endif  // MOJO_EDK_SYSTEM_TEST_SCOPED_TEST_DIR_H_
diff --git a/mojo/edk/test/test_io_thread.cc b/mojo/edk/system/test/test_io_thread.cc
similarity index 94%
rename from mojo/edk/test/test_io_thread.cc
rename to mojo/edk/system/test/test_io_thread.cc
index b8b4745..ee11ff3 100644
--- a/mojo/edk/test/test_io_thread.cc
+++ b/mojo/edk/system/test/test_io_thread.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "mojo/edk/test/test_io_thread.h"
+#include "mojo/edk/system/test/test_io_thread.h"
 
 #include "base/bind.h"
 #include "base/callback.h"
@@ -10,6 +10,7 @@
 #include "base/synchronization/waitable_event.h"
 
 namespace mojo {
+namespace system {
 namespace test {
 
 namespace {
@@ -63,4 +64,5 @@
 }
 
 }  // namespace test
+}  // namespace system
 }  // namespace mojo
diff --git a/mojo/edk/test/test_io_thread.h b/mojo/edk/system/test/test_io_thread.h
similarity index 89%
rename from mojo/edk/test/test_io_thread.h
rename to mojo/edk/system/test/test_io_thread.h
index e85672c..8b0d6e3 100644
--- a/mojo/edk/test/test_io_thread.h
+++ b/mojo/edk/system/test/test_io_thread.h
@@ -2,8 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef MOJO_EDK_TEST_TEST_IO_THREAD_H_
-#define MOJO_EDK_TEST_TEST_IO_THREAD_H_
+#ifndef MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
+#define MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
 
 #include "base/callback_forward.h"
 #include "base/memory/ref_counted.h"
@@ -12,6 +12,7 @@
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
+namespace system {
 namespace test {
 
 // Class to help create/run threads with I/O |MessageLoop|s in tests.
@@ -50,6 +51,7 @@
 };
 
 }  // namespace test
+}  // namespace system
 }  // namespace mojo
 
-#endif  // MOJO_EDK_TEST_TEST_IO_THREAD_H_
+#endif  // MOJO_EDK_SYSTEM_TEST_TEST_IO_THREAD_H_
diff --git a/mojo/edk/test/BUILD.gn b/mojo/edk/test/BUILD.gn
index 1d52266..8fab4ee 100644
--- a/mojo/edk/test/BUILD.gn
+++ b/mojo/edk/test/BUILD.gn
@@ -11,10 +11,6 @@
     "multiprocess_test_helper.h",
     "scoped_ipc_support.cc",
     "scoped_ipc_support.h",
-    "scoped_test_dir.cc",
-    "scoped_test_dir.h",
-    "test_io_thread.cc",
-    "test_io_thread.h",
     "test_utils.cc",
     "test_utils.h",
   ]