OLD | NEW |
---|---|
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 "chrome/browser/policy/cloud_policy_controller.h" | 5 #include "chrome/browser/policy/cloud_policy_controller.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
9 #include "chrome/browser/policy/device_management_service.h" | 9 #include "chrome/browser/policy/device_management_service.h" |
10 #include "chrome/browser/policy/device_token_fetcher.h" | 10 #include "chrome/browser/policy/device_token_fetcher.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 cache_.reset(new UserPolicyCache( | 87 cache_.reset(new UserPolicyCache( |
88 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"))); | 88 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"))); |
89 token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get())); | 89 token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get())); |
90 service_.set_backend(&backend_); | 90 service_.set_backend(&backend_); |
91 } | 91 } |
92 | 92 |
93 virtual void TearDown() { | 93 virtual void TearDown() { |
94 controller_.reset(); // Unregisters observers. | 94 controller_.reset(); // Unregisters observers. |
95 } | 95 } |
96 | 96 |
97 // Takes ownership of |backend|. | 97 // Takes ownership of |backend|. |
Mattias Nissler (ping if slow)
2011/06/24 17:27:17
This comment is outdated.
gfeher
2011/06/27 16:50:24
Done.
| |
98 void CreateNewController() { | 98 void CreateNewController() { |
99 controller_.reset(new CloudPolicyController( | 99 controller_.reset(new CloudPolicyController( |
100 &service_, cache_.get(), token_fetcher_.get(), &identity_strategy_, | 100 &service_, cache_.get(), token_fetcher_.get(), &identity_strategy_, |
101 ¬ifier_, new DummyWorkScheduler)); | 101 ¬ifier_, new DummyWorkScheduler)); |
102 } | 102 } |
103 | 103 |
104 void ExpectHasSpdyPolicy() { | 104 void ExpectHasSpdyPolicy() { |
105 MockConfigurationPolicyStore store; | |
106 EXPECT_CALL(store, Apply(_, _)).Times(AtLeast(1)); | |
107 cache_->GetManagedPolicyProvider()->Provide(&store); | |
108 FundamentalValue expected(true); | 105 FundamentalValue expected(true); |
109 ASSERT_TRUE(store.Get(kPolicyDisableSpdy) != NULL); | 106 const PolicyMap* policy_map = cache_->policy( |
110 EXPECT_TRUE(store.Get(kPolicyDisableSpdy)->Equals(&expected)); | 107 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY); |
108 ASSERT_TRUE(Value::Equals(&expected, policy_map->Get(kPolicyDisableSpdy))); | |
111 } | 109 } |
112 | 110 |
113 void SetupIdentityStrategy( | 111 void SetupIdentityStrategy( |
114 const std::string& device_token, | 112 const std::string& device_token, |
115 const std::string& device_id, | 113 const std::string& device_id, |
116 const std::string& machine_id, | 114 const std::string& machine_id, |
117 const std::string& machine_model, | 115 const std::string& machine_model, |
118 const std::string& policy_type, | 116 const std::string& policy_type, |
119 const em::DeviceRegisterRequest_Type& policy_register_type, | 117 const em::DeviceRegisterRequest_Type& policy_register_type, |
120 const std::string& user_name, | 118 const std::string& user_name, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 "who@what.com", "auth"); | 275 "who@what.com", "auth"); |
278 EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce( | 276 EXPECT_CALL(backend_, ProcessPolicyRequest(_, _, _, _)).WillOnce( |
279 MockDeviceManagementBackendFailPolicy( | 277 MockDeviceManagementBackendFailPolicy( |
280 DeviceManagementBackend::kErrorServiceManagementNotSupported)); | 278 DeviceManagementBackend::kErrorServiceManagementNotSupported)); |
281 EXPECT_CALL(*token_fetcher_.get(), SetUnmanagedState()).Times(1); | 279 EXPECT_CALL(*token_fetcher_.get(), SetUnmanagedState()).Times(1); |
282 CreateNewController(); | 280 CreateNewController(); |
283 loop_.RunAllPending(); | 281 loop_.RunAllPending(); |
284 } | 282 } |
285 | 283 |
286 } // namespace policy | 284 } // namespace policy |
OLD | NEW |