Rationalize mojo_public_*tests targets.

* All the C++ tests become mojo_public_cpp_*_{unit,perf}tests.
* All the C tests become mojo_public_c_*_{unit,perf}tests.
* mojo_public_system_unittests previously contained both C and C++
  tests; split it into two.
* Rename some of the C++ tests previously in
  mojo_public_system_unittests (they had "Cpp" in their name, to avoid
  colliding with C tests).
* Remove an unnecessary dependency of mojo_public_c_system_perftests on
  mojo/public/cpp/system/macros.h.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/2104183002 .
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index 7028dfa..575910d 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -95,30 +95,22 @@
 group("public_tests") {
   testonly = true
   deps = [
-    ":mojo_public_application_unittests",
-    ":mojo_public_bindings_perftests",
-    ":mojo_public_bindings_unittests",
+    # Unit tests:
     ":mojo_public_c_bindings_unittests",
-    ":mojo_public_environment_unittests",
-    ":mojo_public_system_perftests",
-    ":mojo_public_system_unittests",
-    ":mojo_public_utility_unittests",
+    ":mojo_public_c_system_unittests",
+    ":mojo_public_cpp_application_unittests",
+    ":mojo_public_cpp_bindings_unittests",
+    ":mojo_public_cpp_environment_unittests",
+    ":mojo_public_cpp_system_unittests",
+    ":mojo_public_cpp_utility_unittests",
+
+    # Perf tests:
+    ":mojo_public_c_system_perftests",
+    ":mojo_public_cpp_bindings_perftests",
   ]
 }
 
-test("mojo_public_application_unittests") {
-  deps = [
-    "//mojo/edk/test:run_all_unittests",
-    "//mojo/public/cpp/application/tests",
-  ]
-}
-
-test("mojo_public_bindings_unittests") {
-  deps = [
-    "//mojo/edk/test:run_all_unittests",
-    "//mojo/public/cpp/bindings/tests",
-  ]
-}
+# C unit tests:
 
 test("mojo_public_c_bindings_unittests") {
   deps = [
@@ -127,37 +119,64 @@
   ]
 }
 
-test("mojo_public_bindings_perftests") {
+test("mojo_public_c_system_unittests") {
   deps = [
-    "//mojo/edk/test:run_all_perftests",
-    "//mojo/public/cpp/bindings/tests:perftests",
+    "//mojo/edk/test:run_all_unittests",
+    "//mojo/public/c/system/tests",
   ]
 }
 
-test("mojo_public_environment_unittests") {
+# C++ unit tests:
+
+test("mojo_public_cpp_application_unittests") {
+  deps = [
+    "//mojo/edk/test:run_all_unittests",
+    "//mojo/public/cpp/application/tests",
+  ]
+}
+
+test("mojo_public_cpp_bindings_unittests") {
+  deps = [
+    "//mojo/edk/test:run_all_unittests",
+    "//mojo/public/cpp/bindings/tests",
+  ]
+}
+
+test("mojo_public_cpp_environment_unittests") {
   deps = [
     "//mojo/edk/test:run_all_unittests",
     "//mojo/public/cpp/environment/tests",
   ]
 }
 
-test("mojo_public_system_perftests") {
-  deps = [
-    "//mojo/edk/test:run_all_perftests",
-    "//mojo/public/c/system/tests:perftests",
-  ]
-}
-
-test("mojo_public_system_unittests") {
+test("mojo_public_cpp_system_unittests") {
   deps = [
     "//mojo/edk/test:run_all_unittests",
     "//mojo/public/cpp/system/tests",
   ]
 }
 
-test("mojo_public_utility_unittests") {
+test("mojo_public_cpp_utility_unittests") {
   deps = [
     "//mojo/edk/test:run_all_unittests",
     "//mojo/public/cpp/utility/tests",
   ]
 }
+
+# C perf tests:
+
+test("mojo_public_c_system_perftests") {
+  deps = [
+    "//mojo/edk/test:run_all_perftests",
+    "//mojo/public/c/system/tests:perftests",
+  ]
+}
+
+# C++ perf tests:
+
+test("mojo_public_cpp_bindings_perftests") {
+  deps = [
+    "//mojo/edk/test:run_all_perftests",
+    "//mojo/public/cpp/bindings/tests:perftests",
+  ]
+}
diff --git a/mojo/public/c/system/tests/BUILD.gn b/mojo/public/c/system/tests/BUILD.gn
index 5e4a822..cd38a25 100644
--- a/mojo/public/c/system/tests/BUILD.gn
+++ b/mojo/public/c/system/tests/BUILD.gn
@@ -7,9 +7,6 @@
 mojo_sdk_source_set("tests") {
   testonly = true
 
-  mojo_sdk_visibility =
-      [ "mojo/public/cpp/system/tests:mojo_public_system_unittests" ]
-
   cflags_c = [ "-Wundef" ]
 
   sources = [
@@ -74,7 +71,7 @@
 
   mojo_sdk_deps = [
     "mojo/public/c/environment",
-    "mojo/public/cpp/system",
+    "mojo/public/c/system",
     "mojo/public/cpp/test_support",
   ]
 }
diff --git a/mojo/public/c/system/tests/message_pipe_perftest.cc b/mojo/public/c/system/tests/message_pipe_perftest.cc
index a4329cf..05fd00e 100644
--- a/mojo/public/c/system/tests/message_pipe_perftest.cc
+++ b/mojo/public/c/system/tests/message_pipe_perftest.cc
@@ -13,11 +13,11 @@
 #include <thread>
 
 #include "mojo/public/c/system/handle.h"
+#include "mojo/public/c/system/macros.h"
 #include "mojo/public/c/system/result.h"
 #include "mojo/public/c/system/tests/perftest_utils.h"
 #include "mojo/public/c/system/time.h"
 #include "mojo/public/c/system/wait.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/public/cpp/test_support/test_support.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/mojo/public/c/system/tests/perftest_utils.cc b/mojo/public/c/system/tests/perftest_utils.cc
index 44b1671..43ccb5f 100644
--- a/mojo/public/c/system/tests/perftest_utils.cc
+++ b/mojo/public/c/system/tests/perftest_utils.cc
@@ -8,8 +8,8 @@
 #include <stddef.h>
 #include <time.h>
 
+#include "mojo/public/c/system/macros.h"
 #include "mojo/public/c/system/time.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/public/cpp/test_support/test_support.h"
 
 namespace mojo {
diff --git a/mojo/public/c/system/tests/wait_set_perftest.cc b/mojo/public/c/system/tests/wait_set_perftest.cc
index 197ccb6..40f72af 100644
--- a/mojo/public/c/system/tests/wait_set_perftest.cc
+++ b/mojo/public/c/system/tests/wait_set_perftest.cc
@@ -15,10 +15,10 @@
 #include <vector>
 
 #include "mojo/public/c/system/handle.h"
+#include "mojo/public/c/system/macros.h"
 #include "mojo/public/c/system/message_pipe.h"
 #include "mojo/public/c/system/result.h"
 #include "mojo/public/c/system/tests/perftest_utils.h"
-#include "mojo/public/cpp/system/macros.h"
 #include "mojo/public/cpp/test_support/test_support.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
diff --git a/mojo/public/cpp/system/tests/BUILD.gn b/mojo/public/cpp/system/tests/BUILD.gn
index 3469fbf..fdfe73b 100644
--- a/mojo/public/cpp/system/tests/BUILD.gn
+++ b/mojo/public/cpp/system/tests/BUILD.gn
@@ -16,8 +16,5 @@
     "//testing/gtest",
   ]
 
-  mojo_sdk_deps = [
-    "mojo/public/c/system/tests",
-    "mojo/public/cpp/system",
-  ]
+  mojo_sdk_deps = [ "mojo/public/cpp/system" ]
 }
diff --git a/mojo/public/cpp/system/tests/core_unittest.cc b/mojo/public/cpp/system/tests/core_unittest.cc
index 8dc592f..05769ca 100644
--- a/mojo/public/cpp/system/tests/core_unittest.cc
+++ b/mojo/public/cpp/system/tests/core_unittest.cc
@@ -3,8 +3,7 @@
 // found in the LICENSE file.
 
 // This file tests the C++ Mojo system core wrappers.
-// TODO(vtl): Maybe rename "CoreCppTest" -> "CoreTest" if/when this gets
-// compiled into a different binary from the C API tests.
+// TODO(vtl): Split this test into more reasonable units/files.
 
 #include <stddef.h>
 
@@ -23,13 +22,13 @@
 namespace mojo {
 namespace {
 
-TEST(CoreCppTest, GetTimeTicksNow) {
+TEST(CoreTest, GetTimeTicksNow) {
   const MojoTimeTicks start = GetTimeTicksNow();
   EXPECT_NE(static_cast<MojoTimeTicks>(0), start)
       << "GetTimeTicksNow should return nonzero value";
 }
 
-TEST(CoreCppTest, Basic) {
+TEST(CoreTest, Basic) {
   // Basic |Handle| implementation:
   {
     EXPECT_EQ(MOJO_HANDLE_INVALID, kInvalidHandleValue);
@@ -365,7 +364,7 @@
   // TODO(vtl): Test |reset()| more thoroughly?
 }
 
-TEST(CoreCppTest, TearDownWithMessagesEnqueued) {
+TEST(CoreTest, TearDownWithMessagesEnqueued) {
   // Tear down a message pipe which still has a message enqueued, with the
   // message also having a valid message pipe handle.
   {
@@ -473,7 +472,7 @@
   }
 }
 
-TEST(CoreCppTest, ScopedHandleMoveCtor) {
+TEST(CoreTest, ScopedHandleMoveCtor) {
   ScopedSharedBufferHandle buffer1;
   EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer1));
   EXPECT_TRUE(buffer1.is_valid());
@@ -490,7 +489,7 @@
   EXPECT_FALSE(buffer2.is_valid());
 }
 
-TEST(CoreCppTest, ScopedHandleMoveCtorSelf) {
+TEST(CoreTest, ScopedHandleMoveCtorSelf) {
   ScopedSharedBufferHandle buffer1;
   EXPECT_EQ(MOJO_RESULT_OK, CreateSharedBuffer(nullptr, 1024, &buffer1));
   EXPECT_TRUE(buffer1.is_valid());
@@ -500,7 +499,7 @@
   EXPECT_TRUE(buffer1.is_valid());
 }
 
-TEST(CoreCppTest, WaitManyResult) {
+TEST(CoreTest, WaitManyResult) {
   {
     WaitManyResult wmr(MOJO_RESULT_OK);
     EXPECT_FALSE(wmr.IsIndexValid());
@@ -544,7 +543,7 @@
   }
 }
 
-TEST(CoreCppTest, DataPipe) {
+TEST(CoreTest, DataPipe) {
   ScopedDataPipeProducerHandle ph;
   ScopedDataPipeConsumerHandle ch;
 
diff --git a/mojo/public/cpp/system/tests/macros_unittest.cc b/mojo/public/cpp/system/tests/macros_unittest.cc
index 8ee8490..92c3f51 100644
--- a/mojo/public/cpp/system/tests/macros_unittest.cc
+++ b/mojo/public/cpp/system/tests/macros_unittest.cc
@@ -5,8 +5,6 @@
 // This file tests the C++ Mojo system macros and consists of "positive" tests,
 // i.e., those verifying that things work (without compile errors, or even
 // warnings if warnings are treated as errors).
-// TODO(vtl): Maybe rename "MacrosCppTest" -> "MacrosTest" if/when this gets
-// compiled into a different binary from the C API tests.
 // TODO(vtl): Fix no-compile tests (which are all disabled; crbug.com/105388)
 // and write some "negative" tests.
 
@@ -35,7 +33,7 @@
   void AlsoToBeOverridden() override {}
 };
 
-TEST(MacrosCppTest, Override) {
+TEST(MacrosTest, Override) {
   TestOverrideSubclass x;
   x.ToBeOverridden();
   x.AlsoToBeOverridden();
@@ -53,7 +51,7 @@
   MOJO_DISALLOW_COPY_AND_ASSIGN(TestDisallowCopyAndAssignClass);
 };
 
-TEST(MacrosCppTest, DisallowCopyAndAssign) {
+TEST(MacrosTest, DisallowCopyAndAssign) {
   TestDisallowCopyAndAssignClass x;
   x.NoOp();
   TestDisallowCopyAndAssignClass y(789);
@@ -65,7 +63,7 @@
 static_assert(MOJO_ARRAYSIZE(kGlobalArray) == 5u,
               "MOJO_ARRAY_SIZE() failed in static_assert()");
 
-TEST(MacrosCppTest, ArraySize) {
+TEST(MacrosTest, ArraySize) {
   double local_array[4] = {6.7, 7.8, 8.9, 9.0};
   // MSVS considers this local variable unused since MOJO_ARRAYSIZE only takes
   // the size of the type of the local and not the values itself.
@@ -108,7 +106,7 @@
   MOJO_MOVE_ONLY_TYPE(MoveOnlyInt);
 };
 
-TEST(MacrosCppTest, MoveOnlyType) {
+TEST(MacrosTest, MoveOnlyType) {
   MoveOnlyInt x(123);
   EXPECT_TRUE(x.is_set());
   EXPECT_EQ(123, x.value());
@@ -135,7 +133,7 @@
   return 123;
 }
 
-TEST(MacrosCppTest, IgnoreResult) {
+TEST(MacrosTest, IgnoreResult) {
   ignore_result(ReturnsIntYouMustUse());
 }
 
diff --git a/mojo/tools/data/unittests b/mojo/tools/data/unittests
index 8400e8c..e4c4390 100644
--- a/mojo/tools/data/unittests
+++ b/mojo/tools/data/unittests
@@ -27,20 +27,26 @@
 
   # Public tests:
   {
-    "test": "mojo_public_bindings_unittests",
-    "cacheable": False,
-  },
-  {
     "test": "mojo_public_c_bindings_unittests",
   },
   {
-    "test": "mojo_public_environment_unittests",
+    "test": "mojo_public_c_system_unittests",
   },
   {
-    "test": "mojo_public_system_unittests",
+    "test": "mojo_public_cpp_application_unittests",
   },
   {
-    "test": "mojo_public_utility_unittests",
+    "test": "mojo_public_cpp_bindings_unittests",
+    "cacheable": False,
+  },
+  {
+    "test": "mojo_public_cpp_environment_unittests",
+  },
+  {
+    "test": "mojo_public_cpp_system_unittests",
+  },
+  {
+    "test": "mojo_public_cpp_utility_unittests",
   },
 
   # Non-system, non-public tests:
diff --git a/mojo/tools/get_test_list.py b/mojo/tools/get_test_list.py
index 1ad8467..c7c3b1f 100755
--- a/mojo/tools/get_test_list.py
+++ b/mojo/tools/get_test_list.py
@@ -215,8 +215,8 @@
   bot_name = "linux_%s" % ("debug" if config.is_debug else "release")
 
   if target_os == Config.OS_LINUX and ShouldRunTest(Config.TEST_TYPE_PERF):
-    test_names = ["mojo_public_system_perftests",
-                  "mojo_public_bindings_perftests",
+    test_names = ["mojo_public_c_system_perftests",
+                  "mojo_public_cpp_bindings_perftests",
                   "mojo_edk_system_perftests"]
 
     for test_name in test_names: