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> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 // Runs all pending retrieve callbacks. | 44 // Runs all pending retrieve callbacks. |
| 45 void FlushRetrieve(); | 45 void FlushRetrieve(); |
| 46 | 46 |
| 47 // Flushes all pending operations. | 47 // Flushes all pending operations. |
| 48 void Flush(); | 48 void Flush(); |
| 49 | 49 |
| 50 // Checks whether any asynchronous Store/Retrieve operations are pending. | 50 // Checks whether any asynchronous Store/Retrieve operations are pending. |
| 51 bool HasPendingOperations() const; | 51 bool HasPendingOperations() const; |
| 52 | 52 |
| 53 bool store_result() { | 53 bool store_result() { |
| 54 return device_policy_.store_result_; | 54 return policy_state_.store_result_; |
| 55 } | 55 } |
| 56 void set_store_result(bool store_result) { | 56 void set_store_result(bool store_result) { |
| 57 device_policy_.store_result_ = store_result; | 57 policy_state_.store_result_ = store_result; |
| 58 } | 58 } |
| 59 | 59 |
| 60 const std::string& policy_blob() { | 60 const std::string& policy_blob() { |
| 61 return device_policy_.policy_blob_; | 61 return policy_state_.policy_blob_; |
| 62 } | 62 } |
| 63 void set_policy_blob(const std::string& policy_blob) { | 63 void set_policy_blob(const std::string& policy_blob) { |
| 64 device_policy_.policy_blob_ = policy_blob; | 64 policy_state_.policy_blob_ = policy_blob; |
| 65 } | 65 } |
| 66 | 66 |
| 67 const std::string& device_local_account_policy_blob( | 67 const std::string& device_local_account_policy_blob( |
| 68 const std::string& id) const { | 68 const std::string& id) const { |
| 69 const std::map<std::string, PolicyState>::const_iterator entry = | 69 const std::map<std::string, PolicyState>::const_iterator entry = |
| 70 device_local_account_policy_.find(id); | 70 device_local_account_policy_.find(id); |
| 71 return entry == device_local_account_policy_.end() ? | 71 return entry == device_local_account_policy_.end() ? |
| 72 EmptyString() : entry->second.policy_blob_; | 72 EmptyString() : entry->second.policy_blob_; |
| 73 } | 73 } |
| 74 | 74 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 std::vector<RetrievePolicyCallback> retrieve_callbacks_; | 116 std::vector<RetrievePolicyCallback> retrieve_callbacks_; |
| 117 | 117 |
| 118 PolicyState(); | 118 PolicyState(); |
| 119 ~PolicyState(); | 119 ~PolicyState(); |
| 120 | 120 |
| 121 bool HasPendingOperations() const { | 121 bool HasPendingOperations() const { |
| 122 return !store_callbacks_.empty() || !retrieve_callbacks_.empty(); | 122 return !store_callbacks_.empty() || !retrieve_callbacks_.empty(); |
| 123 } | 123 } |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 PolicyState device_policy_; | 126 PolicyState policy_state_; |
|
Mattias Nissler (ping if slow)
2013/04/22 10:59:00
I see where you're coming from, but if you feel st
David Roche
2013/04/23 01:36:08
I was actually confused by the fact that there was
| |
| 127 std::map<std::string, PolicyState> device_local_account_policy_; | 127 std::map<std::string, PolicyState> device_local_account_policy_; |
| 128 | 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestHelper); | 129 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestHelper); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 // Wraps the singleton device settings and initializes it to the point where it | 132 // Wraps the singleton device settings and initializes it to the point where it |
| 133 // reports OWNERSHIP_NONE for the ownership status. | 133 // reports OWNERSHIP_NONE for the ownership status. |
| 134 class ScopedDeviceSettingsTestHelper : public DeviceSettingsTestHelper { | 134 class ScopedDeviceSettingsTestHelper : public DeviceSettingsTestHelper { |
| 135 public: | 135 public: |
| 136 ScopedDeviceSettingsTestHelper(); | 136 ScopedDeviceSettingsTestHelper(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 // with the global instance (DeviceSettingsService::Get()). | 171 // with the global instance (DeviceSettingsService::Get()). |
| 172 DeviceSettingsService device_settings_service_; | 172 DeviceSettingsService device_settings_service_; |
| 173 | 173 |
| 174 private: | 174 private: |
| 175 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); | 175 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsTestBase); |
| 176 }; | 176 }; |
| 177 | 177 |
| 178 } // namespace chromeos | 178 } // namespace chromeos |
| 179 | 179 |
| 180 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ | 180 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_DEVICE_SETTINGS_TEST_HELPER_H_ |
| OLD | NEW |