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

Side by Side Diff: chrome/test/base/chrome_render_view_host_test_harness.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, 4 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
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | components/signin.gypi » ('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/test/base/chrome_render_view_host_test_harness.h"
6 #include "chrome/browser/browser_process.h" 5 #include "chrome/browser/browser_process.h"
7 #include "chrome/browser/signin/account_tracker_service_factory.h" 6 #include "chrome/browser/signin/account_tracker_service_factory.h"
8 #include "chrome/browser/signin/chrome_signin_client_factory.h" 7 #include "chrome/browser/signin/chrome_signin_client_factory.h"
9 #include "chrome/browser/signin/fake_signin_manager.h" 8 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/signin/signin_manager_factory.h" 10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
11 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "components/signin/core/browser/fake_signin_manager.h"
12 14
13 #if defined(USE_ASH) 15 #if defined(USE_ASH)
14 #include "ash/shell.h" 16 #include "ash/shell.h"
15 #endif 17 #endif
16 18
17 #if defined(USE_AURA) 19 #if defined(USE_AURA)
18 #include "ui/aura/env.h" 20 #include "ui/aura/env.h"
19 #include "ui/aura/window_event_dispatcher.h" 21 #include "ui/aura/window_event_dispatcher.h"
20 #endif 22 #endif
21 23
22 using content::RenderViewHostTester; 24 using content::RenderViewHostTester;
23 using content::RenderViewHostTestHarness; 25 using content::RenderViewHostTestHarness;
24 26
25 namespace { 27 namespace {
26 28
27 scoped_ptr<KeyedService> BuildSigninManagerFake( 29 scoped_ptr<KeyedService> BuildSigninManagerFake(
28 content::BrowserContext* context) { 30 content::BrowserContext* context) {
29 Profile* profile = static_cast<Profile*>(context); 31 Profile* profile = static_cast<Profile*>(context);
32 SigninClient* signin_client =
33 ChromeSigninClientFactory::GetForProfile(profile);
34 AccountTrackerService* account_tracker_service =
35 AccountTrackerServiceFactory::GetForProfile(profile);
30 #if defined (OS_CHROMEOS) 36 #if defined (OS_CHROMEOS)
31 scoped_ptr<SigninManagerBase> signin(new SigninManagerBase( 37 scoped_ptr<SigninManagerBase> signin(
32 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), 38 new SigninManagerBase(signin_client, account_tracker_service));
33 AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)));
34 signin->Initialize(NULL); 39 signin->Initialize(NULL);
35 return signin.Pass(); 40 return signin.Pass();
36 #else 41 #else
37 scoped_ptr<FakeSigninManager> manager(new FakeSigninManager(profile)); 42 scoped_ptr<FakeSigninManager> manager(new FakeSigninManager(
43 signin_client, ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
44 account_tracker_service,
45 GaiaCookieManagerServiceFactory::GetForProfile(profile)));
38 manager->Initialize(g_browser_process->local_state()); 46 manager->Initialize(g_browser_process->local_state());
39 return manager.Pass(); 47 return manager.Pass();
40 #endif 48 #endif
41 } 49 }
42 50
43 } // namespace 51 } // namespace
44 52
45 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() { 53 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() {
46 } 54 }
47 55
(...skipping 14 matching lines...) Expand all
62 #endif 70 #endif
63 } 71 }
64 72
65 content::BrowserContext* 73 content::BrowserContext*
66 ChromeRenderViewHostTestHarness::CreateBrowserContext() { 74 ChromeRenderViewHostTestHarness::CreateBrowserContext() {
67 TestingProfile::Builder builder; 75 TestingProfile::Builder builder;
68 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 76 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
69 BuildSigninManagerFake); 77 BuildSigninManagerFake);
70 return builder.Build().release(); 78 return builder.Build().release();
71 } 79 }
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | components/signin.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698