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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/policy/browser_policy_connector.h" | 9 #include "chrome/browser/policy/browser_policy_connector.h" |
10 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 10 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 interceptor_.reset(); | 91 interceptor_.reset(); |
92 } | 92 } |
93 | 93 |
94 #if defined(OS_CHROMEOS) | 94 #if defined(OS_CHROMEOS) |
95 UserCloudPolicyManagerChromeOS* policy_manager() { | 95 UserCloudPolicyManagerChromeOS* policy_manager() { |
96 return UserCloudPolicyManagerFactoryChromeOS::GetForProfile( | 96 return UserCloudPolicyManagerFactoryChromeOS::GetForProfile( |
97 browser()->profile()); | 97 browser()->profile()); |
98 } | 98 } |
99 #else | 99 #else |
100 UserCloudPolicyManager* policy_manager() { | 100 UserCloudPolicyManager* policy_manager() { |
101 return UserCloudPolicyManagerFactory::GetForProfile(browser()->profile()); | 101 return UserCloudPolicyManagerFactory::GetForBrowserContext( |
| 102 browser()->profile()); |
102 } | 103 } |
103 #endif // defined(OS_CHROMEOS) | 104 #endif // defined(OS_CHROMEOS) |
104 | 105 |
105 // Register the client of the policy_manager() using a bogus auth token, and | 106 // Register the client of the policy_manager() using a bogus auth token, and |
106 // returns once the registration gets a result back. | 107 // returns once the registration gets a result back. |
107 void Register() { | 108 void Register() { |
108 ASSERT_TRUE(policy_manager()); | 109 ASSERT_TRUE(policy_manager()); |
109 ASSERT_TRUE(policy_manager()->core()->client()); | 110 ASSERT_TRUE(policy_manager()->core()->client()); |
110 | 111 |
111 base::RunLoop run_loop; | 112 base::RunLoop run_loop; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 const bool expect_reregister = true; | 191 const bool expect_reregister = true; |
191 interceptor_->PushJobCallback( | 192 interceptor_->PushJobCallback( |
192 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); | 193 TestRequestInterceptor::RegisterJob(expected_type, expect_reregister)); |
193 | 194 |
194 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); | 195 EXPECT_FALSE(policy_manager()->core()->client()->is_registered()); |
195 ASSERT_NO_FATAL_FAILURE(Register()); | 196 ASSERT_NO_FATAL_FAILURE(Register()); |
196 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); | 197 EXPECT_TRUE(policy_manager()->core()->client()->is_registered()); |
197 } | 198 } |
198 | 199 |
199 } // namespace policy | 200 } // namespace policy |
OLD | NEW |