Move StringToUpperASCII to base namespace

Removes some unnecessary base:: qualifications in the base files I touched. clang-formatted file_util_unittest because lots of wrapping changed with this removal (seems to be a big improvement).

BUG=

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

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


CrOS-Libchrome-Original-Commit: 7622fbed9871c8c9ac61b4ea1aef36b0cf0fc144
diff --git a/base/environment.cc b/base/environment.cc
index 6cf7a18..245051d 100644
--- a/base/environment.cc
+++ b/base/environment.cc
@@ -20,7 +20,7 @@
 
 namespace {
 
-class EnvironmentImpl : public base::Environment {
+class EnvironmentImpl : public Environment {
  public:
   bool GetVar(const char* variable_name, std::string* result) override {
     if (GetVarImpl(variable_name, result))
@@ -35,7 +35,7 @@
     if (first_char >= 'a' && first_char <= 'z')
       alternate_case_var = StringToUpperASCII(std::string(variable_name));
     else if (first_char >= 'A' && first_char <= 'Z')
-      alternate_case_var = base::StringToLowerASCII(std::string(variable_name));
+      alternate_case_var = StringToLowerASCII(std::string(variable_name));
     else
       return false;
     return GetVarImpl(alternate_case_var.c_str(), result);
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
index b107b0f..1d8eeef 100644
--- a/base/files/file_util_unittest.cc
+++ b/base/files/file_util_unittest.cc
@@ -331,7 +331,7 @@
   // TEMP can have a lower case drive letter.
   string16 temp_base_a = base_a.value();
   ASSERT_FALSE(temp_base_a.empty());
-  *temp_base_a.begin() = base::ToUpperASCII(*temp_base_a.begin());
+  *temp_base_a.begin() = ToUpperASCII(*temp_base_a.begin());
   base_a = FilePath(temp_base_a);
 #endif
   ASSERT_TRUE(CreateDirectory(base_a));
@@ -537,8 +537,8 @@
   // network file systems. E.g. AFS).
   FilePath access_test_dir = long_test_dir.Append(kTestSubDirName);
   ASSERT_TRUE(CreateDirectory(access_test_dir));
-  base::FilePermissionRestorer long_test_dir_restorer(long_test_dir);
-  ASSERT_TRUE(base::MakeFileUnreadable(long_test_dir));
+  FilePermissionRestorer long_test_dir_restorer(long_test_dir);
+  ASSERT_TRUE(MakeFileUnreadable(long_test_dir));
 
   // Use the short form of the directory to create a temporary filename.
   ASSERT_TRUE(CreateTemporaryFileInDir(
@@ -2101,7 +2101,7 @@
   EXPECT_EQ(0u, data.length());
 
   // Delete test file.
-  EXPECT_TRUE(base::DeleteFile(file_path, false));
+  EXPECT_TRUE(DeleteFile(file_path, false));
 
   data = "temp";
   EXPECT_FALSE(ReadFileToString(file_path, &data));
@@ -2235,24 +2235,17 @@
                                      .AppendASCII("not")
                                      .AppendASCII("exist");
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, does_not_exist, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, does_not_exist, uid_, ok_gids_));
 
   // |base| not a subpath of |path|.
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, base_dir_, uid_, ok_gids_));
+  EXPECT_FALSE(VerifyPathControlledByUser(sub_dir_, base_dir_, uid_, ok_gids_));
 
   // An empty base path will fail to be a prefix for any path.
   FilePath empty;
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          empty, base_dir_, uid_, ok_gids_));
+  EXPECT_FALSE(VerifyPathControlledByUser(empty, base_dir_, uid_, ok_gids_));
 
   // Finding that a bad call fails proves nothing unless a good call succeeds.
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
 }
 
 TEST_F(VerifyPathControlledByUserTest, Symlinks) {
@@ -2264,11 +2257,9 @@
       << "Failed to create symlink.";
 
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, file_link, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, file_link, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          file_link, file_link, uid_, ok_gids_));
+      VerifyPathControlledByUser(file_link, file_link, uid_, ok_gids_));
 
   // Symlink from one directory to another within the path.
   FilePath link_to_sub_dir =  base_dir_.AppendASCII("link_to_sub_dir");
@@ -2278,18 +2269,15 @@
   FilePath file_path_with_link = link_to_sub_dir.AppendASCII("file.txt");
   ASSERT_TRUE(PathExists(file_path_with_link));
 
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, file_path_with_link, uid_, ok_gids_));
+  EXPECT_FALSE(VerifyPathControlledByUser(base_dir_, file_path_with_link, uid_,
+                                          ok_gids_));
 
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          link_to_sub_dir, file_path_with_link, uid_, ok_gids_));
+  EXPECT_FALSE(VerifyPathControlledByUser(link_to_sub_dir, file_path_with_link,
+                                          uid_, ok_gids_));
 
   // Symlinks in parents of base path are allowed.
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          file_path_with_link, file_path_with_link, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(file_path_with_link,
+                                         file_path_with_link, uid_, ok_gids_));
 }
 
 TEST_F(VerifyPathControlledByUserTest, OwnershipChecks) {
@@ -2305,37 +2293,26 @@
       ChangePosixFilePermissions(text_file_, 0u, S_IWOTH));
 
   // We control these paths.
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Another user does not control these paths.
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, bad_uid, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, sub_dir_, bad_uid, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, bad_uid, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, bad_uid, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, bad_uid, ok_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, bad_uid, ok_gids_));
 
   // Another group does not control the paths.
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, bad_gids_));
+      VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, bad_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, bad_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, bad_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, bad_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, bad_gids_));
 }
 
 TEST_F(VerifyPathControlledByUserTest, GroupWriteTest) {
@@ -2348,68 +2325,41 @@
       ChangePosixFilePermissions(text_file_, 0u, S_IWOTH|S_IWGRP));
 
   // Any group is okay because the path is not group-writable.
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, bad_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, bad_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, bad_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, bad_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, bad_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, bad_gids_));
 
   // No group is okay, because we don't check the group
   // if no group can write.
   std::set<gid_t> no_gids;  // Empty set of gids.
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, no_gids));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, no_gids));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, no_gids));
-
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, no_gids));
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, text_file_, uid_, no_gids));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, no_gids));
 
   // Make all files and directories writable by their group.
-  ASSERT_NO_FATAL_FAILURE(
-      ChangePosixFilePermissions(base_dir_, S_IWGRP, 0u));
-  ASSERT_NO_FATAL_FAILURE(
-      ChangePosixFilePermissions(sub_dir_, S_IWGRP, 0u));
-  ASSERT_NO_FATAL_FAILURE(
-      ChangePosixFilePermissions(text_file_, S_IWGRP, 0u));
+  ASSERT_NO_FATAL_FAILURE(ChangePosixFilePermissions(base_dir_, S_IWGRP, 0u));
+  ASSERT_NO_FATAL_FAILURE(ChangePosixFilePermissions(sub_dir_, S_IWGRP, 0u));
+  ASSERT_NO_FATAL_FAILURE(ChangePosixFilePermissions(text_file_, S_IWGRP, 0u));
 
   // Now |ok_gids_| works, but |bad_gids_| fails.
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, bad_gids_));
+      VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, bad_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, bad_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, bad_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, bad_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, bad_gids_));
 
   // Because any group in the group set is allowed,
   // the union of good and bad gids passes.
@@ -2421,14 +2371,11 @@
       std::inserter(multiple_gids, multiple_gids.begin()));
 
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, multiple_gids));
+      VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, multiple_gids));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, multiple_gids));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, multiple_gids));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, multiple_gids));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, multiple_gids));
 }
 
 TEST_F(VerifyPathControlledByUserTest, WriteBitChecks) {
@@ -2441,94 +2388,63 @@
       ChangePosixFilePermissions(text_file_, 0u, S_IWOTH));
 
   // Initialy, we control all parts of the path.
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Make base_dir_ world-writable.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(base_dir_, S_IWOTH, 0u));
+  EXPECT_FALSE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Make sub_dir_ world writable.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(sub_dir_, S_IWOTH, 0u));
+  EXPECT_FALSE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Make text_file_ world writable.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(text_file_, S_IWOTH, 0u));
+  EXPECT_FALSE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Make sub_dir_ non-world writable.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(sub_dir_, 0u, S_IWOTH));
+  EXPECT_FALSE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Make base_dir_ non-world-writable.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(base_dir_, 0u, S_IWOTH));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
   EXPECT_FALSE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 
   // Back to the initial state: Nothing is writable, so every path
   // should pass.
   ASSERT_NO_FATAL_FAILURE(
       ChangePosixFilePermissions(text_file_, 0u, S_IWOTH));
+  EXPECT_TRUE(VerifyPathControlledByUser(base_dir_, sub_dir_, uid_, ok_gids_));
   EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, sub_dir_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          base_dir_, text_file_, uid_, ok_gids_));
-  EXPECT_TRUE(
-      base::VerifyPathControlledByUser(
-          sub_dir_, text_file_, uid_, ok_gids_));
+      VerifyPathControlledByUser(base_dir_, text_file_, uid_, ok_gids_));
+  EXPECT_TRUE(VerifyPathControlledByUser(sub_dir_, text_file_, uid_, ok_gids_));
 }
 
 #if defined(OS_ANDROID)
@@ -2545,7 +2461,7 @@
 
   // Insert the image into MediaStore. MediaStore will do some conversions, and
   // return the content URI.
-  FilePath path = base::InsertImageIntoMediaStore(image_file);
+  FilePath path = InsertImageIntoMediaStore(image_file);
   EXPECT_TRUE(path.IsContentUri());
   EXPECT_TRUE(PathExists(path));
   // The file size may not equal to the input image as MediaStore may convert
@@ -2581,10 +2497,8 @@
   char c = 0;
   ASSERT_EQ(0, pipe(fds));
   const int write_end = fds[1];
-  base::ScopedFD read_end_closer(fds[0]);
-  {
-    base::ScopedFD write_end_closer(fds[1]);
-  }
+  ScopedFD read_end_closer(fds[0]);
+  { ScopedFD write_end_closer(fds[1]); }
   // This is the only thread. This file descriptor should no longer be valid.
   int ret = close(write_end);
   EXPECT_EQ(-1, ret);
@@ -2597,14 +2511,14 @@
 
 #if defined(GTEST_HAS_DEATH_TEST)
 void CloseWithScopedFD(int fd) {
-  base::ScopedFD fd_closer(fd);
+  ScopedFD fd_closer(fd);
 }
 #endif
 
 TEST(ScopedFD, ScopedFDCrashesOnCloseFailure) {
   int fds[2];
   ASSERT_EQ(0, pipe(fds));
-  base::ScopedFD read_end_closer(fds[0]);
+  ScopedFD read_end_closer(fds[0]);
   EXPECT_EQ(0, IGNORE_EINTR(close(fds[1])));
 #if defined(GTEST_HAS_DEATH_TEST)
   // This is the only thread. This file descriptor should no longer be valid.
diff --git a/base/guid_unittest.cc b/base/guid_unittest.cc
index 4eda7f6..1485497 100644
--- a/base/guid_unittest.cc
+++ b/base/guid_unittest.cc
@@ -9,6 +9,8 @@
 #include "base/strings/string_util.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+namespace base {
+
 #if defined(OS_POSIX)
 
 namespace {
@@ -16,23 +18,22 @@
 bool IsGUIDv4(const std::string& guid) {
   // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,
   // where y is one of [8, 9, A, B].
-  return base::IsValidGUID(guid) && guid[14] == '4' &&
+  return IsValidGUID(guid) && guid[14] == '4' &&
          (guid[19] == '8' || guid[19] == '9' || guid[19] == 'A' ||
           guid[19] == 'a' || guid[19] == 'B' || guid[19] == 'b');
 }
 
 }  // namespace
 
-
 TEST(GUIDTest, GUIDGeneratesAllZeroes) {
   uint64 bytes[] = { 0, 0 };
-  std::string clientid = base::RandomDataToGUIDString(bytes);
+  std::string clientid = RandomDataToGUIDString(bytes);
   EXPECT_EQ("00000000-0000-0000-0000-000000000000", clientid);
 }
 
 TEST(GUIDTest, GUIDGeneratesCorrectly) {
   uint64 bytes[] = { 0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL };
-  std::string clientid = base::RandomDataToGUIDString(bytes);
+  std::string clientid = RandomDataToGUIDString(bytes);
   EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid);
 }
 #endif
@@ -40,18 +41,18 @@
 TEST(GUIDTest, GUIDCorrectlyFormatted) {
   const int kIterations = 10;
   for (int it = 0; it < kIterations; ++it) {
-    std::string guid = base::GenerateGUID();
-    EXPECT_TRUE(base::IsValidGUID(guid));
-    EXPECT_TRUE(base::IsValidGUID(base::StringToLowerASCII(guid)));
-    EXPECT_TRUE(base::IsValidGUID(StringToUpperASCII(guid)));
+    std::string guid = GenerateGUID();
+    EXPECT_TRUE(IsValidGUID(guid));
+    EXPECT_TRUE(IsValidGUID(StringToLowerASCII(guid)));
+    EXPECT_TRUE(IsValidGUID(StringToUpperASCII(guid)));
   }
 }
 
 TEST(GUIDTest, GUIDBasicUniqueness) {
   const int kIterations = 10;
   for (int it = 0; it < kIterations; ++it) {
-    std::string guid1 = base::GenerateGUID();
-    std::string guid2 = base::GenerateGUID();
+    std::string guid1 = GenerateGUID();
+    std::string guid2 = GenerateGUID();
     EXPECT_EQ(36U, guid1.length());
     EXPECT_EQ(36U, guid2.length());
     EXPECT_NE(guid1, guid2);
@@ -61,3 +62,5 @@
 #endif
   }
 }
+
+}  // namespace base
diff --git a/base/strings/string_util.h b/base/strings/string_util.h
index 5ab2ad5..0bdf2ef 100644
--- a/base/strings/string_util.h
+++ b/base/strings/string_util.h
@@ -272,6 +272,20 @@
   return output;
 }
 
+// Converts the elements of the given string.  This version uses a pointer to
+// clearly differentiate it from the non-pointer variant.
+template <class str> inline void StringToUpperASCII(str* s) {
+  for (typename str::iterator i = s->begin(); i != s->end(); ++i)
+    *i = ToUpperASCII(*i);
+}
+
+template <class str> inline str StringToUpperASCII(const str& s) {
+  // for std::string and std::wstring
+  str output(s);
+  StringToUpperASCII(&output);
+  return output;
+}
+
 }  // namespace base
 
 #if defined(OS_WIN)
@@ -282,20 +296,6 @@
 #error Define string operations appropriately for your platform
 #endif
 
-// Converts the elements of the given string.  This version uses a pointer to
-// clearly differentiate it from the non-pointer variant.
-template <class str> inline void StringToUpperASCII(str* s) {
-  for (typename str::iterator i = s->begin(); i != s->end(); ++i)
-    *i = base::ToUpperASCII(*i);
-}
-
-template <class str> inline str StringToUpperASCII(const str& s) {
-  // for std::string and std::wstring
-  str output(s);
-  StringToUpperASCII(&output);
-  return output;
-}
-
 // Compare the lower-case form of the given string against the given ASCII
 // string.  This is useful for doing checking if an input string matches some
 // token, and it is optimized to avoid intermediate string copies.  This API is
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index d887c0b..fb0bead 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -494,8 +494,8 @@
   const char chars_with_nul[] = "test\0string";
   const int length_with_nul = arraysize(chars_with_nul) - 1;
   std::string string_with_nul(chars_with_nul, length_with_nul);
-  base::string16 string16_with_nul = ASCIIToUTF16(string_with_nul);
-  EXPECT_EQ(static_cast<base::string16::size_type>(length_with_nul),
+  string16 string16_with_nul = ASCIIToUTF16(string_with_nul);
+  EXPECT_EQ(static_cast<string16::size_type>(length_with_nul),
             string16_with_nul.length());
   std::string narrow_with_nul = UTF16ToASCII(string16_with_nul);
   EXPECT_EQ(static_cast<std::string::size_type>(length_with_nul),
@@ -768,7 +768,7 @@
 }
 
 TEST(StringUtilTest, TokenizeStringPiece) {
-  TokenizeTest<base::StringPiece>();
+  TokenizeTest<StringPiece>();
 }
 
 // Test for JoinString
@@ -1038,9 +1038,9 @@
   {
     char dst[10];
     wchar_t wdst[10];
-    EXPECT_EQ(7U, base::strlcpy(dst, "abcdefg", arraysize(dst)));
+    EXPECT_EQ(7U, strlcpy(dst, "abcdefg", arraysize(dst)));
     EXPECT_EQ(0, memcmp(dst, "abcdefg", 8));
-    EXPECT_EQ(7U, base::wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
+    EXPECT_EQ(7U, wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
     EXPECT_EQ(0, memcmp(wdst, L"abcdefg", sizeof(wchar_t) * 8));
   }
 
@@ -1049,10 +1049,10 @@
   {
     char dst[2] = {1, 2};
     wchar_t wdst[2] = {1, 2};
-    EXPECT_EQ(7U, base::strlcpy(dst, "abcdefg", 0));
+    EXPECT_EQ(7U, strlcpy(dst, "abcdefg", 0));
     EXPECT_EQ(1, dst[0]);
     EXPECT_EQ(2, dst[1]);
-    EXPECT_EQ(7U, base::wcslcpy(wdst, L"abcdefg", 0));
+    EXPECT_EQ(7U, wcslcpy(wdst, L"abcdefg", 0));
     EXPECT_EQ(static_cast<wchar_t>(1), wdst[0]);
     EXPECT_EQ(static_cast<wchar_t>(2), wdst[1]);
   }
@@ -1061,9 +1061,9 @@
   {
     char dst[8];
     wchar_t wdst[8];
-    EXPECT_EQ(7U, base::strlcpy(dst, "abcdefg", arraysize(dst)));
+    EXPECT_EQ(7U, strlcpy(dst, "abcdefg", arraysize(dst)));
     EXPECT_EQ(0, memcmp(dst, "abcdefg", 8));
-    EXPECT_EQ(7U, base::wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
+    EXPECT_EQ(7U, wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
     EXPECT_EQ(0, memcmp(wdst, L"abcdefg", sizeof(wchar_t) * 8));
   }
 
@@ -1071,9 +1071,9 @@
   {
     char dst[7];
     wchar_t wdst[7];
-    EXPECT_EQ(7U, base::strlcpy(dst, "abcdefg", arraysize(dst)));
+    EXPECT_EQ(7U, strlcpy(dst, "abcdefg", arraysize(dst)));
     EXPECT_EQ(0, memcmp(dst, "abcdef", 7));
-    EXPECT_EQ(7U, base::wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
+    EXPECT_EQ(7U, wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
     EXPECT_EQ(0, memcmp(wdst, L"abcdef", sizeof(wchar_t) * 7));
   }
 
@@ -1081,9 +1081,9 @@
   {
     char dst[3];
     wchar_t wdst[3];
-    EXPECT_EQ(7U, base::strlcpy(dst, "abcdefg", arraysize(dst)));
+    EXPECT_EQ(7U, strlcpy(dst, "abcdefg", arraysize(dst)));
     EXPECT_EQ(0, memcmp(dst, "ab", 3));
-    EXPECT_EQ(7U, base::wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
+    EXPECT_EQ(7U, wcslcpy(wdst, L"abcdefg", arraysize(wdst)));
     EXPECT_EQ(0, memcmp(wdst, L"ab", sizeof(wchar_t) * 3));
   }
 }
@@ -1116,7 +1116,7 @@
     { L"% 10ls", true }
   };
   for (size_t i = 0; i < arraysize(cases); ++i)
-    EXPECT_EQ(cases[i].portable, base::IsWprintfFormatPortable(cases[i].input));
+    EXPECT_EQ(cases[i].portable, IsWprintfFormatPortable(cases[i].input));
 }
 
 TEST(StringUtilTest, RemoveChars) {