Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: base/guid_unittest.cc

Issue 1171973003: Move StringToUpperASCII to base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/files/file_util_unittest.cc ('k') | base/strings/string_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/guid_unittest.cc
diff --git a/base/guid_unittest.cc b/base/guid_unittest.cc
index 4eda7f68a374ce5ce60f1f891cd548293b76c01c..1485497155fab269e560bace55179239c5cc2d9a 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 @@ namespace {
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, GUIDGeneratesCorrectly) {
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 @@ TEST(GUIDTest, GUIDBasicUniqueness) {
#endif
}
}
+
+} // namespace base
« no previous file with comments | « base/files/file_util_unittest.cc ('k') | base/strings/string_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698