| 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/signin_manager_factory.h" | 
 |   8 #include "chrome/browser/signin/signin_manager_fake.h" | 
|   7 #include "chrome/test/base/testing_profile.h" |   9 #include "chrome/test/base/testing_profile.h" | 
|   8  |  10  | 
|   9 #if defined(USE_ASH) |  11 #if defined(USE_ASH) | 
|  10 #include "ash/shell.h" |  12 #include "ash/shell.h" | 
|  11 #endif |  13 #endif | 
|  12  |  14  | 
|  13 #if defined(USE_AURA) |  15 #if defined(USE_AURA) | 
|  14 #include "ui/aura/env.h" |  16 #include "ui/aura/env.h" | 
|  15 #include "ui/aura/root_window.h" |  17 #include "ui/aura/root_window.h" | 
|  16 #endif |  18 #endif | 
|  17  |  19  | 
|  18 using content::RenderViewHostTester; |  20 using content::RenderViewHostTester; | 
|  19 using content::RenderViewHostTestHarness; |  21 using content::RenderViewHostTestHarness; | 
|  20  |  22  | 
|  21 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() |  23 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() | 
|  22     : RenderViewHostTestHarness() { |  24     : RenderViewHostTestHarness() { | 
|  23 } |  25 } | 
|  24  |  26  | 
|  25 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() { |  27 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() { | 
|  26 } |  28 } | 
|  27  |  29  | 
|  28 TestingProfile* ChromeRenderViewHostTestHarness::profile() { |  30 TestingProfile* ChromeRenderViewHostTestHarness::profile() { | 
|  29   return static_cast<TestingProfile*>(browser_context_.get()); |  31   return static_cast<TestingProfile*>(browser_context_.get()); | 
|  30 } |  32 } | 
|  31  |  33  | 
|  32 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() { |  34 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() { | 
|  33   return RenderViewHostTester::For(rvh()); |  35   return RenderViewHostTester::For(rvh()); | 
|  34 } |  36 } | 
|  35  |  37  | 
 |  38 static ProfileKeyedService* BuildSigninManagerFake(Profile* profile) { | 
 |  39   return new FakeSigninManager(profile); | 
 |  40 } | 
 |  41  | 
|  36 void ChromeRenderViewHostTestHarness::SetUp() { |  42 void ChromeRenderViewHostTestHarness::SetUp() { | 
|  37   if (!browser_context_.get()) |  43   Profile* profile = Profile::FromBrowserContext(browser_context_.get()); | 
|  38     browser_context_.reset(new TestingProfile()); |  44   if (!profile) { | 
 |  45     profile = new TestingProfile(); | 
 |  46     browser_context_.reset(profile); | 
 |  47   } | 
 |  48   SigninManagerFactory::GetInstance()->SetTestingFactory( | 
 |  49           profile, BuildSigninManagerFake); | 
|  39   RenderViewHostTestHarness::SetUp(); |  50   RenderViewHostTestHarness::SetUp(); | 
|  40 } |  51 } | 
|  41  |  52  | 
|  42 void ChromeRenderViewHostTestHarness::TearDown() { |  53 void ChromeRenderViewHostTestHarness::TearDown() { | 
|  43   RenderViewHostTestHarness::TearDown(); |  54   RenderViewHostTestHarness::TearDown(); | 
|  44 #if defined(USE_ASH) |  55 #if defined(USE_ASH) | 
|  45   ash::Shell::DeleteInstance(); |  56   ash::Shell::DeleteInstance(); | 
|  46 #endif |  57 #endif | 
|  47 #if defined(USE_AURA) |  58 #if defined(USE_AURA) | 
|  48   aura::Env::DeleteInstance(); |  59   aura::Env::DeleteInstance(); | 
|  49 #endif |  60 #endif | 
|  50 } |  61 } | 
| OLD | NEW |