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

Side by Side Diff: chrome/browser/signin/cross_device_promo_unittest.cc

Issue 1257623002: Componentize FakeSigninManager and SigninManager prefs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 5 years, 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/signin/cross_device_promo.h" 5 #include "chrome/browser/signin/cross_device_promo.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
11 #include "chrome/browser/prefs/pref_service_syncable.h" 11 #include "chrome/browser/prefs/pref_service_syncable.h"
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" 12 #include "chrome/browser/signin/chrome_signin_client_factory.h"
13 #include "chrome/browser/signin/cross_device_promo_factory.h" 13 #include "chrome/browser/signin/cross_device_promo_factory.h"
14 #include "chrome/browser/signin/fake_gaia_cookie_manager_service.h" 14 #include "chrome/browser/signin/fake_gaia_cookie_manager_service.h"
15 #include "chrome/browser/signin/fake_signin_manager.h" 15 #include "chrome/browser/signin/fake_signin_manager_builder.h"
16 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 16 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
17 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
18 #include "chrome/browser/signin/test_signin_client_builder.h" 18 #include "chrome/browser/signin/test_signin_client_builder.h"
19 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
20 #include "chrome/test/base/testing_browser_process.h" 20 #include "chrome/test/base/testing_browser_process.h"
21 #include "chrome/test/base/testing_pref_service_syncable.h" 21 #include "chrome/test/base/testing_pref_service_syncable.h"
22 #include "chrome/test/base/testing_profile.h" 22 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h" 23 #include "chrome/test/base/testing_profile_manager.h"
24 #include "components/signin/core/browser/signin_manager.h" 24 #include "components/signin/core/browser/signin_manager.h"
25 #include "components/signin/core/browser/signin_metrics.h" 25 #include "components/signin/core/browser/signin_metrics.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); 122 new TestingProfileManager(TestingBrowserProcess::GetGlobal()));
123 ASSERT_TRUE(testing_profile_manager_.get()->SetUp()); 123 ASSERT_TRUE(testing_profile_manager_.get()->SetUp());
124 124
125 TestingProfile::TestingFactories factories; 125 TestingProfile::TestingFactories factories;
126 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(), 126 factories.push_back(std::make_pair(ChromeSigninClientFactory::GetInstance(),
127 signin::BuildTestSigninClient)); 127 signin::BuildTestSigninClient));
128 factories.push_back( 128 factories.push_back(
129 std::make_pair(GaiaCookieManagerServiceFactory::GetInstance(), 129 std::make_pair(GaiaCookieManagerServiceFactory::GetInstance(),
130 FakeGaiaCookieManagerService::Build)); 130 FakeGaiaCookieManagerService::Build));
131 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(), 131 factories.push_back(std::make_pair(SigninManagerFactory::GetInstance(),
132 FakeSigninManagerBase::Build)); 132 BuildFakeSigninManagerBase));
133 133
134 pref_service_ = new TestingPrefServiceSyncable(); 134 pref_service_ = new TestingPrefServiceSyncable();
135 chrome::RegisterUserProfilePrefs(pref_service_->registry()); 135 chrome::RegisterUserProfilePrefs(pref_service_->registry());
136 136
137 profile_ = testing_profile_manager_.get()->CreateTestingProfile( 137 profile_ = testing_profile_manager_.get()->CreateTestingProfile(
138 "name", make_scoped_ptr<PrefServiceSyncable>(pref_service_), 138 "name", make_scoped_ptr<PrefServiceSyncable>(pref_service_),
139 base::UTF8ToUTF16("name"), 0, std::string(), factories); 139 base::UTF8ToUTF16("name"), 0, std::string(), factories);
140 140
141 cookie_manager_service_ = static_cast<FakeGaiaCookieManagerService*>( 141 cookie_manager_service_ = static_cast<FakeGaiaCookieManagerService*>(
142 GaiaCookieManagerServiceFactory::GetForProfile(profile())); 142 GaiaCookieManagerServiceFactory::GetForProfile(profile()));
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 EXPECT_EQ(2, prefs()->GetInteger(prefs::kCrossDevicePromoNumDevices)); 647 EXPECT_EQ(2, prefs()->GetInteger(prefs::kCrossDevicePromoNumDevices));
648 EXPECT_EQ(device2_last_active.ToInternalValue(), 648 EXPECT_EQ(device2_last_active.ToInternalValue(),
649 prefs()->GetInt64(prefs::kCrossDevicePromoLastDeviceActiveTime)); 649 prefs()->GetInt64(prefs::kCrossDevicePromoLastDeviceActiveTime));
650 EXPECT_TRUE(prefs()->GetBoolean(prefs::kCrossDevicePromoShouldBeShown)); 650 EXPECT_TRUE(prefs()->GetBoolean(prefs::kCrossDevicePromoShouldBeShown));
651 test_two_devices.ExpectUniqueSample("Signin.XDevicePromo.Eligibility", 651 test_two_devices.ExpectUniqueSample("Signin.XDevicePromo.Eligibility",
652 signin_metrics::ELIGIBLE, 1); 652 signin_metrics::ELIGIBLE, 1);
653 EXPECT_TRUE(observer.is_eligible()); 653 EXPECT_TRUE(observer.is_eligible());
654 EXPECT_EQ(1, observer.times_set_eligible()); 654 EXPECT_EQ(1, observer.times_set_eligible());
655 } 655 }
656 } 656 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/account_reconcilor_unittest.cc ('k') | chrome/browser/signin/fake_signin_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698