OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/renderer_host/test_render_view_host.h" | 5 #include "chrome/browser/renderer_host/test_render_view_host.h" |
| 6 |
| 7 #include "chrome/browser/renderer_host/backing_store.h" |
6 #include "chrome/browser/tab_contents/test_web_contents.h" | 8 #include "chrome/browser/tab_contents/test_web_contents.h" |
7 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
8 | 10 |
9 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, | 11 TestRenderViewHost::TestRenderViewHost(SiteInstance* instance, |
10 RenderViewHostDelegate* delegate, | 12 RenderViewHostDelegate* delegate, |
11 int routing_id, | 13 int routing_id, |
12 base::WaitableEvent* modal_dialog_event) | 14 base::WaitableEvent* modal_dialog_event) |
13 : RenderViewHost(instance, delegate, routing_id, modal_dialog_event), | 15 : RenderViewHost(instance, delegate, routing_id, modal_dialog_event), |
14 render_view_created_(false), | 16 render_view_created_(false), |
15 delete_counter_(NULL) { | 17 delete_counter_(NULL) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 params.gesture = NavigationGestureUser; | 57 params.gesture = NavigationGestureUser; |
56 params.contents_mime_type = std::string(); | 58 params.contents_mime_type = std::string(); |
57 params.is_post = false; | 59 params.is_post = false; |
58 params.is_content_filtered = false; | 60 params.is_content_filtered = false; |
59 params.http_status_code = 0; | 61 params.http_status_code = 0; |
60 | 62 |
61 ViewHostMsg_FrameNavigate msg(1, params); | 63 ViewHostMsg_FrameNavigate msg(1, params); |
62 OnMsgNavigate(msg); | 64 OnMsgNavigate(msg); |
63 } | 65 } |
64 | 66 |
| 67 BackingStore* TestRenderWidgetHostView::AllocBackingStore( |
| 68 const gfx::Size& size) { |
| 69 return new BackingStore(size); |
| 70 } |
| 71 |
65 void RenderViewHostTestHarness::SetUp() { | 72 void RenderViewHostTestHarness::SetUp() { |
66 // See comment above profile_ decl for why we check for NULL here. | 73 // See comment above profile_ decl for why we check for NULL here. |
67 if (!profile_.get()) | 74 if (!profile_.get()) |
68 profile_.reset(new TestingProfile()); | 75 profile_.reset(new TestingProfile()); |
69 | 76 |
70 // This will be deleted when the WebContents goes away. | 77 // This will be deleted when the WebContents goes away. |
71 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); | 78 SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get()); |
72 | 79 |
73 contents_ = new TestWebContents(profile_.get(), instance, &rvh_factory_); | 80 contents_ = new TestWebContents(profile_.get(), instance, &rvh_factory_); |
74 controller_ = new NavigationController(contents_, profile_.get()); | 81 controller_ = new NavigationController(contents_, profile_.get()); |
75 } | 82 } |
76 | 83 |
77 void RenderViewHostTestHarness::TearDown() { | 84 void RenderViewHostTestHarness::TearDown() { |
78 if (contents_) { | 85 if (contents_) { |
79 contents_->CloseContents(); | 86 contents_->CloseContents(); |
80 contents_ = NULL; | 87 contents_ = NULL; |
81 } | 88 } |
82 controller_ = NULL; | 89 controller_ = NULL; |
83 | 90 |
84 // Make sure that we flush any messages related to WebContents destruction | 91 // Make sure that we flush any messages related to WebContents destruction |
85 // before we destroy the profile. | 92 // before we destroy the profile. |
86 MessageLoop::current()->RunAllPending(); | 93 MessageLoop::current()->RunAllPending(); |
87 } | 94 } |
OLD | NEW |