Index: util/misc/uuid_test.cc |
diff --git a/util/misc/uuid_test.cc b/util/misc/uuid_test.cc |
index 01f3b6a5f73718d4352f3ab62dc8e15d662cf291..0d08b22c6225c71d964052ab1cae57a14b6f84cf 100644 |
--- a/util/misc/uuid_test.cc |
+++ b/util/misc/uuid_test.cc |
@@ -20,6 +20,7 @@ |
#include "base/basictypes.h" |
#include "base/format_macros.h" |
+#include "base/scoped_generic.h" |
#include "base/strings/stringprintf.h" |
#include "gtest/gtest.h" |
@@ -204,6 +205,33 @@ 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); |
+ |
+ EXPECT_EQ(reinterpret_cast<wchar_t*>(system_string), uuid.ToString16()); |
+} |
+ |
+#endif // OS_WIN |
+ |
} // namespace |
} // namespace test |
} // namespace crashpad |