OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/guid.h" | 5 #include "base/guid.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/googletest/include/gtest/gtest.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 #if defined(OS_POSIX) | 14 #if defined(OS_POSIX) |
15 | 15 |
16 namespace { | 16 namespace { |
17 | 17 |
18 bool IsGUIDv4(const std::string& guid) { | 18 bool IsGUIDv4(const std::string& guid) { |
19 // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, | 19 // The format of GUID version 4 must be xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx, |
20 // where y is one of [8, 9, A, B]. | 20 // where y is one of [8, 9, A, B]. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 EXPECT_EQ(36U, guid2.length()); | 57 EXPECT_EQ(36U, guid2.length()); |
58 EXPECT_NE(guid1, guid2); | 58 EXPECT_NE(guid1, guid2); |
59 #if defined(OS_POSIX) | 59 #if defined(OS_POSIX) |
60 EXPECT_TRUE(IsGUIDv4(guid1)); | 60 EXPECT_TRUE(IsGUIDv4(guid1)); |
61 EXPECT_TRUE(IsGUIDv4(guid2)); | 61 EXPECT_TRUE(IsGUIDv4(guid2)); |
62 #endif | 62 #endif |
63 } | 63 } |
64 } | 64 } |
65 | 65 |
66 } // namespace base | 66 } // namespace base |
OLD | NEW |