blob: e340ee7dff094fcbe620844780a355b62f73d9a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/signin/signin_manager_fake.h"
#include "chrome/test/base/testing_profile.h"
#if defined(USE_ASH)
#include "ash/shell.h"
#endif
#if defined(USE_AURA)
#include "ui/aura/env.h"
#include "ui/aura/root_window.h"
#endif
using content::RenderViewHostTester;
using content::RenderViewHostTestHarness;
ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness()
: RenderViewHostTestHarness() {
}
ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() {
}
TestingProfile* ChromeRenderViewHostTestHarness::profile() {
return static_cast<TestingProfile*>(browser_context_.get());
}
RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() {
return RenderViewHostTester::For(rvh());
}
static ProfileKeyedService* BuildSigninManagerFake(Profile* profile) {
return new FakeSigninManager(profile);
}
void ChromeRenderViewHostTestHarness::SetUp() {
Profile* profile = Profile::FromBrowserContext(browser_context_.get());
if (!profile) {
profile = new TestingProfile();
browser_context_.reset(profile);
}
SigninManagerFactory::GetInstance()->SetTestingFactory(
profile, BuildSigninManagerFake);
RenderViewHostTestHarness::SetUp();
}
void ChromeRenderViewHostTestHarness::TearDown() {
RenderViewHostTestHarness::TearDown();
#if defined(USE_ASH)
ash::Shell::DeleteInstance();
#endif
#if defined(USE_AURA)
aura::Env::DeleteInstance();
#endif
}
|