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 <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // Verify default values. | 66 // Verify default values. |
67 const base::Value kTrueValue(true); | 67 const base::Value kTrueValue(true); |
68 AssertPref(kAccountsPrefAllowGuest, &kTrueValue); | 68 AssertPref(kAccountsPrefAllowGuest, &kTrueValue); |
69 AssertPref(kAccountsPrefAllowNewUser, &kTrueValue); | 69 AssertPref(kAccountsPrefAllowNewUser, &kTrueValue); |
70 AssertPref(kAccountsPrefShowUserNamesOnSignIn, &kTrueValue); | 70 AssertPref(kAccountsPrefShowUserNamesOnSignIn, &kTrueValue); |
71 AssertPref(kAccountsPrefSupervisedUsersEnabled, &kTrueValue); | 71 AssertPref(kAccountsPrefSupervisedUsersEnabled, &kTrueValue); |
72 } | 72 } |
73 | 73 |
74 TEST_F(StubCrosSettingsProviderTest, Set) { | 74 TEST_F(StubCrosSettingsProviderTest, Set) { |
75 // Setting value and reading it afterwards returns the same value. | 75 // Setting value and reading it afterwards returns the same value. |
76 base::StringValue owner_value("me@owner"); | 76 base::Value owner_value("me@owner"); |
77 provider_->Set(kDeviceOwner, owner_value); | 77 provider_->Set(kDeviceOwner, owner_value); |
78 AssertPref(kDeviceOwner, &owner_value); | 78 AssertPref(kDeviceOwner, &owner_value); |
79 ExpectObservers(kDeviceOwner, 1); | 79 ExpectObservers(kDeviceOwner, 1); |
80 } | 80 } |
81 | 81 |
82 TEST_F(StubCrosSettingsProviderTest, SetMissing) { | 82 TEST_F(StubCrosSettingsProviderTest, SetMissing) { |
83 // Setting is missing initially but is added by |Set|. | 83 // Setting is missing initially but is added by |Set|. |
84 base::StringValue pref_value("testing"); | 84 base::Value pref_value("testing"); |
85 ASSERT_FALSE(provider_->Get(kReleaseChannel)); | 85 ASSERT_FALSE(provider_->Get(kReleaseChannel)); |
86 provider_->Set(kReleaseChannel, pref_value); | 86 provider_->Set(kReleaseChannel, pref_value); |
87 AssertPref(kReleaseChannel, &pref_value); | 87 AssertPref(kReleaseChannel, &pref_value); |
88 ExpectObservers(kReleaseChannel, 1); | 88 ExpectObservers(kReleaseChannel, 1); |
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 |