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/public/test/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/common/dom_storage/dom_storage_types.h" | 8 #include "content/common/dom_storage/dom_storage_types.h" |
9 #include "content/common/frame_messages.h" | 9 #include "content/common/frame_messages.h" |
10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 // This check is needed because when run under content_browsertests, | 180 // This check is needed because when run under content_browsertests, |
181 // ResourceBundle isn't initialized (since we have to use a diferent test | 181 // ResourceBundle isn't initialized (since we have to use a diferent test |
182 // suite implementation than for content_unittests). For browser_tests, this | 182 // suite implementation than for content_unittests). For browser_tests, this |
183 // is already initialized. | 183 // is already initialized. |
184 if (!ui::ResourceBundle::HasSharedInstance()) | 184 if (!ui::ResourceBundle::HasSharedInstance()) |
185 ui::ResourceBundle::InitSharedInstanceWithLocale( | 185 ui::ResourceBundle::InitSharedInstanceWithLocale( |
186 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); | 186 "en-US", NULL, ui::ResourceBundle::LOAD_COMMON_RESOURCES); |
187 | 187 |
188 mock_process_.reset(new MockRenderProcess); | 188 mock_process_.reset(new MockRenderProcess); |
189 | 189 |
| 190 ViewMsg_New_Params view_params; |
| 191 view_params.opener_route_id = kOpenerId; |
| 192 view_params.window_was_created_with_opener = false; |
| 193 view_params.renderer_preferences = RendererPreferences(); |
| 194 view_params.web_preferences = WebPreferences(); |
| 195 view_params.view_id = kRouteId; |
| 196 view_params.main_frame_routing_id = kMainFrameRouteId; |
| 197 view_params.surface_id = kSurfaceId; |
| 198 view_params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; |
| 199 view_params.frame_name = base::string16(); |
| 200 view_params.swapped_out = false; |
| 201 view_params.proxy_routing_id = MSG_ROUTING_NONE; |
| 202 view_params.hidden = false; |
| 203 view_params.never_visible = false; |
| 204 view_params.next_page_id = 1; |
| 205 view_params.initial_size = *InitialSizeParams(); |
| 206 view_params.enable_auto_resize = false; |
| 207 view_params.min_size = gfx::Size(); |
| 208 view_params.max_size = gfx::Size(); |
| 209 |
190 // This needs to pass the mock render thread to the view. | 210 // This needs to pass the mock render thread to the view. |
191 RenderViewImpl* view = | 211 RenderViewImpl* view = RenderViewImpl::Create(view_params, false); |
192 RenderViewImpl::Create(kOpenerId, | |
193 false, // window_was_created_with_opener | |
194 RendererPreferences(), | |
195 WebPreferences(), | |
196 kRouteId, | |
197 kMainFrameRouteId, | |
198 kSurfaceId, | |
199 kInvalidSessionStorageNamespaceId, | |
200 base::string16(), | |
201 false, // is_renderer_created | |
202 false, // swapped_out | |
203 MSG_ROUTING_NONE, // proxy_routing_id | |
204 false, // hidden | |
205 false, // never_visible | |
206 1, // next_page_id | |
207 *InitialSizeParams(), | |
208 false, // enable_auto_resize | |
209 gfx::Size(), // min_size | |
210 gfx::Size() // max_size | |
211 ); | |
212 view->AddRef(); | 212 view->AddRef(); |
213 view_ = view; | 213 view_ = view; |
214 } | 214 } |
215 | 215 |
216 void RenderViewTest::TearDown() { | 216 void RenderViewTest::TearDown() { |
217 // Try very hard to collect garbage before shutting down. | 217 // Try very hard to collect garbage before shutting down. |
218 // "5" was chosen following http://crbug.com/46571#c9 | 218 // "5" was chosen following http://crbug.com/46571#c9 |
219 const int kGCIterations = 5; | 219 const int kGCIterations = 5; |
220 for (int i = 0; i < kGCIterations; i++) | 220 for (int i = 0; i < kGCIterations; i++) |
221 GetMainFrame()->collectGarbage(); | 221 GetMainFrame()->collectGarbage(); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 436 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), |
437 navigate_params); | 437 navigate_params); |
438 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 438 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); |
439 | 439 |
440 // The load actually happens asynchronously, so we pump messages to process | 440 // The load actually happens asynchronously, so we pump messages to process |
441 // the pending continuation. | 441 // the pending continuation. |
442 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 442 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
443 } | 443 } |
444 | 444 |
445 } // namespace content | 445 } // namespace content |
OLD | NEW |