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