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

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 216703002: Move the SigninProcess APIs from SigninManager to ChromeSigninClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove cruft Created 6 years, 9 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 | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | no next file » | 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 "base/prefs/pref_service.h" 5 #include "base/prefs/pref_service.h"
6 #include "base/prefs/scoped_user_pref_update.h" 6 #include "base/prefs/scoped_user_pref_update.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/content_settings/cookie_settings.h" 11 #include "chrome/browser/content_settings/cookie_settings.h"
12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" 12 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_info_cache.h" 14 #include "chrome/browser/profiles/profile_info_cache.h"
15 #include "chrome/browser/profiles/profile_io_data.h" 15 #include "chrome/browser/profiles/profile_io_data.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/signin/chrome_signin_client.h"
18 #include "chrome/browser/signin/chrome_signin_client_factory.h"
17 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" 19 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h"
18 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
19 #include "chrome/browser/signin/fake_signin_manager.h" 21 #include "chrome/browser/signin/fake_signin_manager.h"
20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21 #include "chrome/browser/signin/signin_manager.h" 23 #include "chrome/browser/signin/signin_manager.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 24 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/signin/signin_names_io_thread.h" 25 #include "chrome/browser/signin/signin_names_io_thread.h"
24 #include "chrome/browser/signin/signin_promo.h" 26 #include "chrome/browser/signin/signin_promo.h"
25 #include "chrome/browser/sync/profile_sync_service_factory.h" 27 #include "chrome/browser/sync/profile_sync_service_factory.h"
26 #include "chrome/browser/sync/profile_sync_service_mock.h" 28 #include "chrome/browser/sync/profile_sync_service_mock.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void OneClickSigninHelperTest::TearDown() { 254 void OneClickSigninHelperTest::TearDown() {
253 signin::ForceWebBasedSigninFlowForTesting(false); 255 signin::ForceWebBasedSigninFlowForTesting(false);
254 content::RenderViewHostTestHarness::TearDown(); 256 content::RenderViewHostTestHarness::TearDown();
255 } 257 }
256 258
257 void OneClickSigninHelperTest::SetTrustedSigninProcessID(int id) { 259 void OneClickSigninHelperTest::SetTrustedSigninProcessID(int id) {
258 trusted_signin_process_id_ = id; 260 trusted_signin_process_id_ = id;
259 } 261 }
260 262
261 void OneClickSigninHelperTest::SetUpSigninManager(const std::string& username) { 263 void OneClickSigninHelperTest::SetUpSigninManager(const std::string& username) {
264 ChromeSigninClient* signin_client =
265 ChromeSigninClientFactory::GetForProfile(profile());
266 if (signin_client)
267 signin_client->SetSigninProcess(trusted_signin_process_id_);
268
262 signin_manager_ = static_cast<SigninManagerMock*>( 269 signin_manager_ = static_cast<SigninManagerMock*>(
263 SigninManagerFactory::GetForProfile(profile())); 270 SigninManagerFactory::GetForProfile(profile()));
264 if (signin_manager_)
265 signin_manager_->SetSigninProcess(trusted_signin_process_id_);
266
267 if (!username.empty()) { 271 if (!username.empty()) {
268 ASSERT_TRUE(signin_manager_); 272 ASSERT_TRUE(signin_manager_);
269 signin_manager_->SetAuthenticatedUsername(username); 273 signin_manager_->SetAuthenticatedUsername(username);
270 } 274 }
271 } 275 }
272 276
273 void OneClickSigninHelperTest::EnableOneClick(bool enable) { 277 void OneClickSigninHelperTest::EnableOneClick(bool enable) {
274 PrefService* pref_service = profile()->GetPrefs(); 278 PrefService* pref_service = profile()->GetPrefs();
275 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, enable); 279 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, enable);
276 } 280 }
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 args.email = "foo@gmail.com"; 1011 args.email = "foo@gmail.com";
1008 args.profile = profile(); 1012 args.profile = profile();
1009 MockStarterWrapper* wrapper = new MockStarterWrapper( 1013 MockStarterWrapper* wrapper = new MockStarterWrapper(
1010 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 1014 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
1011 SetCookie("LSID=1234; domain=google.com; secure; httponly"); 1015 SetCookie("LSID=1234; domain=google.com; secure; httponly");
1012 1016
1013 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); 1017 EXPECT_CALL(*wrapper, DisplayErrorBubble(_));
1014 wrapper->Start(); 1018 wrapper->Start();
1015 base::RunLoop().RunUntilIdle(); 1019 base::RunLoop().RunUntilIdle();
1016 } 1020 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698