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

Side by Side Diff: content/test/test_render_view_host.cc

Issue 1713473002: Make TestRenderWidgetHostView::Show/Hide call through to RWHI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crash
Patch Set: Tentatively undo render_widget_host_view_base.cc modification Created 3 years, 10 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
« no previous file with comments | « content/test/test_render_view_host.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/test/test_render_view_host.h" 5 #include "content/test/test_render_view_host.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 params->searchable_form_encoding = std::string(); 53 params->searchable_form_encoding = std::string();
54 params->did_create_new_entry = did_create_new_entry; 54 params->did_create_new_entry = did_create_new_entry;
55 params->gesture = NavigationGestureUser; 55 params->gesture = NavigationGestureUser;
56 params->was_within_same_page = false; 56 params->was_within_same_page = false;
57 params->method = "GET"; 57 params->method = "GET";
58 params->page_state = PageState::CreateFromURL(url); 58 params->page_state = PageState::CreateFromURL(url);
59 } 59 }
60 60
61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) 61 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh)
62 : rwh_(RenderWidgetHostImpl::From(rwh)), 62 : rwh_(RenderWidgetHostImpl::From(rwh)),
63 is_showing_(false),
64 is_occluded_(false), 63 is_occluded_(false),
65 did_swap_compositor_frame_(false) { 64 did_swap_compositor_frame_(false) {
66 #if defined(OS_ANDROID) 65 #if defined(OS_ANDROID)
67 // Not all tests initialize or need a context provider factory. 66 // Not all tests initialize or need a context provider factory.
68 if (ContextProviderFactoryImpl::GetInstance()) { 67 if (ContextProviderFactoryImpl::GetInstance()) {
69 frame_sink_id_ = AllocateFrameSinkId(); 68 frame_sink_id_ = AllocateFrameSinkId();
70 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); 69 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_);
71 } 70 }
72 #else 71 #else
73 // Not all tests initialize or need an image transport factory. 72 // Not all tests initialize or need an image transport factory.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 114
116 bool TestRenderWidgetHostView::HasFocus() const { 115 bool TestRenderWidgetHostView::HasFocus() const {
117 return true; 116 return true;
118 } 117 }
119 118
120 bool TestRenderWidgetHostView::IsSurfaceAvailableForCopy() const { 119 bool TestRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
121 return true; 120 return true;
122 } 121 }
123 122
124 void TestRenderWidgetHostView::Show() { 123 void TestRenderWidgetHostView::Show() {
125 is_showing_ = true;
126 is_occluded_ = false; 124 is_occluded_ = false;
125 if (rwh_->is_hidden())
126 rwh_->WasShown(ui::LatencyInfo());
127 } 127 }
128 128
129 void TestRenderWidgetHostView::Hide() { 129 void TestRenderWidgetHostView::Hide() {
130 is_showing_ = false; 130 if (!rwh_->is_hidden())
131 rwh_->WasHidden();
131 } 132 }
132 133
133 bool TestRenderWidgetHostView::IsShowing() { 134 bool TestRenderWidgetHostView::IsShowing() {
134 return is_showing_; 135 return !rwh_->is_hidden();
135 } 136 }
136 137
137 void TestRenderWidgetHostView::WasUnOccluded() { 138 void TestRenderWidgetHostView::WasUnOccluded() {
138 is_occluded_ = false; 139 is_occluded_ = false;
139 } 140 }
140 141
141 void TestRenderWidgetHostView::WasOccluded() { 142 void TestRenderWidgetHostView::WasOccluded() {
142 is_occluded_ = true; 143 is_occluded_ = true;
143 } 144 }
144 145
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 if (main_frame) 265 if (main_frame)
265 static_cast<RenderFrameHostImpl*>(main_frame)->SetRenderFrameCreated(true); 266 static_cast<RenderFrameHostImpl*>(main_frame)->SetRenderFrameCreated(true);
266 267
267 return true; 268 return true;
268 } 269 }
269 270
270 MockRenderProcessHost* TestRenderViewHost::GetProcess() const { 271 MockRenderProcessHost* TestRenderViewHost::GetProcess() const {
271 return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess()); 272 return static_cast<MockRenderProcessHost*>(RenderViewHostImpl::GetProcess());
272 } 273 }
273 274
274 void TestRenderViewHost::SimulateWasHidden() {
275 GetWidget()->WasHidden();
276 }
277
278 void TestRenderViewHost::SimulateWasShown() {
279 GetWidget()->WasShown(ui::LatencyInfo());
280 }
281
282 WebPreferences TestRenderViewHost::TestComputeWebkitPrefs() { 275 WebPreferences TestRenderViewHost::TestComputeWebkitPrefs() {
283 return ComputeWebkitPrefs(); 276 return ComputeWebkitPrefs();
284 } 277 }
285 278
286 void TestRenderViewHost::OnWebkitPreferencesChanged() { 279 void TestRenderViewHost::OnWebkitPreferencesChanged() {
287 RenderViewHostImpl::OnWebkitPreferencesChanged(); 280 RenderViewHostImpl::OnWebkitPreferencesChanged();
288 if (webkit_preferences_changed_counter_) 281 if (webkit_preferences_changed_counter_)
289 ++*webkit_preferences_changed_counter_; 282 ++*webkit_preferences_changed_counter_;
290 } 283 }
291 284
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 323
331 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { 324 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() {
332 return contents()->GetMainFrame(); 325 return contents()->GetMainFrame();
333 } 326 }
334 327
335 TestWebContents* RenderViewHostImplTestHarness::contents() { 328 TestWebContents* RenderViewHostImplTestHarness::contents() {
336 return static_cast<TestWebContents*>(web_contents()); 329 return static_cast<TestWebContents*>(web_contents());
337 } 330 }
338 331
339 } // namespace content 332 } // namespace content
OLDNEW
« no previous file with comments | « content/test/test_render_view_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698