OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/prefs/tracked/device_id.h" | 5 #include "components/user_prefs/tracked/device_id.h" |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 TEST(GetDeterministicMachineSpecificIdTest, IsDeterministic) { | 9 TEST(GetDeterministicMachineSpecificIdTest, IsDeterministic) { |
10 std::string first_machine_id; | 10 std::string first_machine_id; |
11 std::string second_machine_id; | 11 std::string second_machine_id; |
12 | 12 |
13 const MachineIdStatus kExpectedStatus = | 13 const MachineIdStatus kExpectedStatus = |
14 #if defined(OS_WIN) | 14 #if defined(OS_WIN) |
15 MachineIdStatus::SUCCESS; | 15 MachineIdStatus::SUCCESS; |
16 #else | 16 #else |
17 MachineIdStatus::NOT_IMPLEMENTED; | 17 MachineIdStatus::NOT_IMPLEMENTED; |
18 #endif | 18 #endif |
19 | 19 |
20 ASSERT_EQ(kExpectedStatus, | 20 ASSERT_EQ(kExpectedStatus, |
21 GetDeterministicMachineSpecificId(&first_machine_id)); | 21 GetDeterministicMachineSpecificId(&first_machine_id)); |
22 ASSERT_EQ(kExpectedStatus, | 22 ASSERT_EQ(kExpectedStatus, |
23 GetDeterministicMachineSpecificId(&second_machine_id)); | 23 GetDeterministicMachineSpecificId(&second_machine_id)); |
24 | 24 |
25 // The reason for using |EXPECT_TRUE| with one argument instead of |EXPECT_EQ| | 25 // The reason for using |EXPECT_TRUE| with one argument instead of |EXPECT_EQ| |
26 // with two arguments is a compiler bug in gcc that results in a "converting | 26 // with two arguments is a compiler bug in gcc that results in a "converting |
27 // 'false' to pointer type" error when the first argument to |EXPECT_EQ| is a | 27 // 'false' to pointer type" error when the first argument to |EXPECT_EQ| is a |
28 // compile-time const false value. See also the following bug reports: | 28 // compile-time const false value. See also the following bug reports: |
29 // https://code.google.com/p/googletest/issues/detail?id=322 | 29 // https://code.google.com/p/googletest/issues/detail?id=322 |
30 // https://code.google.com/p/googletest/issues/detail?id=458 | 30 // https://code.google.com/p/googletest/issues/detail?id=458 |
31 EXPECT_TRUE((kExpectedStatus == MachineIdStatus::SUCCESS) == | 31 EXPECT_TRUE((kExpectedStatus == MachineIdStatus::SUCCESS) == |
32 !first_machine_id.empty()); | 32 !first_machine_id.empty()); |
33 EXPECT_EQ(first_machine_id, second_machine_id); | 33 EXPECT_EQ(first_machine_id, second_machine_id); |
34 } | 34 } |
OLD | NEW |