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