Updates to base unittests so they run correctly in libchrome on Android

Parallel change to https://android-review.googlesource.com/#/c/163293/
(does not include changes being made to base/command_line_unittest
that are fixing temporary runner issues, since the runner is fine here)

BUG= 22884411, 22947438

Review URL: https://codereview.chromium.org/1273243002

Cr-Commit-Position: refs/heads/master@{#343126}


CrOS-Libchrome-Original-Commit: e89963accb5f3a9d93b8007b22fc79c0120eb794
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc
index 60eaa8f..bc0e843 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -10,6 +10,10 @@
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
+#if defined(OS_POSIX)
+#include "base/test/scoped_locale.h"
+#endif
+
 // This macro helps avoid wrapped lines in the test structs.
 #define FPL(x) FILE_PATH_LITERAL(x)
 
@@ -1126,6 +1130,10 @@
       "\xEF\xBC\xA1\xEF\xBC\xA2\xEF\xBC\xA3.txt" },
   };
 
+#if !defined(SYSTEM_NATIVE_UTF8) && defined(OS_LINUX)
+  ScopedLocale locale("en_US.UTF-8");
+#endif
+
   for (size_t i = 0; i < arraysize(cases); ++i) {
     // Test FromUTF8Unsafe() works.
     FilePath from_utf8 = FilePath::FromUTF8Unsafe(cases[i].utf8);