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

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: 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
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..963fd1a75f6979b45d59617396fc62d405bf1a51
--- /dev/null
+++ b/chrome/browser/prefs/tracked/device_id_unittest.cc
@@ -0,0 +1,28 @@
+// 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 "build/build_config.h"
+#include "chrome/browser/prefs/tracked/device_id.h"
grt (UTC plus 2) 2015/01/27 21:08:45 move above line 5 with a blank line after it
gab 2015/01/27 21:20:30 Interesting, I've heard the opposite (and am the o
Alexei Svitkine (slow) 2015/01/27 22:45:44 I believe the recommended style in Chromium is now
+#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));
+
+ EXPECT_EQ(kExpectedStatus == MachineIdStatus::SUCCESS,
+ !first_machine_id.empty());
+ EXPECT_EQ(first_machine_id, second_machine_id);
+}

Powered by Google App Engine
This is Rietveld 408576698