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

Unified Diff: chrome/browser/chromeos/settings/settings_provider_test_base.h

Issue 1019283004: Switch to direct use of OwnerSettingsServiceChromeOS::Set() in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use settings provider to set read-only device settings. Created 5 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/settings/settings_provider_test_base.h
diff --git a/chrome/browser/chromeos/settings/settings_provider_test_base.h b/chrome/browser/chromeos/settings/settings_provider_test_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..973ec6edbc9249b1e52c140aa317fe9385cf3d43
--- /dev/null
+++ b/chrome/browser/chromeos/settings/settings_provider_test_base.h
@@ -0,0 +1,52 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_SETTINGS_PROVIDER_TEST_BASE_H_
+#define CHROME_BROWSER_CHROMEOS_SETTINGS_SETTINGS_PROVIDER_TEST_BASE_H_
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/settings/device_settings_provider.h"
+#include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
+
+class Profile;
+
+namespace chromeos {
+
+class FakeOwnerSettingsService;
+class ScopedTestCrosSettings;
+class ScopedTestDeviceSettingsService;
+
+class SettingsProviderTestBase {
+ public:
+ SettingsProviderTestBase();
Mattias Nissler (ping if slow) 2015/03/30 14:45:46 nit: blank line before comment.
+ // In some cases it is required to pass |create_settings_service| as false:
+ // if the test already has a device settings service and/or CrosSettings set
+ // up by another bundle, creating another one causes crash.
+ explicit SettingsProviderTestBase(bool create_settings_service);
+ virtual ~SettingsProviderTestBase();
+
+ protected:
+ // Methods to replace and restore CrosSettingsProvider for the specified path.
+ void ReplaceProvider(const std::string& path);
+ void RestoreProvider();
+
+ void InitOwnerSettingsService(Profile* profile);
+
+ // Helpers used to mock out cros settings.
+ scoped_ptr<ScopedTestDeviceSettingsService> test_device_settings_service_;
+ scoped_ptr<ScopedTestCrosSettings> test_cros_settings_;
+ CrosSettingsProvider* device_settings_provider_ = nullptr;
+ StubCrosSettingsProvider stub_settings_provider_;
+
+ scoped_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SettingsProviderTestBase);
Mattias Nissler (ping if slow) 2015/03/30 14:45:46 #include "base/macros.h"
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SETTINGS_PROVIDER_TEST_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698