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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // This check is needed because when run under content_browsertests, | 167 // This check is needed because when run under content_browsertests, |
168 // ResourceBundle isn't initialized (since we have to use a diferent test | 168 // ResourceBundle isn't initialized (since we have to use a diferent test |
169 // suite implementation than for content_unittests). For browser_tests, this | 169 // suite implementation than for content_unittests). For browser_tests, this |
170 // is already initialized. | 170 // is already initialized. |
171 if (!ResourceBundle::HasSharedInstance()) | 171 if (!ResourceBundle::HasSharedInstance()) |
172 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 172 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
173 | 173 |
174 mock_process_.reset(new MockRenderProcess); | 174 mock_process_.reset(new MockRenderProcess); |
175 | 175 |
176 // This needs to pass the mock render thread to the view. | 176 // This needs to pass the mock render thread to the view. |
177 RenderViewImpl* view = RenderViewImpl::Create( | 177 RenderViewImpl* view = |
178 kOpenerId, | 178 RenderViewImpl::Create(kOpenerId, |
179 RendererPreferences(), | 179 RendererPreferences(), |
180 WebPreferences(), | 180 WebPreferences(), |
181 kRouteId, | 181 kRouteId, |
182 kMainFrameRouteId, | 182 kMainFrameRouteId, |
183 kSurfaceId, | 183 kSurfaceId, |
184 kInvalidSessionStorageNamespaceId, | 184 kInvalidSessionStorageNamespaceId, |
185 base::string16(), | 185 base::string16(), |
186 false, // is_renderer_created | 186 false, // is_renderer_created |
187 false, // swapped_out | 187 false, // swapped_out |
188 false, // hidden | 188 false, // hidden |
189 1, // next_page_id | 189 1, // next_page_id |
190 blink::WebScreenInfo(), | 190 blink::WebScreenInfo(), |
191 AccessibilityModeOff, | 191 AccessibilityModeOff); |
192 true); | |
193 view->AddRef(); | 192 view->AddRef(); |
194 view_ = view; | 193 view_ = view; |
195 } | 194 } |
196 | 195 |
197 void RenderViewTest::TearDown() { | 196 void RenderViewTest::TearDown() { |
198 // Try very hard to collect garbage before shutting down. | 197 // Try very hard to collect garbage before shutting down. |
199 // "5" was chosen following http://crbug.com/46571#c9 | 198 // "5" was chosen following http://crbug.com/46571#c9 |
200 const int kGCIterations = 5; | 199 const int kGCIterations = 5; |
201 for (int i = 0; i < kGCIterations; i++) | 200 for (int i = 0; i < kGCIterations; i++) |
202 GetMainFrame()->collectGarbage(); | 201 GetMainFrame()->collectGarbage(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), | 391 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), |
393 navigate_params); | 392 navigate_params); |
394 impl->main_render_frame()->OnMessageReceived(navigate_message); | 393 impl->main_render_frame()->OnMessageReceived(navigate_message); |
395 | 394 |
396 // The load actually happens asynchronously, so we pump messages to process | 395 // The load actually happens asynchronously, so we pump messages to process |
397 // the pending continuation. | 396 // the pending continuation. |
398 ProcessPendingMessages(); | 397 ProcessPendingMessages(); |
399 } | 398 } |
400 | 399 |
401 } // namespace content | 400 } // namespace content |
OLD | NEW |