Chromium Code Reviews| 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/message_loop.h" | 15 #include "base/message_loop.h" |
| 16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
| 17 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 17 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| 18 #include "chrome/browser/chromeos/settings/cros_settings.h" | |
| 18 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 19 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 19 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 20 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 20 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" | 21 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" |
| 21 #include "chromeos/dbus/session_manager_client.h" | 22 #include "chromeos/dbus/session_manager_client.h" |
| 22 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 25 |
| 25 namespace chromeos { | 26 namespace chromeos { |
| 26 | 27 |
| 27 // A helper class for tests mocking out session_manager's device settings | 28 // A helper class for tests mocking out session_manager's device settings |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 PolicyState(); | 119 PolicyState(); |
| 119 ~PolicyState(); | 120 ~PolicyState(); |
| 120 | 121 |
| 121 bool HasPendingOperations() const { | 122 bool HasPendingOperations() const { |
| 122 return !store_callbacks_.empty() || !retrieve_callbacks_.empty(); | 123 return !store_callbacks_.empty() || !retrieve_callbacks_.empty(); |
| 123 } | 124 } |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 PolicyState device_policy_; | 127 PolicyState device_policy_; |
| 127 std::map<std::string, PolicyState> device_local_account_policy_; | 128 std::map<std::string, PolicyState> device_local_account_policy_; |
| 129 scoped_ptr<ScopedTestCrosSettings> test_cros_settings_; | |
|
Mattias Nissler (ping if slow)
2013/04/16 16:09:51
This file shouldn't have to depend on CrosSettings
stevenjb
2013/04/16 16:49:43
Enough tests that rely on this also seem to rely o
stevenjb
2013/04/16 17:07:41
I'll go ahead and move this, I agree it is awkward
Mattias Nissler (ping if slow)
2013/04/16 18:04:13
Thanks!
| |
| 128 | 130 |
| 129 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestHelper); | 131 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestHelper); |
| 130 }; | 132 }; |
| 131 | 133 |
| 132 // Wraps the singleton device settings and initializes it to the point where it | 134 // Wraps the singleton device settings and initializes it to the point where it |
| 133 // reports OWNERSHIP_NONE for the ownership status. | 135 // reports OWNERSHIP_NONE for the ownership status. |
| 134 class ScopedDeviceSettingsTestHelper : public DeviceSettingsTestHelper { | 136 class ScopedDeviceSettingsTestHelper : public DeviceSettingsTestHelper { |
| 135 public: | 137 public: |
| 136 ScopedDeviceSettingsTestHelper(); | 138 ScopedDeviceSettingsTestHelper(); |
| 137 virtual ~ScopedDeviceSettingsTestHelper(); | 139 virtual ~ScopedDeviceSettingsTestHelper(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 160 void ReloadDeviceSettings(); | 162 void ReloadDeviceSettings(); |
| 161 | 163 |
| 162 MessageLoop loop_; | 164 MessageLoop loop_; |
| 163 content::TestBrowserThread ui_thread_; | 165 content::TestBrowserThread ui_thread_; |
| 164 content::TestBrowserThread file_thread_; | 166 content::TestBrowserThread file_thread_; |
| 165 | 167 |
| 166 policy::DevicePolicyBuilder device_policy_; | 168 policy::DevicePolicyBuilder device_policy_; |
| 167 | 169 |
| 168 DeviceSettingsTestHelper device_settings_test_helper_; | 170 DeviceSettingsTestHelper device_settings_test_helper_; |
| 169 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; | 171 scoped_refptr<MockOwnerKeyUtil> owner_key_util_; |
| 170 DeviceSettingsService device_settings_service_; | 172 |
| 173 // Convenience pointer to DeviceSettingsService singleton. | |
| 174 DeviceSettingsService* device_settings_service_; | |
|
Mattias Nissler (ping if slow)
2013/04/16 16:09:51
The whole point of this class was to enable testin
stevenjb
2013/04/16 16:49:43
The problem is, because it *is* a global singleton
Mattias Nissler (ping if slow)
2013/04/16 18:04:13
Per offline discussion, the plan is to not initial
| |
| 171 | 175 |
| 172 private: | 176 private: |
| 173 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); | 177 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); |
| 174 }; | 178 }; |
| 175 | 179 |
| 176 } // namespace chromeos | 180 } // namespace chromeos |
| 177 | 181 |
| 178 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ | 182 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ |
| OLD | NEW |