Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / test / base / chrome_render_view_host_test_harness.cc
blobaffc0f0e4add94805d3e95be304a5891bc21124a
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/chrome_signin_client_factory.h"
9 #include "chrome/browser/signin/fake_signin_manager.h"
10 #include "chrome/browser/signin/signin_manager_factory.h"
11 #include "chrome/test/base/testing_profile.h"
13 #if defined(USE_ASH)
14 #include "ash/shell.h"
15 #endif
17 #if defined(USE_AURA)
18 #include "ui/aura/env.h"
19 #include "ui/aura/window_event_dispatcher.h"
20 #endif
22 using content::RenderViewHostTester;
23 using content::RenderViewHostTestHarness;
25 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() {
28 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() {
31 TestingProfile* ChromeRenderViewHostTestHarness::profile() {
32 return static_cast<TestingProfile*>(browser_context());
35 RenderViewHostTester* ChromeRenderViewHostTestHarness::rvh_tester() {
36 return RenderViewHostTester::For(rvh());
39 static KeyedService* BuildSigninManagerFake(content::BrowserContext* context) {
40 Profile* profile = static_cast<Profile*>(context);
41 #if defined (OS_CHROMEOS)
42 SigninManagerBase* signin = new SigninManagerBase(
43 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile));
44 signin->Initialize(NULL);
45 return signin;
46 #else
47 FakeSigninManager* manager = new FakeSigninManager(profile);
48 manager->Initialize(g_browser_process->local_state());
49 return manager;
50 #endif
53 void ChromeRenderViewHostTestHarness::TearDown() {
54 RenderViewHostTestHarness::TearDown();
55 #if defined(USE_ASH)
56 ash::Shell::DeleteInstance();
57 #endif
58 #if defined(USE_AURA)
59 aura::Env::DeleteInstance();
60 #endif
63 content::BrowserContext*
64 ChromeRenderViewHostTestHarness::CreateBrowserContext() {
65 TestingProfile::Builder builder;
66 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
67 BuildSigninManagerFake);
68 return builder.Build().release();