| OLD | NEW |
| 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_user_manager.h" | 18 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
| 19 #include "chrome/browser/chromeos/login/users/user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 20 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 20 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 21 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 21 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 23 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" | 23 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" |
| 24 #include "chromeos/dbus/session_manager_client.h" | 24 #include "chromeos/dbus/session_manager_client.h" |
| 25 #include "content/public/test/test_browser_thread.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 class TestingProfile; | 28 class TestingProfile; |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 | 31 |
| 32 class FakeDBusThreadManager; | 32 class FakeDBusThreadManager; |
| 33 | 33 |
| 34 // A helper class for tests mocking out session_manager's device settings | 34 // A helper class for tests mocking out session_manager's device settings |
| 35 // interface. The pattern is to initialize DeviceSettingsService with the helper | 35 // interface. The pattern is to initialize DeviceSettingsService with the helper |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 // Flushes any pending device settings operations. | 173 // Flushes any pending device settings operations. |
| 174 void FlushDeviceSettings(); | 174 void FlushDeviceSettings(); |
| 175 | 175 |
| 176 // Triggers an owner key and device settings reload on | 176 // Triggers an owner key and device settings reload on |
| 177 // |device_settings_service_| and flushes the resulting load operation. | 177 // |device_settings_service_| and flushes the resulting load operation. |
| 178 void ReloadDeviceSettings(); | 178 void ReloadDeviceSettings(); |
| 179 | 179 |
| 180 void InitOwner(const std::string& user_id, bool tpm_is_ready); | 180 void InitOwner(const std::string& user_id, bool tpm_is_ready); |
| 181 | 181 |
| 182 base::MessageLoopForUI loop_; | 182 content::TestBrowserThreadBundle thread_bundle_; |
| 183 content::TestBrowserThread ui_thread_; | |
| 184 content::TestBrowserThread file_thread_; | |
| 185 | 183 |
| 186 policy::DevicePolicyBuilder device_policy_; | 184 policy::DevicePolicyBuilder device_policy_; |
| 187 | 185 |
| 188 DeviceSettingsTestHelper device_settings_test_helper_; | 186 DeviceSettingsTestHelper device_settings_test_helper_; |
| 189 FakeUserManager* user_manager_; | 187 FakeUserManager* user_manager_; |
| 190 ScopedUserManagerEnabler user_manager_enabler_; | 188 ScopedUserManagerEnabler user_manager_enabler_; |
| 191 scoped_ptr<TestingProfile> profile_; | 189 scoped_ptr<TestingProfile> profile_; |
| 192 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; | 190 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; |
| 193 // Local DeviceSettingsService instance for tests. Avoid using in combination | 191 // Local DeviceSettingsService instance for tests. Avoid using in combination |
| 194 // with the global instance (DeviceSettingsService::Get()). | 192 // with the global instance (DeviceSettingsService::Get()). |
| 195 DeviceSettingsService device_settings_service_; | 193 DeviceSettingsService device_settings_service_; |
| 196 | 194 |
| 197 chromeos::FakeDBusThreadManager* fake_dbus_thread_manager_; | 195 chromeos::FakeDBusThreadManager* fake_dbus_thread_manager_; |
| 198 | 196 |
| 199 private: | 197 private: |
| 200 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); | 198 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); |
| 201 }; | 199 }; |
| 202 | 200 |
| 203 } // namespace chromeos | 201 } // namespace chromeos |
| 204 | 202 |
| 205 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ | 203 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ |
| OLD | NEW |