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

Side by Side Diff: chrome/browser/policy/device_management_policy_provider_unittest.cc

Issue 6409040: New policy protobuf protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review! Created 9 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/scoped_temp_dir.h" 7 #include "base/scoped_temp_dir.h"
8 #include "chrome/browser/browser_thread.h" 8 #include "chrome/browser/browser_thread.h"
9 #include "chrome/browser/net/gaia/token_service.h" 9 #include "chrome/browser/net/gaia/token_service.h"
10 #include "chrome/browser/policy/configuration_policy_pref_store.h" 10 #include "chrome/browser/policy/configuration_policy_pref_store.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 CreateNewProvider(); 51 CreateNewProvider();
52 EXPECT_TRUE(waiting_for_initial_policies()); 52 EXPECT_TRUE(waiting_for_initial_policies());
53 loop_.RunAllPending(); 53 loop_.RunAllPending();
54 } 54 }
55 55
56 void CreateNewProvider() { 56 void CreateNewProvider() {
57 backend_ = new MockDeviceManagementBackend; 57 backend_ = new MockDeviceManagementBackend;
58 provider_.reset(new DeviceManagementPolicyProvider( 58 provider_.reset(new DeviceManagementPolicyProvider(
59 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 59 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
60 backend_, 60 backend_,
61 profile_.get())); 61 profile_.get(),
62 false));
62 provider_->SetDeviceTokenFetcher( 63 provider_->SetDeviceTokenFetcher(
63 new TestingDeviceTokenFetcher(backend_, 64 new TestingDeviceTokenFetcher(backend_,
64 profile_.get(), 65 profile_.get(),
65 provider_->GetTokenPath())); 66 provider_->GetTokenPath()));
66 } 67 }
67 68
68 void CreateNewProvider(int64 policy_refresh_rate_ms, 69 void CreateNewProvider(int64 policy_refresh_rate_ms,
69 int policy_refresh_fuzz_factor_percent, 70 int policy_refresh_fuzz_factor_percent,
70 int64 policy_refresh_fuzz_max, 71 int64 policy_refresh_fuzz_max,
71 int64 policy_refresh_error_delay_ms, 72 int64 policy_refresh_error_delay_ms,
72 int64 token_fetch_error_delay_ms, 73 int64 token_fetch_error_delay_ms,
73 int64 unmanaged_device_refresh_rate_ms) { 74 int64 unmanaged_device_refresh_rate_ms) {
74 backend_ = new MockDeviceManagementBackend; 75 backend_ = new MockDeviceManagementBackend;
75 provider_.reset(new DeviceManagementPolicyProvider( 76 provider_.reset(new DeviceManagementPolicyProvider(
76 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), 77 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
77 backend_, 78 backend_,
78 profile_.get(), 79 profile_.get(),
80 false,
79 policy_refresh_rate_ms, 81 policy_refresh_rate_ms,
80 policy_refresh_fuzz_factor_percent, 82 policy_refresh_fuzz_factor_percent,
81 policy_refresh_fuzz_max, 83 policy_refresh_fuzz_max,
82 policy_refresh_error_delay_ms, 84 policy_refresh_error_delay_ms,
83 token_fetch_error_delay_ms, 85 token_fetch_error_delay_ms,
84 unmanaged_device_refresh_rate_ms)); 86 unmanaged_device_refresh_rate_ms));
85 provider_->SetDeviceTokenFetcher( 87 provider_->SetDeviceTokenFetcher(
86 new TestingDeviceTokenFetcher(backend_, 88 new TestingDeviceTokenFetcher(backend_,
87 profile_.get(), 89 profile_.get(),
88 provider_->GetTokenPath())); 90 provider_->GetTokenPath()));
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy, 356 MockDeviceManagementBackendSucceedBooleanPolicy(key::kDisableSpdy,
355 true)); 357 true));
356 } 358 }
357 SimulateSuccessfulLoginAndRunPending(); 359 SimulateSuccessfulLoginAndRunPending();
358 // (3) Since the backend call this time returned a device id, the "unmanaged" 360 // (3) Since the backend call this time returned a device id, the "unmanaged"
359 // marker should have been deleted. 361 // marker should have been deleted.
360 EXPECT_FALSE(cache(provider_.get())->is_device_unmanaged()); 362 EXPECT_FALSE(cache(provider_.get())->is_device_unmanaged());
361 } 363 }
362 364
363 } // namespace policy 365 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698