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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos_unittest.cc

Issue 148513010: Eliminate ProfileOAuth2TokenService being a BCKS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 6 years, 10 months 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/account_tracker_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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"
11 #include "base/prefs/pref_registry_simple.h" 11 #include "base/prefs/pref_registry_simple.h"
12 #include "base/prefs/testing_pref_service.h" 12 #include "base/prefs/testing_pref_service.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/sequenced_task_runner.h" 14 #include "base/sequenced_task_runner.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/test/test_simple_task_runner.h" 17 #include "base/test/test_simple_task_runner.h"
18 #include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h" 18 #include "chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 19 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/prefs/browser_prefs.h" 20 #include "chrome/browser/prefs/browser_prefs.h"
21 #include "chrome/browser/prefs/pref_service_syncable.h" 21 #include "chrome/browser/prefs/pref_service_syncable.h"
22 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 22 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
23 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h"
23 #include "chrome/browser/signin/profile_oauth2_token_service.h" 24 #include "chrome/browser/signin/profile_oauth2_token_service.h"
24 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 25 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
25 #include "chrome/common/chrome_constants.h" 26 #include "chrome/common/chrome_constants.h"
26 #include "chrome/test/base/testing_browser_process.h" 27 #include "chrome/test/base/testing_browser_process.h"
27 #include "chrome/test/base/testing_profile.h" 28 #include "chrome/test/base/testing_profile.h"
28 #include "chrome/test/base/testing_profile_manager.h" 29 #include "chrome/test/base/testing_profile_manager.h"
29 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 30 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
30 #include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h " 31 #include "components/policy/core/common/cloud/mock_cloud_external_data_manager.h "
31 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" 32 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
32 #include "components/policy/core/common/cloud/mock_device_management_service.h" 33 #include "components/policy/core/common/cloud/mock_device_management_service.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 86
86 virtual void SetUp() OVERRIDE { 87 virtual void SetUp() OVERRIDE {
87 // The initialization path that blocks on the initial policy fetch requires 88 // The initialization path that blocks on the initial policy fetch requires
88 // a signin Profile to use its URLRequestContext. 89 // a signin Profile to use its URLRequestContext.
89 profile_manager_.reset( 90 profile_manager_.reset(
90 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 91 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
91 ASSERT_TRUE(profile_manager_->SetUp()); 92 ASSERT_TRUE(profile_manager_->SetUp());
92 TestingProfile::TestingFactories factories; 93 TestingProfile::TestingFactories factories;
93 factories.push_back( 94 factories.push_back(
94 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), 95 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(),
95 FakeProfileOAuth2TokenService::Build)); 96 FakeProfileOAuth2TokenServiceWrapper::Build));
96 profile_ = profile_manager_->CreateTestingProfile( 97 profile_ = profile_manager_->CreateTestingProfile(
97 chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(), 98 chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(),
98 base::UTF8ToUTF16("testing_profile"), 0, std::string(), factories); 99 base::UTF8ToUTF16("testing_profile"), 0, std::string(), factories);
99 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile); 100 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile);
100 signin_profile_->ForceIncognito(true); 101 signin_profile_->ForceIncognito(true);
101 // Usually the signin Profile and the main Profile are separate, but since 102 // Usually the signin Profile and the main Profile are separate, but since
102 // the signin Profile is an OTR Profile then for this test it suffices to 103 // the signin Profile is an OTR Profile then for this test it suffices to
103 // attach it to the main Profile. 104 // attach it to the main Profile.
104 profile_->SetOffTheRecordProfile(scoped_ptr<Profile>(signin_profile_)); 105 profile_->SetOffTheRecordProfile(scoped_ptr<Profile>(signin_profile_));
105 signin_profile_->SetOriginalProfile(profile_); 106 signin_profile_->SetOriginalProfile(profile_);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 569 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
569 EXPECT_TRUE(manager_->core()->client()->is_registered()); 570 EXPECT_TRUE(manager_->core()->client()->is_registered());
570 571
571 // The refresh scheduler takes care of the initial fetch for unmanaged users. 572 // The refresh scheduler takes care of the initial fetch for unmanaged users.
572 // Running the task runner issues the initial fetch. 573 // Running the task runner issues the initial fetch.
573 FetchPolicy( 574 FetchPolicy(
574 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); 575 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_));
575 } 576 }
576 577
577 } // namespace policy 578 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/identity/account_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698