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

Unified Diff: chrome/browser/chromeos/device_settings_provider.h

Issue 9466005: Make sure the device recovers from policy loss in the consumer case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Now with proper testing. Created 8 years, 9 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/device_settings_provider.h
diff --git a/chrome/browser/chromeos/device_settings_provider.h b/chrome/browser/chromeos/device_settings_provider.h
index 4794b5380f082e3b0b24003da6cd21827991e9d2..58e3e373f1c823fe2128ad1d7e59a4c0d6ec4b50 100644
--- a/chrome/browser/chromeos/device_settings_provider.h
+++ b/chrome/browser/chromeos/device_settings_provider.h
@@ -40,7 +40,20 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
virtual bool HandlesSetting(const std::string& path) const OVERRIDE;
virtual void Reload() OVERRIDE;
+ protected:
+ // Constructor that does the real initialization and can also be used by tests
+ // to mock the low level servers of this class.
+ DeviceSettingsProvider(const NotifyObserversCallback& notify_cb,
+ SignedSettingsHelper* signed_settings_helper,
+ OwnershipService::Status ownership_service);
+
+ void set_ownership_status(OwnershipService::Status status) {
+ ownership_status_ = status;
+ }
+
private:
+ void Initialize();
+
// CrosSettingsProvider implementation:
virtual void DoSet(const std::string& path,
const base::Value& value) OVERRIDE;
@@ -126,6 +139,7 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
// Pending callbacks that need to be invoked after settings verification.
std::vector<base::Closure> callbacks_;
+ SignedSettingsHelper* signed_settings_helper_;
OwnershipService::Status ownership_status_;
mutable scoped_ptr<SignedSettingsMigrationHelper> migration_helper_;
@@ -144,6 +158,9 @@ class DeviceSettingsProvider : public CrosSettingsProvider,
typedef std::pair<std::string, base::Value*> PendingQueueElement;
std::vector<PendingQueueElement> pending_changes_;
+ friend class DeviceSettingsProviderTest;
+ FRIEND_TEST_ALL_PREFIXES(DeviceSettingsProviderTest,
+ InitializationTestUnowned);
DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProvider);
};

Powered by Google App Engine
This is Rietveld 408576698