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.
5 #include "chrome/browser/prefs/tracked/device_id.h"
6 #include "build/build_config.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 TEST(GetDeterministicMachineSpecificIdTest
, IsDeterministic
) {
10 std::string first_machine_id
;
11 std::string second_machine_id
;
13 const MachineIdStatus kExpectedStatus
=
15 MachineIdStatus::SUCCESS
;
17 MachineIdStatus::NOT_IMPLEMENTED
;
20 ASSERT_EQ(kExpectedStatus
,
21 GetDeterministicMachineSpecificId(&first_machine_id
));
22 ASSERT_EQ(kExpectedStatus
,
23 GetDeterministicMachineSpecificId(&second_machine_id
));
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
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:
29 // https://code.google.com/p/googletest/issues/detail?id=322
30 // https://code.google.com/p/googletest/issues/detail?id=458
31 EXPECT_TRUE((kExpectedStatus
== MachineIdStatus::SUCCESS
) ==
32 !first_machine_id
.empty());
33 EXPECT_EQ(first_machine_id
, second_machine_id
);