| 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 "content/browser/dom_storage/dom_storage_context_wrapper.h" | 10 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
| 10 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 11 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 11 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 12 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 12 #include "content/browser/site_instance_impl.h" | 13 #include "content/browser/site_instance_impl.h" |
| 13 #include "content/common/dom_storage/dom_storage_types.h" | 14 #include "content/common/dom_storage/dom_storage_types.h" |
| 14 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
| 15 #include "content/common/site_isolation_policy.h" | 16 #include "content/common/site_isolation_policy.h" |
| 16 #include "content/common/view_messages.h" | 17 #include "content/common/view_messages.h" |
| 17 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 std::vector<char>* color_profile) { | 182 std::vector<char>* color_profile) { |
| 182 DCHECK(color_profile->empty()); | 183 DCHECK(color_profile->empty()); |
| 183 return false; | 184 return false; |
| 184 } | 185 } |
| 185 | 186 |
| 186 gfx::Rect TestRenderWidgetHostView::GetBoundsInRootWindow() { | 187 gfx::Rect TestRenderWidgetHostView::GetBoundsInRootWindow() { |
| 187 return gfx::Rect(); | 188 return gfx::Rect(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void TestRenderWidgetHostView::OnSwapCompositorFrame( | 191 void TestRenderWidgetHostView::OnSwapCompositorFrame( |
| 191 uint32 output_surface_id, | 192 uint32_t output_surface_id, |
| 192 scoped_ptr<cc::CompositorFrame> frame) { | 193 scoped_ptr<cc::CompositorFrame> frame) { |
| 193 did_swap_compositor_frame_ = true; | 194 did_swap_compositor_frame_ = true; |
| 194 } | 195 } |
| 195 | 196 |
| 196 bool TestRenderWidgetHostView::LockMouse() { | 197 bool TestRenderWidgetHostView::LockMouse() { |
| 197 return false; | 198 return false; |
| 198 } | 199 } |
| 199 | 200 |
| 200 void TestRenderWidgetHostView::UnlockMouse() { | 201 void TestRenderWidgetHostView::UnlockMouse() { |
| 201 } | 202 } |
| 202 | 203 |
| 203 #if defined(OS_WIN) | 204 #if defined(OS_WIN) |
| 204 void TestRenderWidgetHostView::SetParentNativeViewAccessible( | 205 void TestRenderWidgetHostView::SetParentNativeViewAccessible( |
| 205 gfx::NativeViewAccessible accessible_parent) { | 206 gfx::NativeViewAccessible accessible_parent) { |
| 206 } | 207 } |
| 207 | 208 |
| 208 gfx::NativeViewId TestRenderWidgetHostView::GetParentForWindowlessPlugin() | 209 gfx::NativeViewId TestRenderWidgetHostView::GetParentForWindowlessPlugin() |
| 209 const { | 210 const { |
| 210 return 0; | 211 return 0; |
| 211 } | 212 } |
| 212 #endif | 213 #endif |
| 213 | 214 |
| 214 TestRenderViewHost::TestRenderViewHost( | 215 TestRenderViewHost::TestRenderViewHost( |
| 215 SiteInstance* instance, | 216 SiteInstance* instance, |
| 216 RenderViewHostDelegate* delegate, | 217 RenderViewHostDelegate* delegate, |
| 217 RenderWidgetHostDelegate* widget_delegate, | 218 RenderWidgetHostDelegate* widget_delegate, |
| 218 int32 routing_id, | 219 int32_t routing_id, |
| 219 int32 main_frame_routing_id, | 220 int32_t main_frame_routing_id, |
| 220 bool swapped_out) | 221 bool swapped_out) |
| 221 : RenderViewHostImpl(instance, | 222 : RenderViewHostImpl(instance, |
| 222 delegate, | 223 delegate, |
| 223 widget_delegate, | 224 widget_delegate, |
| 224 routing_id, | 225 routing_id, |
| 225 main_frame_routing_id, | 226 main_frame_routing_id, |
| 226 swapped_out, | 227 swapped_out, |
| 227 false /* hidden */, | 228 false /* hidden */, |
| 228 false /* has_initialized_audio_host */), | 229 false /* has_initialized_audio_host */), |
| 229 delete_counter_(NULL), | 230 delete_counter_(NULL), |
| 230 opener_frame_route_id_(MSG_ROUTING_NONE) { | 231 opener_frame_route_id_(MSG_ROUTING_NONE) { |
| 231 // TestRenderWidgetHostView installs itself into this->view_ in its | 232 // TestRenderWidgetHostView installs itself into this->view_ in its |
| 232 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is | 233 // constructor, and deletes itself when TestRenderWidgetHostView::Destroy() is |
| 233 // called. | 234 // called. |
| 234 new TestRenderWidgetHostView(this); | 235 new TestRenderWidgetHostView(this); |
| 235 } | 236 } |
| 236 | 237 |
| 237 TestRenderViewHost::~TestRenderViewHost() { | 238 TestRenderViewHost::~TestRenderViewHost() { |
| 238 if (delete_counter_) | 239 if (delete_counter_) |
| 239 ++*delete_counter_; | 240 ++*delete_counter_; |
| 240 } | 241 } |
| 241 | 242 |
| 242 bool TestRenderViewHost::CreateTestRenderView( | 243 bool TestRenderViewHost::CreateTestRenderView( |
| 243 const base::string16& frame_name, | 244 const base::string16& frame_name, |
| 244 int opener_frame_route_id, | 245 int opener_frame_route_id, |
| 245 int proxy_route_id, | 246 int proxy_route_id, |
| 246 int32 max_page_id, | 247 int32_t max_page_id, |
| 247 bool window_was_created_with_opener) { | 248 bool window_was_created_with_opener) { |
| 248 FrameReplicationState replicated_state; | 249 FrameReplicationState replicated_state; |
| 249 replicated_state.name = base::UTF16ToUTF8(frame_name); | 250 replicated_state.name = base::UTF16ToUTF8(frame_name); |
| 250 return CreateRenderView(opener_frame_route_id, proxy_route_id, max_page_id, | 251 return CreateRenderView(opener_frame_route_id, proxy_route_id, max_page_id, |
| 251 replicated_state, window_was_created_with_opener); | 252 replicated_state, window_was_created_with_opener); |
| 252 } | 253 } |
| 253 | 254 |
| 254 bool TestRenderViewHost::CreateRenderView( | 255 bool TestRenderViewHost::CreateRenderView( |
| 255 int opener_frame_route_id, | 256 int opener_frame_route_id, |
| 256 int proxy_route_id, | 257 int proxy_route_id, |
| 257 int32 max_page_id, | 258 int32_t max_page_id, |
| 258 const FrameReplicationState& replicated_frame_state, | 259 const FrameReplicationState& replicated_frame_state, |
| 259 bool window_was_created_with_opener) { | 260 bool window_was_created_with_opener) { |
| 260 DCHECK(!IsRenderViewLive()); | 261 DCHECK(!IsRenderViewLive()); |
| 261 set_renderer_initialized(true); | 262 set_renderer_initialized(true); |
| 262 DCHECK(IsRenderViewLive()); | 263 DCHECK(IsRenderViewLive()); |
| 263 opener_frame_route_id_ = opener_frame_route_id; | 264 opener_frame_route_id_ = opener_frame_route_id; |
| 264 RenderFrameHost* main_frame = GetMainFrame(); | 265 RenderFrameHost* main_frame = GetMainFrame(); |
| 265 if (main_frame) | 266 if (main_frame) |
| 266 static_cast<RenderFrameHostImpl*>(main_frame)->SetRenderFrameCreated(true); | 267 static_cast<RenderFrameHostImpl*>(main_frame)->SetRenderFrameCreated(true); |
| 267 | 268 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 331 |
| 331 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { | 332 TestRenderFrameHost* RenderViewHostImplTestHarness::main_test_rfh() { |
| 332 return contents()->GetMainFrame(); | 333 return contents()->GetMainFrame(); |
| 333 } | 334 } |
| 334 | 335 |
| 335 TestWebContents* RenderViewHostImplTestHarness::contents() { | 336 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 336 return static_cast<TestWebContents*>(web_contents()); | 337 return static_cast<TestWebContents*>(web_contents()); |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace content | 340 } // namespace content |
| OLD | NEW |