Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(571)

Unified Diff: chrome/browser/chromeos/settings/stub_cros_settings_provider.cc

Issue 1019283004: Switch to direct use of OwnerSettingsServiceChromeOS::Set() in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify a bit. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/stub_cros_settings_provider.cc
diff --git a/chrome/browser/chromeos/settings/stub_cros_settings_provider.cc b/chrome/browser/chromeos/settings/stub_cros_settings_provider.cc
index c11e3c306c2b64dcc97e7dfe84979b0c515dc11e..c4a173e11234e4801e35d5a4e0a686cc56594fae 100644
--- a/chrome/browser/chromeos/settings/stub_cros_settings_provider.cc
+++ b/chrome/browser/chromeos/settings/stub_cros_settings_provider.cc
@@ -37,17 +37,25 @@ const base::Value* StubCrosSettingsProvider::Get(
CrosSettingsProvider::TrustedStatus
StubCrosSettingsProvider::PrepareTrustedValues(const base::Closure& cb) {
- // We don't have a trusted store so all values are available immediately.
- return TRUSTED;
+ return trusted_status_;
}
bool StubCrosSettingsProvider::HandlesSetting(const std::string& path) const {
return DeviceSettingsProvider::IsDeviceSetting(path);
}
+void StubCrosSettingsProvider::SetTrustedStatus(TrustedStatus status) {
+ trusted_status_ = status;
+}
+
+void StubCrosSettingsProvider::SetCurrentUserIsOwner(bool owner) {
+ current_user_is_owner_ = owner;
+}
+
void StubCrosSettingsProvider::DoSet(const std::string& path,
const base::Value& value) {
- values_.SetValue(path, value.DeepCopy());
+ if (current_user_is_owner_)
+ values_.SetValue(path, value.DeepCopy());
NotifyObservers(path);
}
@@ -58,6 +66,11 @@ void StubCrosSettingsProvider::SetDefaults() {
values_.SetBoolean(kAccountsPrefShowUserNamesOnSignIn, true);
values_.SetValue(kAccountsPrefDeviceLocalAccounts, new base::ListValue);
// |kDeviceOwner| will be set to the logged-in user by |UserManager|.
+
+ current_user_is_owner_ = true;
+
+ // We don't have a trusted store so all values are available immediately.
+ trusted_status_ = TRUSTED;
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698