Fork //base/gtest_prod_util.h into //mojo/edk/util/gtest_prod_utils.h.

* Add an 's' (since there's more than one util).
* Remove the (source) dependency on gtest, which seems bad/dangerous.

R=vardhan@google.com

Review URL: https://codereview.chromium.org/1681173002 .
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 91c3c18..8b1f732 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -67,7 +67,9 @@
        'base/gtest_prod_util.h and use FRIEND_TEST_ALL_PREFIXES() instead.',
       ),
       False,
-      (),
+      (
+        r"^mojo/edk/util/gtest_prod_utils\.h$",
+      ),
     ),
     (
       'ScopedAllowIO',
diff --git a/mojo/edk/system/channel_endpoint_id.h b/mojo/edk/system/channel_endpoint_id.h
index cf968c1..638bfcf 100644
--- a/mojo/edk/system/channel_endpoint_id.h
+++ b/mojo/edk/system/channel_endpoint_id.h
@@ -11,7 +11,7 @@
 #include <functional>
 #include <ostream>
 
-#include "base/gtest_prod_util.h"
+#include "mojo/edk/util/gtest_prod_utils.h"
 #include "mojo/public/cpp/system/macros.h"
 
 namespace mojo {
diff --git a/mojo/edk/system/ipc_support.h b/mojo/edk/system/ipc_support.h
index 46ea1cd..58ac9cf 100644
--- a/mojo/edk/system/ipc_support.h
+++ b/mojo/edk/system/ipc_support.h
@@ -8,7 +8,6 @@
 #include <functional>
 #include <memory>
 
-#include "base/gtest_prod_util.h"
 #include "mojo/edk/embedder/process_type.h"
 #include "mojo/edk/embedder/slave_info.h"
 #include "mojo/edk/platform/scoped_platform_handle.h"
@@ -16,6 +15,7 @@
 #include "mojo/edk/system/channel_id.h"
 #include "mojo/edk/system/connection_identifier.h"
 #include "mojo/edk/system/process_identifier.h"
+#include "mojo/edk/util/gtest_prod_utils.h"
 #include "mojo/edk/util/ref_ptr.h"
 #include "mojo/public/cpp/system/macros.h"
 
diff --git a/mojo/edk/util/BUILD.gn b/mojo/edk/util/BUILD.gn
index 2024194..8ad82d7 100644
--- a/mojo/edk/util/BUILD.gn
+++ b/mojo/edk/util/BUILD.gn
@@ -14,6 +14,7 @@
     "command_line.h",
     "cond_var.cc",
     "cond_var.h",
+    "gtest_prod_utils.h",
     "logging_internal.cc",
     "logging_internal.h",
     "make_unique.h",
diff --git a/mojo/edk/util/gtest_prod_utils.h b/mojo/edk/util/gtest_prod_utils.h
new file mode 100644
index 0000000..b02baaa
--- /dev/null
+++ b/mojo/edk/util/gtest_prod_utils.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Utilities for (non-test) code to help with testing that code with gtest.
+// (Note that this file does not imply any dependency on gtest.)
+
+#ifndef MOJO_EDK_UTIL_GTEST_PROD_UTILS_H_
+#define MOJO_EDK_UTIL_GTEST_PROD_UTILS_H_
+
+// Like gtest's |FRIEND_TEST()| macro, but friends the given test with all
+// possible prefixes, so that when the test prefix is changed the friend
+// declarations won't need to be updated. For example:
+//
+//   class MyClass {
+//    private:
+//     void MyMethod();
+//     FRIEND_TEST_ALL_PREFIXES(MyClassTest, MyMethod);
+//   };
+#define FRIEND_TEST_ALL_PREFIXES(test_case_name, test_name)    \
+  friend class test_case_name##_##test_name##_Test;            \
+  friend class test_case_name##_##DISABLED_##test_name##_Test; \
+  friend class test_case_name##_##FLAKY_##test_name##_Test
+
+// Macro to forward-declare tests (with all possible prefixes).
+//
+// C++ compilers will refuse to compile the following code:
+//
+//   namespace foo {
+//   class MyClass {
+//    private:
+//     FRIEND_TEST_ALL_PREFIXES(MyClassTest, TestMethod);
+//     bool private_var;
+//   };
+//   }  // namespace foo
+//
+//   class MyClassTest::TestMethod() {
+//     foo::MyClass foo_class;
+//     foo_class.private_var = true;
+//   }
+//
+// unless you forward-declare |MyClassTest::TestMethod| outside of the |foo|
+// namespace. Use |FORWARD_DECLARE_TEST()| to do this. For example, in the code,
+// add the following at the top:
+//
+//   FORWARD_DECLARE_TEST(MyClassTest, TestMethod);
+#define FORWARD_DECLARE_TEST(test_case_name, test_name) \
+  class test_case_name##_##test_name##_Test;            \
+  class test_case_name##_##DISABLED_##test_name##_Test; \
+  class test_case_name##_##FLAKY_##test_name##_Test
+
+#endif  // MOJO_EDK_UTIL_GTEST_PROD_UTILS_H_