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/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // the username to the UserCloudPolicyValidator. | 164 // the username to the UserCloudPolicyValidator. |
165 SigninManager* signin_manager = | 165 SigninManager* signin_manager = |
166 SigninManagerFactory::GetForProfile(browser()->profile()); | 166 SigninManagerFactory::GetForProfile(browser()->profile()); |
167 ASSERT_TRUE(signin_manager); | 167 ASSERT_TRUE(signin_manager); |
168 signin_manager->SetAuthenticatedUsername(GetTestUser()); | 168 signin_manager->SetAuthenticatedUsername(GetTestUser()); |
169 | 169 |
170 UserCloudPolicyManager* policy_manager = | 170 UserCloudPolicyManager* policy_manager = |
171 UserCloudPolicyManagerFactory::GetForProfile(browser()->profile()); | 171 UserCloudPolicyManagerFactory::GetForProfile(browser()->profile()); |
172 ASSERT_TRUE(policy_manager); | 172 ASSERT_TRUE(policy_manager); |
173 policy_manager->Connect(g_browser_process->local_state(), | 173 policy_manager->Connect(g_browser_process->local_state(), |
174 connector->device_management_service()); | 174 UserCloudPolicyManager::CreateCloudPolicyClient( |
| 175 connector->device_management_service()).Pass()); |
175 #endif // defined(OS_CHROMEOS) | 176 #endif // defined(OS_CHROMEOS) |
176 | 177 |
177 ASSERT_TRUE(policy_manager->core()->client()); | 178 ASSERT_TRUE(policy_manager->core()->client()); |
178 base::RunLoop run_loop; | 179 base::RunLoop run_loop; |
179 MockCloudPolicyClientObserver observer; | 180 MockCloudPolicyClientObserver observer; |
180 EXPECT_CALL(observer, OnRegistrationStateChanged(_)).WillOnce( | 181 EXPECT_CALL(observer, OnRegistrationStateChanged(_)).WillOnce( |
181 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 182 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
182 policy_manager->core()->client()->AddObserver(&observer); | 183 policy_manager->core()->client()->AddObserver(&observer); |
183 | 184 |
184 // Give a bogus OAuth token to the |policy_manager|. This should make its | 185 // Give a bogus OAuth token to the |policy_manager|. This should make its |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 280 |
280 // They should now serialize to the same bytes. | 281 // They should now serialize to the same bytes. |
281 std::string chrome_settings_serialized; | 282 std::string chrome_settings_serialized; |
282 std::string cloud_policy_serialized; | 283 std::string cloud_policy_serialized; |
283 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); | 284 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); |
284 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); | 285 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); |
285 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); | 286 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); |
286 } | 287 } |
287 | 288 |
288 } // namespace policy | 289 } // namespace policy |
OLD | NEW |