OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/base64url.h" | 7 #include "base/base64url.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // the username to the UserCloudPolicyValidator. | 169 // the username to the UserCloudPolicyValidator. |
170 SigninManager* signin_manager = | 170 SigninManager* signin_manager = |
171 SigninManagerFactory::GetForProfile(browser()->profile()); | 171 SigninManagerFactory::GetForProfile(browser()->profile()); |
172 ASSERT_TRUE(signin_manager); | 172 ASSERT_TRUE(signin_manager); |
173 signin_manager->SetAuthenticatedAccountInfo("12345", "user@example.com"); | 173 signin_manager->SetAuthenticatedAccountInfo("12345", "user@example.com"); |
174 | 174 |
175 UserCloudPolicyManager* policy_manager = | 175 UserCloudPolicyManager* policy_manager = |
176 UserCloudPolicyManagerFactory::GetForBrowserContext( | 176 UserCloudPolicyManagerFactory::GetForBrowserContext( |
177 browser()->profile()); | 177 browser()->profile()); |
178 ASSERT_TRUE(policy_manager); | 178 ASSERT_TRUE(policy_manager); |
179 policy_manager->Connect( | 179 policy_manager->Connect(g_browser_process->local_state(), |
180 g_browser_process->local_state(), | 180 g_browser_process->system_request_context(), |
181 g_browser_process->system_request_context(), | 181 UserCloudPolicyManager::CreateCloudPolicyClient( |
182 UserCloudPolicyManager::CreateCloudPolicyClient( | 182 connector->device_management_service(), |
183 connector->device_management_service(), | 183 g_browser_process->system_request_context())); |
184 g_browser_process->system_request_context()).Pass()); | |
185 #endif // defined(OS_CHROMEOS) | 184 #endif // defined(OS_CHROMEOS) |
186 | 185 |
187 // Register the cloud policy client. | 186 // Register the cloud policy client. |
188 ASSERT_TRUE(policy_manager->core()->client()); | 187 ASSERT_TRUE(policy_manager->core()->client()); |
189 base::RunLoop run_loop; | 188 base::RunLoop run_loop; |
190 MockCloudPolicyClientObserver observer; | 189 MockCloudPolicyClientObserver observer; |
191 EXPECT_CALL(observer, OnRegistrationStateChanged(_)) | 190 EXPECT_CALL(observer, OnRegistrationStateChanged(_)) |
192 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 191 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
193 policy_manager->core()->client()->AddObserver(&observer); | 192 policy_manager->core()->client()->AddObserver(&observer); |
194 policy_manager->core()->client()->SetupRegistration(kDMToken, kDeviceID); | 193 policy_manager->core()->client()->SetupRegistration(kDMToken, kDeviceID); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); | 330 ExtensionTestMessageListener signin_policy_listener(kTestPolicyJSON, true); |
332 event_listener2.Reply("get-policy-Name"); | 331 event_listener2.Reply("get-policy-Name"); |
333 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); | 332 EXPECT_TRUE(signin_policy_listener.WaitUntilSatisfied()); |
334 | 333 |
335 // And the cache is back. | 334 // And the cache is back. |
336 EXPECT_TRUE(base::PathExists(cache_path)); | 335 EXPECT_TRUE(base::PathExists(cache_path)); |
337 } | 336 } |
338 #endif | 337 #endif |
339 | 338 |
340 } // namespace policy | 339 } // namespace policy |
OLD | NEW |