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

Unified Diff: chrome/browser/prefs/tracked/device_id_unittest.cc

Issue 836703005: Add a new function for getting a deterministic machine ID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Added link to bug report in comment and fixed include order Created 5 years, 11 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 | « chrome/browser/prefs/tracked/device_id_stub.cc ('k') | chrome/browser/prefs/tracked/device_id_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/tracked/device_id_unittest.cc
diff --git a/chrome/browser/prefs/tracked/device_id_unittest.cc b/chrome/browser/prefs/tracked/device_id_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..215672e4d232fa5f88f133a7e307fb2204374235
--- /dev/null
+++ b/chrome/browser/prefs/tracked/device_id_unittest.cc
@@ -0,0 +1,34 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/prefs/tracked/device_id.h"
+#include "build/build_config.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(GetDeterministicMachineSpecificIdTest, IsDeterministic) {
+ std::string first_machine_id;
+ std::string second_machine_id;
+
+ const MachineIdStatus kExpectedStatus =
+#if defined(OS_WIN)
+ MachineIdStatus::SUCCESS;
+#else
+ MachineIdStatus::NOT_IMPLEMENTED;
+#endif
+
+ ASSERT_EQ(kExpectedStatus,
+ GetDeterministicMachineSpecificId(&first_machine_id));
+ ASSERT_EQ(kExpectedStatus,
+ GetDeterministicMachineSpecificId(&second_machine_id));
+
+ // The reason for using |EXPECT_TRUE| with one argument instead of |EXPECT_EQ|
+ // with two arguments is a compiler bug in gcc that results in a "converting
+ // 'false' to pointer type" error when the first argument to |EXPECT_EQ| is a
+ // compile-time const false value. See also the following bug reports:
+ // https://code.google.com/p/googletest/issues/detail?id=322
+ // https://code.google.com/p/googletest/issues/detail?id=458
+ EXPECT_TRUE((kExpectedStatus == MachineIdStatus::SUCCESS) ==
+ !first_machine_id.empty());
+ EXPECT_EQ(first_machine_id, second_machine_id);
+}
« no previous file with comments | « chrome/browser/prefs/tracked/device_id_stub.cc ('k') | chrome/browser/prefs/tracked/device_id_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698