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/test/base/chrome_render_view_host_test_harness.h" | 5 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
6 | 6 |
| 7 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/signin/fake_signin_manager.h" | 8 #include "chrome/browser/signin/fake_signin_manager.h" |
8 #include "chrome/browser/signin/signin_manager_factory.h" | 9 #include "chrome/browser/signin/signin_manager_factory.h" |
9 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
10 | 11 |
11 #if defined(USE_ASH) | 12 #if defined(USE_ASH) |
12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
13 #endif | 14 #endif |
14 | 15 |
15 #if defined(USE_AURA) | 16 #if defined(USE_AURA) |
16 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
(...skipping 16 matching lines...) Expand all Loading... |
33 | 34 |
34 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() { | 35 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() { |
35 return RenderViewHostTester::For(rvh()); | 36 return RenderViewHostTester::For(rvh()); |
36 } | 37 } |
37 | 38 |
38 static ProfileKeyedService* BuildSigninManagerFake( | 39 static ProfileKeyedService* BuildSigninManagerFake( |
39 content::BrowserContext* context) { | 40 content::BrowserContext* context) { |
40 Profile* profile = static_cast<Profile*>(context); | 41 Profile* profile = static_cast<Profile*>(context); |
41 #if defined (OS_CHROMEOS) | 42 #if defined (OS_CHROMEOS) |
42 SigninManagerBase* signin = new SigninManagerBase(); | 43 SigninManagerBase* signin = new SigninManagerBase(); |
43 signin->Initialize(profile); | 44 signin->Initialize(profile, NULL); |
44 return signin; | 45 return signin; |
45 #else | 46 #else |
46 FakeSigninManager* manager = new FakeSigninManager(profile); | 47 FakeSigninManager* manager = new FakeSigninManager(profile); |
47 manager->Initialize(profile); | 48 manager->Initialize(profile, g_browser_process->local_state()); |
48 return manager; | 49 return manager; |
49 #endif | 50 #endif |
50 } | 51 } |
51 | 52 |
52 void ChromeRenderViewHostTestHarness::SetUp() { | 53 void ChromeRenderViewHostTestHarness::SetUp() { |
53 Profile* profile = Profile::FromBrowserContext(browser_context_.get()); | 54 Profile* profile = Profile::FromBrowserContext(browser_context_.get()); |
54 if (!profile) { | 55 if (!profile) { |
55 profile = new TestingProfile(); | 56 profile = new TestingProfile(); |
56 browser_context_.reset(profile); | 57 browser_context_.reset(profile); |
57 } | 58 } |
58 SigninManagerFactory::GetInstance()->SetTestingFactory( | 59 SigninManagerFactory::GetInstance()->SetTestingFactory( |
59 profile, BuildSigninManagerFake); | 60 profile, BuildSigninManagerFake); |
60 RenderViewHostTestHarness::SetUp(); | 61 RenderViewHostTestHarness::SetUp(); |
61 } | 62 } |
62 | 63 |
63 void ChromeRenderViewHostTestHarness::TearDown() { | 64 void ChromeRenderViewHostTestHarness::TearDown() { |
64 RenderViewHostTestHarness::TearDown(); | 65 RenderViewHostTestHarness::TearDown(); |
65 #if defined(USE_ASH) | 66 #if defined(USE_ASH) |
66 ash::Shell::DeleteInstance(); | 67 ash::Shell::DeleteInstance(); |
67 #endif | 68 #endif |
68 #if defined(USE_AURA) | 69 #if defined(USE_AURA) |
69 aura::Env::DeleteInstance(); | 70 aura::Env::DeleteInstance(); |
70 #endif | 71 #endif |
71 } | 72 } |
OLD | NEW |