OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/metrics/machine_id_provider.h" | 5 #include "chrome/browser/metrics/machine_id_provider.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "content/public/test/test_browser_thread_bundle.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
10 | 9 |
11 namespace metrics { | 10 namespace metrics { |
12 | 11 |
13 TEST(MachineIdProviderTest, GetId) { | 12 TEST(MachineIdProviderTest, GetId) { |
14 content::TestBrowserThreadBundle thread_bundle; | |
15 | |
16 scoped_refptr<MachineIdProvider> provider( | 13 scoped_refptr<MachineIdProvider> provider( |
17 MachineIdProvider::CreateInstance()); | 14 MachineIdProvider::CreateInstance()); |
18 std::string id1 = provider->GetMachineId(); | 15 std::string id1 = provider->GetMachineId(); |
19 | 16 |
20 EXPECT_NE(std::string(), id1); | 17 EXPECT_NE(std::string(), id1); |
21 | 18 |
22 std::string id2 = provider->GetMachineId(); | 19 std::string id2 = provider->GetMachineId(); |
23 EXPECT_EQ(id1, id2); | 20 EXPECT_EQ(id1, id2); |
24 } | 21 } |
25 | 22 |
26 } // namespace metrics | 23 } // namespace metrics |
OLD | NEW |