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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_
10 #include "base/prefs/pref_value_map.h"
11 #include "chromeos/settings/cros_settings_provider.h"
15 // CrosSettingsProvider implementation that stores settings in memory unsigned.
16 class StubCrosSettingsProvider
: public CrosSettingsProvider
{
18 explicit StubCrosSettingsProvider(const NotifyObserversCallback
& notify_cb
);
19 StubCrosSettingsProvider();
20 ~StubCrosSettingsProvider() override
;
22 // CrosSettingsProvider implementation.
23 const base::Value
* Get(const std::string
& path
) const override
;
24 TrustedStatus
PrepareTrustedValues(const base::Closure
& callback
) override
;
25 bool HandlesSetting(const std::string
& path
) const override
;
27 void SetTrustedStatus(TrustedStatus status
);
28 void SetCurrentUserIsOwner(bool owner
);
31 // CrosSettingsProvider implementation:
32 void DoSet(const std::string
& path
, const base::Value
& value
) override
;
34 // Initializes settings to their defaults.
37 // In-memory settings storage.
40 // Some tests imply that calling Set() as non-owner doesn't change the actual
41 // value but still trigger a notification. For such cases, it is possible to
42 // emulate this behavior by changing the ownership status to non-owner with
43 // |SetCurrentUserIsOwner(false)|.
44 bool current_user_is_owner_
= true;
46 TrustedStatus trusted_status_
= CrosSettingsProvider::TRUSTED
;
48 DISALLOW_COPY_AND_ASSIGN(StubCrosSettingsProvider
);
51 } // namespace chromeos
53 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_STUB_CROS_SETTINGS_PROVIDER_H_