| 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 <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 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/browser/navigation_controller.h" | 23 #include "content/public/browser/navigation_controller.h" |
| 24 #include "content/public/browser/storage_partition.h" | 24 #include "content/public/browser/storage_partition.h" |
| 25 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
| 26 #include "content/public/common/page_state.h" | 26 #include "content/public/common/page_state.h" |
| 27 #include "content/public/common/web_preferences.h" | 27 #include "content/public/common/web_preferences.h" |
| 28 #include "content/test/test_render_frame_host.h" | 28 #include "content/test/test_render_frame_host.h" |
| 29 #include "content/test/test_web_contents.h" | 29 #include "content/test/test_web_contents.h" |
| 30 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
| 31 #include "ui/aura/env.h" | 31 #include "ui/aura/env.h" |
| 32 #include "ui/compositor/compositor.h" | 32 #include "ui/compositor/compositor.h" |
| 33 #include "ui/compositor/layer_type.h" | |
| 34 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
| 35 | 34 |
| 36 #if defined(USE_AURA) | |
| 37 #include "ui/aura/test/test_window_delegate.h" | |
| 38 #endif | |
| 39 | |
| 40 namespace content { | 35 namespace content { |
| 41 | 36 |
| 42 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, | 37 void InitNavigateParams(FrameHostMsg_DidCommitProvisionalLoad_Params* params, |
| 43 int nav_entry_id, | 38 int nav_entry_id, |
| 44 bool did_create_new_entry, | 39 bool did_create_new_entry, |
| 45 const GURL& url, | 40 const GURL& url, |
| 46 ui::PageTransition transition) { | 41 ui::PageTransition transition) { |
| 47 params->nav_entry_id = nav_entry_id; | 42 params->nav_entry_id = nav_entry_id; |
| 48 params->url = url; | 43 params->url = url; |
| 49 params->origin = url::Origin(url); | 44 params->origin = url::Origin(url); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 71 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 66 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 72 #else | 67 #else |
| 73 // Not all tests initialize or need an image transport factory. | 68 // Not all tests initialize or need an image transport factory. |
| 74 if (ImageTransportFactory::GetInstance()) { | 69 if (ImageTransportFactory::GetInstance()) { |
| 75 frame_sink_id_ = AllocateFrameSinkId(); | 70 frame_sink_id_ = AllocateFrameSinkId(); |
| 76 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); | 71 GetSurfaceManager()->RegisterFrameSinkId(frame_sink_id_); |
| 77 } | 72 } |
| 78 #endif | 73 #endif |
| 79 | 74 |
| 80 rwh_->SetView(this); | 75 rwh_->SetView(this); |
| 81 | |
| 82 #if defined(USE_AURA) | |
| 83 window_.reset(new aura::Window( | |
| 84 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate())); | |
| 85 window_->set_owned_by_parent(false); | |
| 86 window_->Init(ui::LayerType::LAYER_NOT_DRAWN); | |
| 87 #endif | |
| 88 } | 76 } |
| 89 | 77 |
| 90 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 78 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 91 cc::SurfaceManager* manager = GetSurfaceManager(); | 79 cc::SurfaceManager* manager = GetSurfaceManager(); |
| 92 if (manager) { | 80 if (manager) { |
| 93 manager->InvalidateFrameSinkId(frame_sink_id_); | 81 manager->InvalidateFrameSinkId(frame_sink_id_); |
| 94 } | 82 } |
| 95 } | 83 } |
| 96 | 84 |
| 97 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 85 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 98 return rwh_; | 86 return rwh_; |
| 99 } | 87 } |
| 100 | 88 |
| 101 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { | 89 gfx::Vector2dF TestRenderWidgetHostView::GetLastScrollOffset() const { |
| 102 return gfx::Vector2dF(); | 90 return gfx::Vector2dF(); |
| 103 } | 91 } |
| 104 | 92 |
| 105 gfx::NativeView TestRenderWidgetHostView::GetNativeView() const { | 93 gfx::NativeView TestRenderWidgetHostView::GetNativeView() const { |
| 106 #if defined(USE_AURA) | |
| 107 return window_.get(); | |
| 108 #else | |
| 109 return nullptr; | 94 return nullptr; |
| 110 #endif | |
| 111 } | 95 } |
| 112 | 96 |
| 113 gfx::NativeViewAccessible TestRenderWidgetHostView::GetNativeViewAccessible() { | 97 gfx::NativeViewAccessible TestRenderWidgetHostView::GetNativeViewAccessible() { |
| 114 return nullptr; | 98 return nullptr; |
| 115 } | 99 } |
| 116 | 100 |
| 117 ui::TextInputClient* TestRenderWidgetHostView::GetTextInputClient() { | 101 ui::TextInputClient* TestRenderWidgetHostView::GetTextInputClient() { |
| 118 return &text_input_client_; | 102 return &text_input_client_; |
| 119 } | 103 } |
| 120 | 104 |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 319 |
| 336 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 320 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 337 return contents()->GetMainFrame(); | 321 return contents()->GetMainFrame(); |
| 338 } | 322 } |
| 339 | 323 |
| 340 TestWebContents* RenderViewHostImplTestHarness::contents() { | 324 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 341 return static_cast<TestWebContents*>(web_contents()); | 325 return static_cast<TestWebContents*>(web_contents()); |
| 342 } | 326 } |
| 343 | 327 |
| 344 } // namespace content | 328 } // namespace content |
| OLD | NEW |