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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_browsertest.cc

Issue 44083005: policy: Remove UserCloudPolicyManagerFactory's dependency on Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month 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) 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/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 ASSERT_TRUE(policy_manager); 180 ASSERT_TRUE(policy_manager);
181 #else 181 #else
182 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass 182 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass
183 // the username to the UserCloudPolicyValidator. 183 // the username to the UserCloudPolicyValidator.
184 SigninManager* signin_manager = 184 SigninManager* signin_manager =
185 SigninManagerFactory::GetForProfile(browser()->profile()); 185 SigninManagerFactory::GetForProfile(browser()->profile());
186 ASSERT_TRUE(signin_manager); 186 ASSERT_TRUE(signin_manager);
187 signin_manager->SetAuthenticatedUsername(GetTestUser()); 187 signin_manager->SetAuthenticatedUsername(GetTestUser());
188 188
189 UserCloudPolicyManager* policy_manager = 189 UserCloudPolicyManager* policy_manager =
190 UserCloudPolicyManagerFactory::GetForProfile(browser()->profile()); 190 UserCloudPolicyManagerFactory::GetForBrowserContext(
191 browser()->profile());
191 ASSERT_TRUE(policy_manager); 192 ASSERT_TRUE(policy_manager);
192 policy_manager->Connect(g_browser_process->local_state(), 193 policy_manager->Connect(g_browser_process->local_state(),
193 g_browser_process->system_request_context(), 194 g_browser_process->system_request_context(),
194 UserCloudPolicyManager::CreateCloudPolicyClient( 195 UserCloudPolicyManager::CreateCloudPolicyClient(
195 connector->device_management_service()).Pass()); 196 connector->device_management_service()).Pass());
196 #endif // defined(OS_CHROMEOS) 197 #endif // defined(OS_CHROMEOS)
197 198
198 ASSERT_TRUE(policy_manager->core()->client()); 199 ASSERT_TRUE(policy_manager->core()->client());
199 base::RunLoop run_loop; 200 base::RunLoop run_loop;
200 MockCloudPolicyClientObserver observer; 201 MockCloudPolicyClientObserver observer;
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 423
423 // They should now serialize to the same bytes. 424 // They should now serialize to the same bytes.
424 std::string chrome_settings_serialized; 425 std::string chrome_settings_serialized;
425 std::string cloud_policy_serialized; 426 std::string cloud_policy_serialized;
426 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized)); 427 ASSERT_TRUE(chrome_settings.SerializeToString(&chrome_settings_serialized));
427 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized)); 428 ASSERT_TRUE(cloud_policy.SerializeToString(&cloud_policy_serialized));
428 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized); 429 EXPECT_EQ(chrome_settings_serialized, cloud_policy_serialized);
429 } 430 }
430 431
431 } // namespace policy 432 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/DEPS ('k') | chrome/browser/policy/cloud/cloud_policy_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698