Enable //services/files/c:apptests on Android now that we have the C++11 library.

R=jamesr@chromium.org

Review URL: https://codereview.chromium.org/1130873002
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index d4ac711..7ca98c5 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -63,6 +63,7 @@
     "//services/clipboard:apptests",
     "//services/dart/dart_apptests",
     "//services/files:apptests",
+    "//services/files/c:apptests",
     "//services/http_server:apptests",
     "//services/reaper:tests",
     "//services/url_response_disk_cache:tests",
@@ -75,11 +76,7 @@
   ]
 
   if (is_linux) {
-    deps += [
-      # TODO(vtl): See TODO in //services/files/c/BUILD.gn.
-      "//services/files/c:apptests",
-      "//services/python:python_apptests",
-    ]
+    deps += [ "//services/python:python_apptests" ]
   }
 
   # TODO(jamesr): We only support building V8 snapshot data on a linux host since it
diff --git a/mojo/tools/data/apptests b/mojo/tools/data/apptests
index 148bf79..41f6da9 100644
--- a/mojo/tools/data/apptests
+++ b/mojo/tools/data/apptests
@@ -47,7 +47,7 @@
     "test": "mojo:http_server_apptests",
   },
   {
-    "test": "mojo:network_service_apptests",
+    "test": "mojo:mojio_apptests",
   },
   {
     "test": "mojo:mojo_view_manager_client_apptests",
@@ -59,6 +59,9 @@
     "shell-args": ["--args-for=mojo:native_viewport_service --use-headless-config --use-osmesa"],
   },
   {
+    "test": "mojo:network_service_apptests",
+  },
+  {
     "test": "mojo:window_manager_apptests",
   },
   {
@@ -77,10 +80,6 @@
         "--url-mappings=mojo:example_service=mojo:python_example_service"
       ],
     },
-    # TODO(vtl): See TODO in //services/files/c/BUILD.gn.
-    {
-      "test": "mojo:mojio_apptests",
-    },
     {
       "test": "mojo:mojo_url_redirector_apptests",
       "test-args": ["--redirector_port=49152",
diff --git a/services/files/c/BUILD.gn b/services/files/c/BUILD.gn
index 11e446a..cedc2a7 100644
--- a/services/files/c/BUILD.gn
+++ b/services/files/c/BUILD.gn
@@ -4,82 +4,78 @@
 
 import("//mojo/public/mojo_application.gni")
 
-# TODO(vtl): Disabled for Android (in particular), since we need a C++11
-# standard library (e.g., std::unique_ptr and std::move).
-if (is_linux) {
-  source_set("mojio") {
-    sources = [
-      "lib/directory_wrapper.cc",
-      "lib/directory_wrapper.h",
-      "lib/errno_impl.h",
-      "lib/fd_impl.h",
-      "lib/fd_table.cc",
-      "lib/fd_table.h",
-      "lib/file_fd_impl.cc",
-      "lib/file_fd_impl.h",
-      "lib/mojio_fcntl.cc",
-      "lib/mojio_sys_stat.cc",
-      "lib/mojio_unistd.cc",
-      "lib/real_errno_impl.cc",
-      "lib/real_errno_impl.h",
-      "lib/singletons.cc",
-      "lib/singletons.h",
-      "lib/template_util.h",
-      "lib/util.cc",
-      "lib/util.h",
-      "mojio_config.h",
-      "mojio_fcntl.h",
-      "mojio_stdio.h",
-      "mojio_sys_stat.h",
-      "mojio_sys_types.h",
-      "mojio_time.h",
-      "mojio_unistd.h",
-    ]
+source_set("mojio") {
+  sources = [
+    "lib/directory_wrapper.cc",
+    "lib/directory_wrapper.h",
+    "lib/errno_impl.h",
+    "lib/fd_impl.h",
+    "lib/fd_table.cc",
+    "lib/fd_table.h",
+    "lib/file_fd_impl.cc",
+    "lib/file_fd_impl.h",
+    "lib/mojio_fcntl.cc",
+    "lib/mojio_sys_stat.cc",
+    "lib/mojio_unistd.cc",
+    "lib/real_errno_impl.cc",
+    "lib/real_errno_impl.h",
+    "lib/singletons.cc",
+    "lib/singletons.h",
+    "lib/template_util.h",
+    "lib/util.cc",
+    "lib/util.h",
+    "mojio_config.h",
+    "mojio_fcntl.h",
+    "mojio_stdio.h",
+    "mojio_sys_stat.h",
+    "mojio_sys_types.h",
+    "mojio_time.h",
+    "mojio_unistd.h",
+  ]
 
-    deps = [
-      "//mojo/public/cpp/bindings",
-      "//mojo/public/cpp/environment",
-      "//mojo/public/cpp/system",
-      "//mojo/services/files/public/interfaces",
-    ]
-  }
+  deps = [
+    "//mojo/public/cpp/bindings",
+    "//mojo/public/cpp/environment",
+    "//mojo/public/cpp/system",
+    "//mojo/services/files/public/interfaces",
+  ]
+}
 
-  mojo_native_application("apptests") {
-    output_name = "mojio_apptests"
+mojo_native_application("apptests") {
+  output_name = "mojio_apptests"
 
-    testonly = true
+  testonly = true
 
-    sources = [
-      "tests/directory_wrapper_unittest.cc",
-      "tests/errno_impl_unittest.cc",
-      "tests/fd_table_unittest.cc",
-      "tests/file_fd_impl_unittest.cc",
-      "tests/mock_errno_impl.cc",
-      "tests/mock_errno_impl.h",
-      "tests/mojio_impl_test_base.cc",
-      "tests/mojio_impl_test_base.h",
-      "tests/mojio_sys_stat_unittest.cc",
-      "tests/mojio_test_base.cc",
-      "tests/mojio_test_base.h",
-      "tests/mojio_unistd_unittest.cc",
-      "tests/real_errno_impl_unittest.cc",
-      "tests/test_utils.cc",
-      "tests/test_utils.h",
-      "tests/test_utils_unittest.cc",
-      "tests/util_unittest.cc",
-    ]
+  sources = [
+    "tests/directory_wrapper_unittest.cc",
+    "tests/errno_impl_unittest.cc",
+    "tests/fd_table_unittest.cc",
+    "tests/file_fd_impl_unittest.cc",
+    "tests/mock_errno_impl.cc",
+    "tests/mock_errno_impl.h",
+    "tests/mojio_impl_test_base.cc",
+    "tests/mojio_impl_test_base.h",
+    "tests/mojio_sys_stat_unittest.cc",
+    "tests/mojio_test_base.cc",
+    "tests/mojio_test_base.h",
+    "tests/mojio_unistd_unittest.cc",
+    "tests/real_errno_impl_unittest.cc",
+    "tests/test_utils.cc",
+    "tests/test_utils.h",
+    "tests/test_utils_unittest.cc",
+    "tests/util_unittest.cc",
+  ]
 
-    deps = [
-      ":mojio",
-      "//mojo/public/cpp/application:standalone",
-      "//mojo/public/cpp/application:test_support_standalone",
-      "//mojo/public/cpp/bindings",
-      "//mojo/public/cpp/environment",
-      "//mojo/public/cpp/system",
-      "//mojo/services/files/public/interfaces",
-      "//testing/gtest",
-    ]
+  deps = [
+    ":mojio",
+    "//mojo/public/cpp/application:standalone",
+    "//mojo/public/cpp/application:test_support_standalone",
+    "//mojo/public/cpp/bindings",
+    "//mojo/public/cpp/environment",
+    "//mojo/public/cpp/system",
+    "//mojo/services/files/public/interfaces",
+    "//testing/gtest",
+  ]
 
-    data_deps = [ "..:files" ]
-  }
+  data_deps = [ "..:files" ]
 }
diff --git a/services/files/c/lib/util.cc b/services/files/c/lib/util.cc
index e798e73..e5cbb0c 100644
--- a/services/files/c/lib/util.cc
+++ b/services/files/c/lib/util.cc
@@ -4,6 +4,7 @@
 
 #include "services/files/c/lib/util.h"
 
+#include <assert.h>
 #include <errno.h>
 
 namespace mojio {
@@ -36,6 +37,9 @@
       // TODO(vtl): Something better?
       return EIO;
   }
+  assert(false);
+  // TODO(vtl): Something better?
+  return EIO;
 }
 
 }  // namespace mojio
diff --git a/services/files/c/mojio_sys_stat.h b/services/files/c/mojio_sys_stat.h
index 3d44982..2498afc 100644
--- a/services/files/c/mojio_sys_stat.h
+++ b/services/files/c/mojio_sys_stat.h
@@ -60,15 +60,19 @@
 #define MOJIO_S_ISREG(mode) (((mode)&MOJIO_S_IFMT) == MOJIO_S_IFREG)
 #define MOJIO_S_ISSOCK(mode) (((mode)&MOJIO_S_IFMT) == MOJIO_S_IFSOCK)
 
-// These are for backwards compatibility with older versions of POSIX. Since we
-// didn't prefix the names of the members in |struct mojio_stat| below, we don't
-// prefix these macro names either. This means that we'll collide with the
-// "real" <sys/stat.h>, but that should be fine as long as it follows
-// POSIX.1-2008 to the letter (since the macro definitions will be identical,
-// which is valid).
-#define st_atime st_atim.tv_sec
-#define st_mtime st_mtim.tv_sec
-#define st_ctime st_ctim.tv_sec
+// POSIX.1-2008 says we should define |st_atime| to |st_atim.tv_sec| (and
+// similarly for |st_mtime| and |st_ctime|). This is to provide (source)
+// backwards compatibility with older versions of POSIX.
+//
+// We could reasonably provide these macros on systems that are compliant with
+// POSIX.1-2008 (or later): even though they might collide with macro
+// definitions in the "real" <sys/stat.h>, it's okay since the macro definitions
+// will be identical. However, providing these macros on systems that aren't
+// POSIX.1-2008-compliant (like Android) leads to an intractable conflict. Thus
+// we provide prefixed macros instead.
+#define mojio_st_atime st_atim.tv_sec
+#define mojio_st_mtime st_mtim.tv_sec
+#define mojio_st_ctime st_ctim.tv_sec
 
 // Types -----------------------------------------------------------------------