| 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 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 TestingProfile* ChromeRenderViewHostTestHarness::profile() { | 30 TestingProfile* ChromeRenderViewHostTestHarness::profile() { |
| 31 return static_cast<TestingProfile*>(browser_context_.get()); | 31 return static_cast<TestingProfile*>(browser_context_.get()); |
| 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(Profile* profile) { | 38 static ProfileKeyedService* BuildSigninManagerFake( |
| 39 content::BrowserContext* context) { |
| 40 Profile* profile = static_cast<Profile*>(context); |
| 39 #if defined (OS_CHROMEOS) | 41 #if defined (OS_CHROMEOS) |
| 40 return new FakeSigninManagerBase(profile); | 42 return new FakeSigninManagerBase(profile); |
| 41 #else | 43 #else |
| 42 return new FakeSigninManager(profile); | 44 return new FakeSigninManager(profile); |
| 43 #endif | 45 #endif |
| 44 } | 46 } |
| 45 | 47 |
| 46 void ChromeRenderViewHostTestHarness::SetUp() { | 48 void ChromeRenderViewHostTestHarness::SetUp() { |
| 47 Profile* profile = Profile::FromBrowserContext(browser_context_.get()); | 49 Profile* profile = Profile::FromBrowserContext(browser_context_.get()); |
| 48 if (!profile) { | 50 if (!profile) { |
| 49 profile = new TestingProfile(); | 51 profile = new TestingProfile(); |
| 50 browser_context_.reset(profile); | 52 browser_context_.reset(profile); |
| 51 } | 53 } |
| 52 SigninManagerFactory::GetInstance()->SetTestingFactory( | 54 SigninManagerFactory::GetInstance()->SetTestingFactory( |
| 53 profile, BuildSigninManagerFake); | 55 profile, BuildSigninManagerFake); |
| 54 RenderViewHostTestHarness::SetUp(); | 56 RenderViewHostTestHarness::SetUp(); |
| 55 } | 57 } |
| 56 | 58 |
| 57 void ChromeRenderViewHostTestHarness::TearDown() { | 59 void ChromeRenderViewHostTestHarness::TearDown() { |
| 58 RenderViewHostTestHarness::TearDown(); | 60 RenderViewHostTestHarness::TearDown(); |
| 59 #if defined(USE_ASH) | 61 #if defined(USE_ASH) |
| 60 ash::Shell::DeleteInstance(); | 62 ash::Shell::DeleteInstance(); |
| 61 #endif | 63 #endif |
| 62 #if defined(USE_AURA) | 64 #if defined(USE_AURA) |
| 63 aura::Env::DeleteInstance(); | 65 aura::Env::DeleteInstance(); |
| 64 #endif | 66 #endif |
| 65 } | 67 } |
| OLD | NEW |