| 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/browser/renderer_host/test_backing_store.h" | 5 #include "content/browser/renderer_host/test_backing_store.h" |
| 6 #include "content/browser/dom_storage/dom_storage_context_impl.h" | 6 #include "content/browser/dom_storage/dom_storage_context_impl.h" |
| 7 #include "content/browser/dom_storage/session_storage_namespace_impl.h" | 7 #include "content/browser/dom_storage/session_storage_namespace_impl.h" |
| 8 #include "content/browser/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
| 9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/browser/web_contents/navigation_controller_impl.h" | 10 #include "content/browser/web_contents/navigation_controller_impl.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // here for testing. | 29 // here for testing. |
| 30 SessionStorageNamespaceImpl* CreateSessionStorageNamespace( | 30 SessionStorageNamespaceImpl* CreateSessionStorageNamespace( |
| 31 SiteInstance* instance) { | 31 SiteInstance* instance) { |
| 32 RenderProcessHost* process_host = instance->GetProcess(); | 32 RenderProcessHost* process_host = instance->GetProcess(); |
| 33 DOMStorageContext* dom_storage_context = | 33 DOMStorageContext* dom_storage_context = |
| 34 BrowserContext::GetDOMStorageContext(process_host->GetBrowserContext(), | 34 BrowserContext::GetDOMStorageContext(process_host->GetBrowserContext(), |
| 35 process_host->GetID()); | 35 process_host->GetID()); |
| 36 return new SessionStorageNamespaceImpl( | 36 return new SessionStorageNamespaceImpl( |
| 37 static_cast<DOMStorageContextImpl*>(dom_storage_context)); | 37 static_cast<DOMStorageContextImpl*>(dom_storage_context)); |
| 38 } | 38 } |
| 39 |
| 40 class TestCompositingDelegate |
| 41 : public RenderWidgetHostViewBase::CompositingDelegate { |
| 42 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE { |
| 43 return gfx::GLSurfaceHandle(); |
| 44 } |
| 45 virtual bool ResizeNeedsNewSurface() OVERRIDE { return false; } |
| 46 virtual void AcceleratedSurfaceBuffersSwapped( |
| 47 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& |
| 48 params_in_pixel, |
| 49 int gpu_host_id) OVERRIDE { } |
| 50 virtual void AcceleratedSurfaceNew( |
| 51 int32 width_in_pixel, |
| 52 int32 height_in_pixel, |
| 53 uint64 surface_handle) OVERRIDE { } |
| 54 virtual void AcceleratedSurfaceRelease(uint64 surface_handle) OVERRIDE { } |
| 55 virtual void AcceleratedSurfacePostSubBuffer( |
| 56 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& |
| 57 params_in_pixel, |
| 58 int gpu_host_id) OVERRIDE { } |
| 59 }; |
| 60 |
| 39 } // namespace | 61 } // namespace |
| 40 | 62 |
| 41 | 63 |
| 42 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, | 64 void InitNavigateParams(ViewHostMsg_FrameNavigate_Params* params, |
| 43 int page_id, | 65 int page_id, |
| 44 const GURL& url, | 66 const GURL& url, |
| 45 PageTransition transition) { | 67 PageTransition transition) { |
| 46 params->page_id = page_id; | 68 params->page_id = page_id; |
| 47 params->url = url; | 69 params->url = url; |
| 48 params->referrer = Referrer(); | 70 params->referrer = Referrer(); |
| 49 params->transition = transition; | 71 params->transition = transition; |
| 50 params->redirects = std::vector<GURL>(); | 72 params->redirects = std::vector<GURL>(); |
| 51 params->should_update_history = false; | 73 params->should_update_history = false; |
| 52 params->searchable_form_url = GURL(); | 74 params->searchable_form_url = GURL(); |
| 53 params->searchable_form_encoding = std::string(); | 75 params->searchable_form_encoding = std::string(); |
| 54 params->password_form = PasswordForm(); | 76 params->password_form = PasswordForm(); |
| 55 params->security_info = std::string(); | 77 params->security_info = std::string(); |
| 56 params->gesture = NavigationGestureUser; | 78 params->gesture = NavigationGestureUser; |
| 57 params->was_within_same_page = false; | 79 params->was_within_same_page = false; |
| 58 params->is_post = false; | 80 params->is_post = false; |
| 59 params->content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); | 81 params->content_state = webkit_glue::CreateHistoryStateForURL(GURL(url)); |
| 60 } | 82 } |
| 61 | 83 |
| 62 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) | 84 TestRenderWidgetHostView::TestRenderWidgetHostView(RenderWidgetHost* rwh) |
| 63 : rwh_(RenderWidgetHostImpl::From(rwh)), | 85 : RenderWidgetHostViewBase(scoped_ptr<CompositingDelegate>( |
| 86 new TestCompositingDelegate).Pass()), |
| 87 rwh_(RenderWidgetHostImpl::From(rwh)), |
| 64 is_showing_(false) { | 88 is_showing_(false) { |
| 65 } | 89 } |
| 66 | 90 |
| 67 TestRenderWidgetHostView::~TestRenderWidgetHostView() { | 91 TestRenderWidgetHostView::~TestRenderWidgetHostView() { |
| 68 } | 92 } |
| 69 | 93 |
| 70 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { | 94 RenderWidgetHost* TestRenderWidgetHostView::GetRenderWidgetHost() const { |
| 71 return NULL; | 95 return NULL; |
| 72 } | 96 } |
| 73 | 97 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 const gfx::Rect& src_subrect, | 145 const gfx::Rect& src_subrect, |
| 122 const gfx::Size& dst_size, | 146 const gfx::Size& dst_size, |
| 123 const base::Callback<void(bool)>& callback, | 147 const base::Callback<void(bool)>& callback, |
| 124 skia::PlatformCanvas* output) { | 148 skia::PlatformCanvas* output) { |
| 125 callback.Run(false); | 149 callback.Run(false); |
| 126 } | 150 } |
| 127 | 151 |
| 128 void TestRenderWidgetHostView::OnAcceleratedCompositingStateChange() { | 152 void TestRenderWidgetHostView::OnAcceleratedCompositingStateChange() { |
| 129 } | 153 } |
| 130 | 154 |
| 131 void TestRenderWidgetHostView::AcceleratedSurfaceBuffersSwapped( | |
| 132 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | |
| 133 int gpu_host_id) { | |
| 134 } | |
| 135 | |
| 136 void TestRenderWidgetHostView::AcceleratedSurfacePostSubBuffer( | |
| 137 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | |
| 138 int gpu_host_id) { | |
| 139 } | |
| 140 | |
| 141 void TestRenderWidgetHostView::AcceleratedSurfaceSuspend() { | 155 void TestRenderWidgetHostView::AcceleratedSurfaceSuspend() { |
| 142 } | 156 } |
| 143 | 157 |
| 144 bool TestRenderWidgetHostView::HasAcceleratedSurface( | 158 bool TestRenderWidgetHostView::HasAcceleratedSurface( |
| 145 const gfx::Size& desired_size) { | 159 const gfx::Size& desired_size) { |
| 146 return false; | 160 return false; |
| 147 } | 161 } |
| 148 | 162 |
| 149 #if defined(OS_MACOSX) | 163 #if defined(OS_MACOSX) |
| 150 | 164 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 #if defined(TOOLKIT_GTK) | 238 #if defined(TOOLKIT_GTK) |
| 225 GdkEventButton* TestRenderWidgetHostView::GetLastMouseDown() { | 239 GdkEventButton* TestRenderWidgetHostView::GetLastMouseDown() { |
| 226 return NULL; | 240 return NULL; |
| 227 } | 241 } |
| 228 | 242 |
| 229 gfx::NativeView TestRenderWidgetHostView::BuildInputMethodsGtkMenu() { | 243 gfx::NativeView TestRenderWidgetHostView::BuildInputMethodsGtkMenu() { |
| 230 return NULL; | 244 return NULL; |
| 231 } | 245 } |
| 232 #endif // defined(TOOLKIT_GTK) | 246 #endif // defined(TOOLKIT_GTK) |
| 233 | 247 |
| 234 gfx::GLSurfaceHandle TestRenderWidgetHostView::GetCompositingSurface() { | |
| 235 return gfx::GLSurfaceHandle(); | |
| 236 } | |
| 237 | |
| 238 bool TestRenderWidgetHostView::LockMouse() { | 248 bool TestRenderWidgetHostView::LockMouse() { |
| 239 return false; | 249 return false; |
| 240 } | 250 } |
| 241 | 251 |
| 242 void TestRenderWidgetHostView::UnlockMouse() { | 252 void TestRenderWidgetHostView::UnlockMouse() { |
| 243 } | 253 } |
| 244 | 254 |
| 245 TestRenderViewHost::TestRenderViewHost( | 255 TestRenderViewHost::TestRenderViewHost( |
| 246 SiteInstance* instance, | 256 SiteInstance* instance, |
| 247 RenderViewHostDelegate* delegate, | 257 RenderViewHostDelegate* delegate, |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 392 |
| 383 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 393 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
| 384 return static_cast<TestRenderViewHost*>(active_rvh()); | 394 return static_cast<TestRenderViewHost*>(active_rvh()); |
| 385 } | 395 } |
| 386 | 396 |
| 387 TestWebContents* RenderViewHostImplTestHarness::contents() { | 397 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 388 return static_cast<TestWebContents*>(web_contents()); | 398 return static_cast<TestWebContents*>(web_contents()); |
| 389 } | 399 } |
| 390 | 400 |
| 391 } // namespace content | 401 } // namespace content |
| OLD | NEW |