Chromium Code Reviews| Index: chrome/browser/policy/device_management_policy_provider.h |
| diff --git a/chrome/browser/policy/device_management_policy_provider.h b/chrome/browser/policy/device_management_policy_provider.h |
| index 1003997a6ac689e175d1d0116e49f92efcf5cc6b..5cf955b372d9567121e291151b6e7e2be74374a0 100644 |
| --- a/chrome/browser/policy/device_management_policy_provider.h |
| +++ b/chrome/browser/policy/device_management_policy_provider.h |
| @@ -56,10 +56,8 @@ class DeviceManagementPolicyProvider |
| // server and no response or error has yet been received. |
| bool IsPolicyRequestPending() const { return policy_request_pending_; } |
| - // Returns true if the device management policy provider has an empty policy |
| - // cache and is waiting for a pending policy request to retrive the inital |
| - // set of policies. If cached policies are available false is returned even in |
| - // the case of a pending policy request. |
| + // Returns true if the device management policy provider is currently waiting |
| + // for the first attempt to fetch policies to complete. |
| bool WaitingForInitialPolicies() const; |
| // Tells the provider that the passed in token service reference is about to |
| @@ -72,11 +70,29 @@ class DeviceManagementPolicyProvider |
| friend class DeviceManagementPolicyProviderTest; |
| + // More configurable constructor for use by test cases. |
| + DeviceManagementPolicyProvider(const PolicyDefinitionList* policy_list, |
| + DeviceManagementBackend* backend, |
| + TokenService* token_service, |
| + const FilePath& storage_dir, |
| + int64 policy_refresh_rate_ms, |
| + int64 policy_refresh_max_earlier_ms, |
| + int64 policy_refresh_error_delay_ms, |
| + int64 token_fetch_error_delay_ms, |
| + int64 unmanaged_device_refresh_rate_ms); |
|
Mattias Nissler (ping if slow)
2010/11/26 10:37:45
9 parameters are 5 too many IMHO :) What was wrong
danno
2010/11/26 10:48:36
I disagree, this is testing-specific code that cen
Jakob Kummerow
2010/11/26 11:07:42
(Discussed offline.)
One concrete problem with the
|
| + |
| // Called by constructors to perform shared initialization. Initialization |
| // requiring the IOThread must not be performed directly in this method, |
| // rather must be deferred until the IOThread is fully initialized. This is |
| // the case in InitializeAfterIOThreadExists. |
| - void Initialize(); |
| + void Initialize(DeviceManagementBackend* backend, |
| + TokenService* token_service, |
| + const FilePath& storage_dir, |
| + int64 policy_refresh_rate_ms, |
| + int64 policy_refresh_max_earlier_ms, |
| + int64 policy_refresh_error_delay_ms, |
| + int64 token_fetch_error_delay_ms, |
| + int64 unmanaged_device_refresh_rate_ms); |
| // Called by a deferred task posted to the UI thread to complete the portion |
| // of initialization that requires the IOThread. |
| @@ -96,9 +112,7 @@ class DeviceManagementPolicyProvider |
| // Calculates when the next RefreshTask shall be executed. |
| int64 GetRefreshTaskDelay(); |
| - // Returns true if the policy cache is empty and hence no policies are |
| - // available. |
| - bool IsPolicyCacheEmpty() const; |
| + void StopWaitingForInitialPolicies(); |
| #if defined(OS_CHROMEOS) |
| // Send a CLOUD_POLICY_UPDATE notification. |
| @@ -114,20 +128,6 @@ class DeviceManagementPolicyProvider |
| static FilePath GetOrCreateDeviceManagementDir( |
| const FilePath& user_data_dir); |
| - // Give unit tests the ability to override timeout settings. |
| - void set_policy_refresh_rate_ms(int64 policy_refresh_rate_ms) { |
| - policy_refresh_rate_ms_ = policy_refresh_rate_ms; |
| - } |
| - void set_policy_refresh_max_earlier_ms(int64 policy_refresh_max_earlier_ms) { |
| - policy_refresh_max_earlier_ms_ = policy_refresh_max_earlier_ms; |
| - } |
| - void set_policy_refresh_error_delay_ms(int64 policy_refresh_error_delay_ms) { |
| - policy_refresh_error_delay_ms_ = policy_refresh_error_delay_ms; |
| - } |
| - void set_token_fetch_error_delay_ms(int64 token_fetch_error_delay_ms) { |
| - token_fetch_error_delay_ms_ = token_fetch_error_delay_ms; |
| - } |
| - |
| scoped_ptr<DeviceManagementBackend> backend_; |
| TokenService* token_service_; // weak |
| scoped_ptr<DeviceManagementPolicyCache> cache_; |
| @@ -136,10 +136,12 @@ class DeviceManagementPolicyProvider |
| FilePath storage_dir_; |
| bool policy_request_pending_; |
| bool refresh_task_pending_; |
| + bool waiting_for_initial_policies_; |
| int64 policy_refresh_rate_ms_; |
| int64 policy_refresh_max_earlier_ms_; |
| int64 policy_refresh_error_delay_ms_; |
| int64 token_fetch_error_delay_ms_; |
| + int64 unmanaged_device_refresh_rate_ms_; |
| DISALLOW_COPY_AND_ASSIGN(DeviceManagementPolicyProvider); |
| }; |