| 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/renderer_host/test_render_view_host.h" | 6 #include "content/browser/renderer_host/test_render_view_host.h" |
| 7 #include "content/browser/site_instance_impl.h" | 7 #include "content/browser/site_instance_impl.h" |
| 8 #include "content/browser/web_contents/navigation_controller_impl.h" | 8 #include "content/browser/web_contents/navigation_controller_impl.h" |
| 9 #include "content/browser/web_contents/test_web_contents.h" | 9 #include "content/browser/web_contents/test_web_contents.h" |
| 10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 bool TestRenderWidgetHostView::LockMouse() { | 204 bool TestRenderWidgetHostView::LockMouse() { |
| 205 return false; | 205 return false; |
| 206 } | 206 } |
| 207 | 207 |
| 208 void TestRenderWidgetHostView::UnlockMouse() { | 208 void TestRenderWidgetHostView::UnlockMouse() { |
| 209 } | 209 } |
| 210 | 210 |
| 211 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, | 211 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, |
| 212 RenderViewHostDelegate* delegate, | 212 RenderViewHostDelegate* delegate, |
| 213 int routing_id) | 213 int routing_id, |
| 214 bool swapped_out) |
| 214 : RenderViewHostImpl(instance, | 215 : RenderViewHostImpl(instance, |
| 215 delegate, | 216 delegate, |
| 216 routing_id, | 217 routing_id, |
| 218 swapped_out, |
| 217 dom_storage::kInvalidSessionStorageNamespaceId), | 219 dom_storage::kInvalidSessionStorageNamespaceId), |
| 218 render_view_created_(false), | 220 render_view_created_(false), |
| 219 delete_counter_(NULL), | 221 delete_counter_(NULL), |
| 220 simulate_fetch_via_proxy_(false), | 222 simulate_fetch_via_proxy_(false), |
| 221 contents_mime_type_("text/html") { | 223 contents_mime_type_("text/html") { |
| 222 // For normal RenderViewHosts, this is freed when |Shutdown()| is | 224 // For normal RenderViewHosts, this is freed when |Shutdown()| is |
| 223 // called. For TestRenderViewHost, the view is explicitly | 225 // called. For TestRenderViewHost, the view is explicitly |
| 224 // deleted in the destructor below, because | 226 // deleted in the destructor below, because |
| 225 // TestRenderWidgetHostView::Destroy() doesn't |delete this|. | 227 // TestRenderWidgetHostView::Destroy() doesn't |delete this|. |
| 226 SetView(new TestRenderWidgetHostView(this)); | 228 SetView(new TestRenderWidgetHostView(this)); |
| 227 } | 229 } |
| 228 | 230 |
| 229 TestRenderViewHost::~TestRenderViewHost() { | 231 TestRenderViewHost::~TestRenderViewHost() { |
| 230 if (delete_counter_) | 232 if (delete_counter_) |
| 231 ++*delete_counter_; | 233 ++*delete_counter_; |
| 232 | 234 |
| 233 // Since this isn't a traditional view, we have to delete it. | 235 // Since this isn't a traditional view, we have to delete it. |
| 234 delete GetView(); | 236 delete GetView(); |
| 235 } | 237 } |
| 236 | 238 |
| 237 bool TestRenderViewHost::CreateRenderView(const string16& frame_name, | 239 bool TestRenderViewHost::CreateRenderView(const string16& frame_name, |
| 240 int opener_route_id, |
| 238 int32 max_page_id) { | 241 int32 max_page_id) { |
| 239 DCHECK(!render_view_created_); | 242 DCHECK(!render_view_created_); |
| 240 render_view_created_ = true; | 243 render_view_created_ = true; |
| 241 return true; | 244 return true; |
| 242 } | 245 } |
| 243 | 246 |
| 244 bool TestRenderViewHost::IsRenderViewLive() const { | 247 bool TestRenderViewHost::IsRenderViewLive() const { |
| 245 return render_view_created_; | 248 return render_view_created_; |
| 246 } | 249 } |
| 247 | 250 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 326 |
| 324 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { | 327 TestRenderViewHost* RenderViewHostImplTestHarness::active_test_rvh() { |
| 325 return static_cast<TestRenderViewHost*>(active_rvh()); | 328 return static_cast<TestRenderViewHost*>(active_rvh()); |
| 326 } | 329 } |
| 327 | 330 |
| 328 TestWebContents* RenderViewHostImplTestHarness::contents() { | 331 TestWebContents* RenderViewHostImplTestHarness::contents() { |
| 329 return static_cast<TestWebContents*>(web_contents()); | 332 return static_cast<TestWebContents*>(web_contents()); |
| 330 } | 333 } |
| 331 | 334 |
| 332 } // namespace content | 335 } // namespace content |
| OLD | NEW |