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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_test_helper.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: Rearrange device settings list. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 18 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
19 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 19 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
20 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
20 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 21 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
22 #include "chrome/browser/chromeos/settings/cros_settings.h"
23 #include "chrome/browser/chromeos/settings/device_settings_provider.h"
21 #include "chrome/browser/chromeos/settings/device_settings_service.h" 24 #include "chrome/browser/chromeos/settings/device_settings_service.h"
22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 25 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
26 #include "chrome/test/base/scoped_testing_local_state.h"
23 #include "chromeos/dbus/session_manager_client.h" 27 #include "chromeos/dbus/session_manager_client.h"
28 #include "chromeos/settings/cros_settings_provider.h"
24 #include "components/ownership/mock_owner_key_util.h" 29 #include "components/ownership/mock_owner_key_util.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 30 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
27 32
28 class TestingProfile; 33 class TestingProfile;
29 34
30 namespace chromeos { 35 namespace chromeos {
31 36
32 class DBusThreadManagerSetter; 37 class DBusThreadManagerSetter;
33 38
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // with the global instance (DeviceSettingsService::Get()). 192 // with the global instance (DeviceSettingsService::Get()).
188 DeviceSettingsService device_settings_service_; 193 DeviceSettingsService device_settings_service_;
189 scoped_ptr<TestingProfile> profile_; 194 scoped_ptr<TestingProfile> profile_;
190 195
191 scoped_ptr<DBusThreadManagerSetter> dbus_setter_; 196 scoped_ptr<DBusThreadManagerSetter> dbus_setter_;
192 197
193 private: 198 private:
194 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); 199 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase);
195 }; 200 };
196 201
202 class OwnerSettingsTestBase : public DeviceSettingsTestBase {
203 protected:
204 OwnerSettingsTestBase();
205 ~OwnerSettingsTestBase() override;
206
207 void SetUp() override;
208 void TearDown() override;
209
210 // Method to replace CrosSettingsProvider for the specified path. It will be
211 // restored in TearDown.
212 void ReplaceProvider(const std::string& path);
213
214 scoped_ptr<DeviceSettingsProvider> settings_provider_;
215 OwnerSettingsServiceChromeOS* owner_settings_service_ = nullptr;
216
217 // Helpers used to mock out cros settings.
218 ScopedTestingLocalState local_state_;
219 ScopedTestDeviceSettingsService test_device_settings_service_;
220 ScopedTestCrosSettings test_cros_settings_;
221 CrosSettingsProvider* device_settings_provider_ = nullptr;
222 ScopedTestOwnerSettings test_owner_settings_;
223
224 private:
225 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsTestBase);
226 };
227
197 } // namespace chromeos 228 } // namespace chromeos
198 229
199 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ 230 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698