Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/test/base/chrome_render_view_host_test_harness.cc

Issue 1743143002: Remove WebContents::Was{Hidden,Shown}() from the content public interface Base URL: https://chromium.googlesource.com/chromium/src.git@20160225-WebContents-DicardCursorRects
Patch Set: Fix androido Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/signin/account_tracker_service_factory.h" 11 #include "chrome/browser/signin/account_tracker_service_factory.h"
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" 12 #include "chrome/browser/signin/chrome_signin_client_factory.h"
13 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 13 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
15 #include "chrome/browser/signin/signin_manager_factory.h" 15 #include "chrome/browser/signin/signin_manager_factory.h"
16 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
17 #include "components/signin/core/browser/fake_signin_manager.h" 17 #include "components/signin/core/browser/fake_signin_manager.h"
18 #include "content/public/test/web_contents_tester.h"
18 19
19 #if defined(USE_ASH) 20 #if defined(USE_ASH)
20 #include "ash/shell.h" 21 #include "ash/shell.h"
21 #endif 22 #endif
22 23
23 using content::RenderViewHostTester; 24 using content::RenderViewHostTester;
24 using content::RenderViewHostTestHarness; 25 using content::RenderViewHostTestHarness;
26 using content::WebContentsTester;
25 27
26 namespace { 28 namespace {
27 29
28 scoped_ptr<KeyedService> BuildSigninManagerFake( 30 scoped_ptr<KeyedService> BuildSigninManagerFake(
29 content::BrowserContext* context) { 31 content::BrowserContext* context) {
30 Profile* profile = static_cast<Profile*>(context); 32 Profile* profile = static_cast<Profile*>(context);
31 SigninClient* signin_client = 33 SigninClient* signin_client =
32 ChromeSigninClientFactory::GetForProfile(profile); 34 ChromeSigninClientFactory::GetForProfile(profile);
33 AccountTrackerService* account_tracker_service = 35 AccountTrackerService* account_tracker_service =
34 AccountTrackerServiceFactory::GetForProfile(profile); 36 AccountTrackerServiceFactory::GetForProfile(profile);
(...skipping 17 matching lines...) Expand all
52 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() { 54 ChromeRenderViewHostTestHarness::ChromeRenderViewHostTestHarness() {
53 } 55 }
54 56
55 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() { 57 ChromeRenderViewHostTestHarness::~ChromeRenderViewHostTestHarness() {
56 } 58 }
57 59
58 TestingProfile* ChromeRenderViewHostTestHarness::profile() { 60 TestingProfile* ChromeRenderViewHostTestHarness::profile() {
59 return static_cast<TestingProfile*>(browser_context()); 61 return static_cast<TestingProfile*>(browser_context());
60 } 62 }
61 63
64 void ChromeRenderViewHostTestHarness::SimulateShow() {
65 WebContentsTester::For(web_contents())->WasShownForTest();
66 }
67
68 void ChromeRenderViewHostTestHarness::SimulateHide() {
69 WebContentsTester::For(web_contents())->WasHiddenForTest();
70 }
71
62 void ChromeRenderViewHostTestHarness::TearDown() { 72 void ChromeRenderViewHostTestHarness::TearDown() {
63 RenderViewHostTestHarness::TearDown(); 73 RenderViewHostTestHarness::TearDown();
64 #if defined(USE_ASH) 74 #if defined(USE_ASH)
65 ash::Shell::DeleteInstance(); 75 ash::Shell::DeleteInstance();
66 #endif 76 #endif
67 } 77 }
68 78
69 content::BrowserContext* 79 content::BrowserContext*
70 ChromeRenderViewHostTestHarness::CreateBrowserContext() { 80 ChromeRenderViewHostTestHarness::CreateBrowserContext() {
71 TestingProfile::Builder builder; 81 TestingProfile::Builder builder;
72 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 82 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
73 BuildSigninManagerFake); 83 BuildSigninManagerFake);
74 return builder.Build().release(); 84 return builder.Build().release();
75 } 85 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698