| 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 "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } else { | 242 } else { |
| 243 // Since the refresh token is available, OAuth2TokenService was used | 243 // Since the refresh token is available, OAuth2TokenService was used |
| 244 // to request the access token and not UserCloudPolicyTokenForwarder. | 244 // to request the access token and not UserCloudPolicyTokenForwarder. |
| 245 // Issue the access token with the former. | 245 // Issue the access token with the former. |
| 246 FakeProfileOAuth2TokenService* token_service = | 246 FakeProfileOAuth2TokenService* token_service = |
| 247 static_cast<FakeProfileOAuth2TokenService*>( | 247 static_cast<FakeProfileOAuth2TokenService*>( |
| 248 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); | 248 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); |
| 249 EXPECT_TRUE(token_service); | 249 EXPECT_TRUE(token_service); |
| 250 OAuth2TokenService::ScopeSet scopes; | 250 OAuth2TokenService::ScopeSet scopes; |
| 251 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); | 251 scopes.insert(GaiaConstants::kDeviceManagementServiceOAuth); |
| 252 scopes.insert( |
| 253 GaiaUrls::GetInstance()->oauth_wrap_bridge_user_info_scope()); |
| 252 token_service->IssueTokenForScope( | 254 token_service->IssueTokenForScope( |
| 253 scopes, "5678", | 255 scopes, "5678", |
| 254 base::Time::Now() + base::TimeDelta::FromSeconds(3600)); | 256 base::Time::Now() + base::TimeDelta::FromSeconds(3600)); |
| 255 } | 257 } |
| 256 | 258 |
| 257 EXPECT_TRUE(register_request); | 259 EXPECT_TRUE(register_request); |
| 258 EXPECT_FALSE(manager_->core()->client()->is_registered()); | 260 EXPECT_FALSE(manager_->core()->client()->is_registered()); |
| 259 | 261 |
| 260 Mock::VerifyAndClearExpectations(&device_management_service_); | 262 Mock::VerifyAndClearExpectations(&device_management_service_); |
| 261 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) | 263 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 568 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 567 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 569 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 568 | 570 |
| 569 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 571 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
| 570 // Running the task runner issues the initial fetch. | 572 // Running the task runner issues the initial fetch. |
| 571 FetchPolicy( | 573 FetchPolicy( |
| 572 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 574 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 573 } | 575 } |
| 574 | 576 |
| 575 } // namespace policy | 577 } // namespace policy |
| OLD | NEW |