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

Unified Diff: base/rand_util_unittest.cc

Issue 3800003: Moving GUID generation from base to chrome/browser/guid* (Closed)
Patch Set: Additional comment. Created 10 years, 2 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/rand_util_posix.cc ('k') | base/rand_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/rand_util_unittest.cc
diff --git a/base/rand_util_unittest.cc b/base/rand_util_unittest.cc
index 112099f09e17020baff62657f96b5f4a88b53bfb..cbc338a3b4eec23299af3c4a7d97082ed60904d0 100644
--- a/base/rand_util_unittest.cc
+++ b/base/rand_util_unittest.cc
@@ -35,50 +35,3 @@ TEST(RandUtilTest, RandGeneratorForRandomShuffle) {
EXPECT_LE(std::numeric_limits<ptrdiff_t>::max(),
std::numeric_limits<int64>::max());
}
-
-#if defined(OS_POSIX)
-// For unit testing purposes only. Do not use outside of tests.
-namespace base {
-extern std::string RandomBytesToGUIDString(const uint64 bytes[2]);
-} // base
-
-TEST(RandUtilTest, GUIDGeneratesAllZeroes) {
- uint64 bytes[] = { 0, 0 };
- std::string clientid = base::RandomBytesToGUIDString(bytes);
- EXPECT_EQ("00000000-0000-0000-0000-000000000000", clientid);
-}
-
-TEST(RandUtilTest, GUIDGeneratesCorrectly) {
- uint64 bytes[] = { 0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL };
- std::string clientid = base::RandomBytesToGUIDString(bytes);
- EXPECT_EQ("01234567-89AB-CDEF-FEDC-BA9876543210", clientid);
-}
-#endif
-
-TEST(RandUtilTest, GUIDCorrectlyFormatted) {
- const int kIterations = 10;
- for (int it = 0; it < kIterations; ++it) {
- std::string guid = base::GenerateGUID();
- EXPECT_EQ(36U, guid.length());
- std::string hexchars = "0123456789ABCDEF";
- for (uint32 i = 0; i < guid.length(); ++i) {
- char current = guid.at(i);
- if (i == 8 || i == 13 || i == 18 || i == 23) {
- EXPECT_EQ('-', current);
- } else {
- EXPECT_TRUE(std::string::npos != hexchars.find(current));
- }
- }
- }
-}
-
-TEST(RandUtilTest, GUIDBasicUniqueness) {
- const int kIterations = 10;
- for (int it = 0; it < kIterations; ++it) {
- std::string guid1 = base::GenerateGUID();
- std::string guid2 = base::GenerateGUID();
- EXPECT_EQ(36U, guid1.length());
- EXPECT_EQ(36U, guid2.length());
- EXPECT_NE(guid1, guid2);
- }
-}
« no previous file with comments | « base/rand_util_posix.cc ('k') | base/rand_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698