OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/settings/stub_cros_settings_provider.h" | 5 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <string> | 8 #include <string> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chromeos/settings/cros_settings_names.h" | 12 #include "chromeos/settings/cros_settings_names.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 void Fail() { | 19 void Fail() { |
20 // Should never be called. | 20 // Should never be called. |
(...skipping 24 matching lines...) Expand all Loading... |
45 } | 45 } |
46 | 46 |
47 void ExpectObservers(const std::string& prefName, int count) { | 47 void ExpectObservers(const std::string& prefName, int count) { |
48 EXPECT_EQ(observer_count_[prefName], count); | 48 EXPECT_EQ(observer_count_[prefName], count); |
49 } | 49 } |
50 | 50 |
51 void FireObservers(const std::string& path) { | 51 void FireObservers(const std::string& path) { |
52 observer_count_[path]++; | 52 observer_count_[path]++; |
53 } | 53 } |
54 | 54 |
55 scoped_ptr<StubCrosSettingsProvider> provider_; | 55 std::unique_ptr<StubCrosSettingsProvider> provider_; |
56 std::map<std::string, int> observer_count_; | 56 std::map<std::string, int> observer_count_; |
57 }; | 57 }; |
58 | 58 |
59 TEST_F(StubCrosSettingsProviderTest, HandlesSettings) { | 59 TEST_F(StubCrosSettingsProviderTest, HandlesSettings) { |
60 // HandlesSettings should return false for unknown settings. | 60 // HandlesSettings should return false for unknown settings. |
61 ASSERT_TRUE(provider_->HandlesSetting(kDeviceOwner)); | 61 ASSERT_TRUE(provider_->HandlesSetting(kDeviceOwner)); |
62 ASSERT_FALSE(provider_->HandlesSetting("no.such.setting")); | 62 ASSERT_FALSE(provider_->HandlesSetting("no.such.setting")); |
63 } | 63 } |
64 | 64 |
65 TEST_F(StubCrosSettingsProviderTest, Defaults) { | 65 TEST_F(StubCrosSettingsProviderTest, Defaults) { |
(...skipping 23 matching lines...) Expand all Loading... |
89 } | 89 } |
90 | 90 |
91 TEST_F(StubCrosSettingsProviderTest, PrepareTrustedValues) { | 91 TEST_F(StubCrosSettingsProviderTest, PrepareTrustedValues) { |
92 // Should return immediately without invoking the callback. | 92 // Should return immediately without invoking the callback. |
93 CrosSettingsProvider::TrustedStatus trusted = | 93 CrosSettingsProvider::TrustedStatus trusted = |
94 provider_->PrepareTrustedValues(base::Bind(&Fail)); | 94 provider_->PrepareTrustedValues(base::Bind(&Fail)); |
95 EXPECT_EQ(CrosSettingsProvider::TRUSTED, trusted); | 95 EXPECT_EQ(CrosSettingsProvider::TRUSTED, trusted); |
96 } | 96 } |
97 | 97 |
98 } // namespace chromeos | 98 } // namespace chromeos |
OLD | NEW |