Chromium Code Reviews| Index: util/misc/uuid_test.cc |
| diff --git a/util/misc/uuid_test.cc b/util/misc/uuid_test.cc |
| index 01f3b6a5f73718d4352f3ab62dc8e15d662cf291..c0132f30a5ea678563fa6274cb4814fb3cf84ee0 100644 |
| --- a/util/misc/uuid_test.cc |
| +++ b/util/misc/uuid_test.cc |
| @@ -20,7 +20,9 @@ |
| #include "base/basictypes.h" |
| #include "base/format_macros.h" |
| +#include "base/scoped_generic.h" |
| #include "base/strings/stringprintf.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "gtest/gtest.h" |
| namespace crashpad { |
| @@ -204,6 +206,36 @@ TEST(UUID, FromString) { |
| EXPECT_EQ("5762c15d-50b5-4171-a2e9-7429c9ec6cab", uuid.ToString()); |
| } |
| +#if defined(OS_WIN) |
| + |
| +TEST(UUID, FromSystem) { |
| + ::GUID system_uuid; |
| + ASSERT_EQ(RPC_S_OK, UuidCreate(&system_uuid)); |
| + |
| + UUID uuid; |
| + uuid.InitializeFromSystemUUID(&system_uuid); |
| + |
| + RPC_WSTR system_string; |
| + ASSERT_EQ(RPC_S_OK, UuidToString(&system_uuid, &system_string)); |
| + |
| + struct ScopedRpcStringFreeTraits { |
| + static RPC_WSTR* InvalidValue() { return nullptr; } |
| + static void Free(RPC_WSTR* rpc_string) { |
| + EXPECT_EQ(RPC_S_OK, RpcStringFree(rpc_string)); |
| + } |
| + }; |
| + using ScopedRpcString = |
| + base::ScopedGeneric<RPC_WSTR*, ScopedRpcStringFreeTraits>; |
| + ScopedRpcString scoped_system_string(&system_string); |
| + |
| + std::string system_string_utf8 = |
| + base::UTF16ToUTF8(reinterpret_cast<wchar_t*>(system_string)); |
| + |
| + EXPECT_EQ(system_string_utf8, uuid.ToString()); |
|
scottmg
2015/03/13 16:52:32
maybe just system_string == uuid.ToString16()? Or
|
| +} |
| + |
| +#endif // OS_WIN |
| + |
| } // namespace |
| } // namespace test |
| } // namespace crashpad |