More NaCL fixes for test_support.

Fix two more things to fix test_support on NaCL:
- Exclude test task runner code as UnixTaskRunner (its depedency) is not
  available on NaCL.
- Disable -Wcomma warning which is not supported on NaCL.

R=skyostil@google.com

Change-Id: I36684a4dd7b5bf148b8a2d49a69cf49c91a9c68e
diff --git a/src/base/BUILD.gn b/src/base/BUILD.gn
index cb74b6c..7100667 100644
--- a/src/base/BUILD.gn
+++ b/src/base/BUILD.gn
@@ -127,13 +127,20 @@
     "../../gn:default_deps",
   ]
   sources = [
-    "test/test_task_runner.cc",
-    "test/test_task_runner.h",
     "test/utils.cc",
     "test/utils.h",
     "test/vm_test_utils.cc",
     "test/vm_test_utils.h",
   ]
+
+  if (!is_nacl) {
+    # test_task_runner depends on unix_task_runner, which isn't available on
+    # NaCL.
+    sources += [
+      "test/test_task_runner.cc",
+      "test/test_task_runner.h",
+    ]
+  }
 }
 
 perfetto_unittest_source_set("unittests") {
diff --git a/src/tracing/test/BUILD.gn b/src/tracing/test/BUILD.gn
index 13d6d29..fc63b18 100644
--- a/src/tracing/test/BUILD.gn
+++ b/src/tracing/test/BUILD.gn
@@ -47,8 +47,8 @@
   ]
 
   # These tests rely on test_task_runner.h which
-  # has no Windows implementation.
-  if (!is_win) {
+  # has no implementation for Windows or NaCL.
+  if (!is_win && !is_nacl) {
     sources += [
       "fake_producer_endpoint.h",
       "mock_consumer.cc",
diff --git a/test/gtest_and_gmock.h b/test/gtest_and_gmock.h
index 90a8c85..82918d8 100644
--- a/test/gtest_and_gmock.h
+++ b/test/gtest_and_gmock.h
@@ -25,6 +25,8 @@
 // 1 applies recursively also to the test translation units, 2 applies only
 // to gmock/gtest includes.
 
+#include "perfetto/base/build_config.h"
+
 #if defined(__GNUC__)  // GCC & clang
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wundef"
@@ -36,7 +38,12 @@
 
 #if defined(__clang__)
 #pragma GCC diagnostic ignored "-Wshift-sign-overflow"
+
+#if !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
+// -Wcomma isn't supported on NaCL.
 #pragma GCC diagnostic ignored "-Wcomma"
+#endif  // PERFETTO_OS_NACL
+
 #endif
 
 #include <gmock/gmock.h>