| OLD | NEW |
| 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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 10 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 params->did_create_new_entry = did_create_new_entry; | 47 params->did_create_new_entry = did_create_new_entry; |
| 48 params->security_info = std::string(); | 48 params->security_info = std::string(); |
| 49 params->gesture = NavigationGestureUser; | 49 params->gesture = NavigationGestureUser; |
| 50 params->was_within_same_page = false; | 50 params->was_within_same_page = false; |
| 51 params->is_post = false; | 51 params->is_post = false; |
| 52 params->page_state = PageState::CreateFromURL(url); | 52 params->page_state = PageState::CreateFromURL(url); |
| 53 } | 53 } |
| 54 | 54 |
| 55 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 55 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
| 56 : rwh_(RenderWidgetHostImpl::From(rwh)), | 56 : rwh_(RenderWidgetHostImpl::From(rwh)), |
| 57 is_showing_(false), | |
| 58 is_occluded_(false), | 57 is_occluded_(false), |
| 59 did_swap_compositor_frame_(false) { | 58 did_swap_compositor_frame_(false) { |
| 60 rwh_->SetView(this); | 59 rwh_->SetView(this); |
| 61 } | 60 } |
| 62 | 61 |
| 63 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 62 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 64 } | 63 } |
| 65 | 64 |
| 66 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 65 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 67 return rwh_; | 66 return rwh_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 | 88 |
| 90 bool TestRenderWidgetHostView::HasFocus() const { | 89 bool TestRenderWidgetHostView::HasFocus() const { |
| 91 return true; | 90 return true; |
| 92 } | 91 } |
| 93 | 92 |
| 94 bool TestRenderWidgetHostView::IsSurfaceAvailableForCopy() const { | 93 bool TestRenderWidgetHostView::IsSurfaceAvailableForCopy() const { |
| 95 return true; | 94 return true; |
| 96 } | 95 } |
| 97 | 96 |
| 98 void TestRenderWidgetHostView::Show() { | 97 void TestRenderWidgetHostView::Show() { |
| 99 is_showing_ = true; | |
| 100 is_occluded_ = false; | 98 is_occluded_ = false; |
| 99 if (rwh_->is_hidden()) |
| 100 rwh_->WasShown(ui::LatencyInfo()); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void TestRenderWidgetHostView::Hide() { | 103 void TestRenderWidgetHostView::Hide() { |
| 104 is_showing_ = false; | 104 if (!rwh_->is_hidden()) |
| 105 rwh_->WasHidden(); |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool TestRenderWidgetHostView::IsShowing() { | 108 bool TestRenderWidgetHostView::IsShowing() { |
| 108 return is_showing_; | 109 return !rwh_->is_hidden(); |
| 109 } | 110 } |
| 110 | 111 |
| 111 void TestRenderWidgetHostView::WasUnOccluded() { | 112 void TestRenderWidgetHostView::WasUnOccluded() { |
| 112 is_occluded_ = false; | 113 is_occluded_ = false; |
| 113 } | 114 } |
| 114 | 115 |
| 115 void TestRenderWidgetHostView::WasOccluded() { | 116 void TestRenderWidgetHostView::WasOccluded() { |
| 116 is_occluded_ = true; | 117 is_occluded_ = true; |
| 117 } | 118 } |
| 118 | 119 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 328 |
| 328 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 329 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 329 return contents()->GetMainFrame(); | 330 return contents()->GetMainFrame(); |
| 330 } | 331 } |
| 331 | 332 |
| 332 TestWebContents* RenderViewHostImplTestHarness::contents() { | 333 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 333 return static_cast<TestWebContents*>(web_contents()); | 334 return static_cast<TestWebContents*>(web_contents()); |
| 334 } | 335 } |
| 335 | 336 |
| 336 } // namespace content | 337 } // namespace content |
| OLD | NEW |