Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / chrome / test / base / chrome_render_view_host_test_harness.cc
blob1dfe006ff5e06a26b274d7c9e2b7ae9e89918394
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
3 // found in the LICENSE file.
5 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/signin/fake_signin_manager.h"
9 #include "chrome/browser/signin/signin_manager_factory.h"
10 #include "chrome/test/base/testing_profile.h"
12 #if defined(USE_ASH)
13 #include "ash/shell.h"
14 #endif
16 #if defined(USE_AURA)
17 #include "ui/aura/env.h"
18 #include "ui/aura/root_window.h"
19 #endif
21 using content::RenderViewHostTester;
22 using content::RenderViewHostTestHarness;
24 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() {
27 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() {
30 TestingProfile* ChromeRenderViewHostTestHarness::profile() {
31 return static_cast<TestingProfile*>(browser_context());
34 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() {
35 return RenderViewHostTester::For(rvh());
38 static BrowserContextKeyedService* BuildSigninManagerFake(
39 content::BrowserContext* context) {
40 Profile* profile = static_cast<Profile*>(context);
41 #if defined (OS_CHROMEOS)
42 SigninManagerBase* signin = new SigninManagerBase();
43 signin->Initialize(profile, NULL);
44 return signin;
45 #else
46 FakeSigninManager* manager = new FakeSigninManager(profile);
47 manager->Initialize(profile, g_browser_process->local_state());
48 return manager;
49 #endif
52 void ChromeRenderViewHostTestHarness::SetUp() {
53 RenderViewHostTestHarness::SetUp();
54 SigninManagerFactory::GetInstance()->SetTestingFactory(
55 profile(), BuildSigninManagerFake);
58 void ChromeRenderViewHostTestHarness::TearDown() {
59 RenderViewHostTestHarness::TearDown();
60 #if defined(USE_ASH)
61 ash::Shell::DeleteInstance();
62 #endif
63 #if defined(USE_AURA)
64 aura::Env::DeleteInstance();
65 #endif
68 content::BrowserContext*
69 ChromeRenderViewHostTestHarness::CreateBrowserContext() {
70 return new TestingProfile();