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

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: Nits. 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..1f98cb5087168497476491f7e779df0aa3d86a5c
--- /dev/null
+++ b/chrome/browser/chromeos/settings/settings_provider_test_base.h
@@ -0,0 +1,54 @@
+// 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/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/chromeos/settings/device_settings_provider.h"
bartfab (slow) 2015/03/31 14:12:41 Nit: Not used.
+#include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
+
+class Profile;
+
+namespace chromeos {
+
+class FakeOwnerSettingsService;
+class ScopedTestCrosSettings;
+class ScopedTestDeviceSettingsService;
+
+class SettingsProviderTestBase {
bartfab (slow) 2015/03/31 14:12:41 You are using a strange paradigm here. Even though
+ public:
+ SettingsProviderTestBase();
+
+ // 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;
bartfab (slow) 2015/03/31 14:12:41 Nit: Forward-declare CrosSettingProvider.
+ StubCrosSettingsProvider stub_settings_provider_;
+
+ scoped_ptr<chromeos::FakeOwnerSettingsService> owner_settings_service_;
bartfab (slow) 2015/03/31 14:12:41 Nit: s/chromeos:://
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SettingsProviderTestBase);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_SETTINGS_SETTINGS_PROVIDER_TEST_BASE_H_

Powered by Google App Engine
This is Rietveld 408576698