| 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 #include "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // the username to the UserCloudPolicyValidator. | 278 // the username to the UserCloudPolicyValidator. |
| 279 SigninManager* signin_manager = | 279 SigninManager* signin_manager = |
| 280 SigninManagerFactory::GetForProfile(browser()->profile()); | 280 SigninManagerFactory::GetForProfile(browser()->profile()); |
| 281 ASSERT_TRUE(signin_manager); | 281 ASSERT_TRUE(signin_manager); |
| 282 signin_manager->SetAuthenticatedAccountInfo(GetTestGaiaId(), GetTestUser()); | 282 signin_manager->SetAuthenticatedAccountInfo(GetTestGaiaId(), GetTestUser()); |
| 283 | 283 |
| 284 UserCloudPolicyManager* policy_manager = | 284 UserCloudPolicyManager* policy_manager = |
| 285 UserCloudPolicyManagerFactory::GetForBrowserContext( | 285 UserCloudPolicyManagerFactory::GetForBrowserContext( |
| 286 browser()->profile()); | 286 browser()->profile()); |
| 287 ASSERT_TRUE(policy_manager); | 287 ASSERT_TRUE(policy_manager); |
| 288 policy_manager->Connect( | 288 policy_manager->Connect(g_browser_process->local_state(), |
| 289 g_browser_process->local_state(), | 289 g_browser_process->system_request_context(), |
| 290 g_browser_process->system_request_context(), | 290 UserCloudPolicyManager::CreateCloudPolicyClient( |
| 291 UserCloudPolicyManager::CreateCloudPolicyClient( | 291 connector->device_management_service(), |
| 292 connector->device_management_service(), | 292 g_browser_process->system_request_context())); |
| 293 g_browser_process->system_request_context()).Pass()); | |
| 294 #endif // defined(OS_CHROMEOS) | 293 #endif // defined(OS_CHROMEOS) |
| 295 | 294 |
| 296 ASSERT_TRUE(policy_manager->core()->client()); | 295 ASSERT_TRUE(policy_manager->core()->client()); |
| 297 base::RunLoop run_loop; | 296 base::RunLoop run_loop; |
| 298 MockCloudPolicyClientObserver observer; | 297 MockCloudPolicyClientObserver observer; |
| 299 EXPECT_CALL(observer, OnRegistrationStateChanged(_)).WillOnce( | 298 EXPECT_CALL(observer, OnRegistrationStateChanged(_)).WillOnce( |
| 300 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 299 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 301 policy_manager->core()->client()->AddObserver(&observer); | 300 policy_manager->core()->client()->AddObserver(&observer); |
| 302 | 301 |
| 303 // Give a bogus OAuth token to the |policy_manager|. This should make its | 302 // Give a bogus OAuth token to the |policy_manager|. This should make its |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 | 526 |
| 528 // They should now serialize to the same bytes. | 527 // They should now serialize to the same bytes. |
| 529 std::string chrome_settings_serialized; | 528 std::string chrome_settings_serialized; |
| 530 std::string cloud_policy_serialized; | 529 std::string cloud_policy_serialized; |
| 531 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 530 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
| 532 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 531 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
| 533 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 532 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
| 534 } | 533 } |
| 535 | 534 |
| 536 } // namespace policy | 535 } // namespace policy |
| OLD | NEW |