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

Unified Diff: util/misc/uuid_test.cc

Issue 1004913004: win: Add UUID::InitializeFromSystemUUID() (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Rebase Created 5 years, 9 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 | « util/misc/uuid.cc ('k') | util/util.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « util/misc/uuid.cc ('k') | util/util.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698