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

Side by Side Diff: chrome/browser/policy/cloud/component_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) 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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ASSERT_TRUE(policy_manager); 136 ASSERT_TRUE(policy_manager);
137 #else 137 #else
138 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass 138 // Mock a signed-in user. This is used by the UserCloudPolicyStore to pass
139 // the username to the UserCloudPolicyValidator. 139 // the username to the UserCloudPolicyValidator.
140 SigninManager* signin_manager = 140 SigninManager* signin_manager =
141 SigninManagerFactory::GetForProfile(browser()->profile()); 141 SigninManagerFactory::GetForProfile(browser()->profile());
142 ASSERT_TRUE(signin_manager); 142 ASSERT_TRUE(signin_manager);
143 signin_manager->SetAuthenticatedUsername("user@example.com"); 143 signin_manager->SetAuthenticatedUsername("user@example.com");
144 144
145 UserCloudPolicyManager* policy_manager = 145 UserCloudPolicyManager* policy_manager =
146 UserCloudPolicyManagerFactory::GetForProfile(browser()->profile()); 146 UserCloudPolicyManagerFactory::GetForBrowserContext(
147 browser()->profile());
147 ASSERT_TRUE(policy_manager); 148 ASSERT_TRUE(policy_manager);
148 policy_manager->Connect(g_browser_process->local_state(), 149 policy_manager->Connect(g_browser_process->local_state(),
149 g_browser_process->system_request_context(), 150 g_browser_process->system_request_context(),
150 UserCloudPolicyManager::CreateCloudPolicyClient( 151 UserCloudPolicyManager::CreateCloudPolicyClient(
151 connector->device_management_service()).Pass()); 152 connector->device_management_service()).Pass());
152 #endif // defined(OS_CHROMEOS) 153 #endif // defined(OS_CHROMEOS)
153 154
154 // Register the cloud policy client. 155 // Register the cloud policy client.
155 ASSERT_TRUE(policy_manager->core()->client()); 156 ASSERT_TRUE(policy_manager->core()->client());
156 base::RunLoop run_loop; 157 base::RunLoop run_loop;
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 ASSERT_EQ(kTestExtension2, extension2->id()); 249 ASSERT_EQ(kTestExtension2, extension2->id());
249 250
250 // This extension only sends the 'policy' signal once it receives the policy, 251 // This extension only sends the 'policy' signal once it receives the policy,
251 // and after verifying it has the expected value. Otherwise it sends 'fail'. 252 // and after verifying it has the expected value. Otherwise it sends 'fail'.
252 EXPECT_TRUE(result_listener.WaitUntilSatisfied()); 253 EXPECT_TRUE(result_listener.WaitUntilSatisfied());
253 } 254 }
254 255
255 #endif // OS_CHROMEOS 256 #endif // OS_CHROMEOS
256 257
257 } // namespace policy 258 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698