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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <cctype> | 9 #include <cctype> |
10 | 10 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 void RenderViewTest::GoBack(const GURL& url, const PageState& state) { | 224 void RenderViewTest::GoBack(const GURL& url, const PageState& state) { |
225 GoToOffset(-1, url, state); | 225 GoToOffset(-1, url, state); |
226 } | 226 } |
227 | 227 |
228 void RenderViewTest::GoForward(const GURL& url, const PageState& state) { | 228 void RenderViewTest::GoForward(const GURL& url, const PageState& state) { |
229 GoToOffset(1, url, state); | 229 GoToOffset(1, url, state); |
230 } | 230 } |
231 | 231 |
232 void RenderViewTest::SetUp() { | 232 void RenderViewTest::SetUp() { |
| 233 // Initialize mojo firstly to enable Blink initialization to use it. |
| 234 InitializeMojo(); |
| 235 test_io_thread_.reset(new base::TestIOThread(base::TestIOThread::kAutoStart)); |
| 236 ipc_support_.reset( |
| 237 new mojo::edk::test::ScopedIPCSupport(test_io_thread_->task_runner())); |
| 238 |
233 // Blink needs to be initialized before calling CreateContentRendererClient() | 239 // Blink needs to be initialized before calling CreateContentRendererClient() |
234 // because it uses blink internally. | 240 // because it uses blink internally. |
235 blink::initialize(blink_platform_impl_.Get()); | 241 blink::initialize(blink_platform_impl_.Get()); |
236 | 242 |
237 content_client_.reset(CreateContentClient()); | 243 content_client_.reset(CreateContentClient()); |
238 content_browser_client_.reset(CreateContentBrowserClient()); | 244 content_browser_client_.reset(CreateContentBrowserClient()); |
239 content_renderer_client_.reset(CreateContentRendererClient()); | 245 content_renderer_client_.reset(CreateContentRendererClient()); |
240 SetContentClient(content_client_.get()); | 246 SetContentClient(content_client_.get()); |
241 SetBrowserClientForTesting(content_browser_client_.get()); | 247 SetBrowserClientForTesting(content_browser_client_.get()); |
242 SetRendererClientForTesting(content_renderer_client_.get()); | 248 SetRendererClientForTesting(content_renderer_client_.get()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 view_params.swapped_out = false; | 306 view_params.swapped_out = false; |
301 view_params.replicated_frame_state = FrameReplicationState(); | 307 view_params.replicated_frame_state = FrameReplicationState(); |
302 view_params.proxy_routing_id = MSG_ROUTING_NONE; | 308 view_params.proxy_routing_id = MSG_ROUTING_NONE; |
303 view_params.hidden = false; | 309 view_params.hidden = false; |
304 view_params.never_visible = false; | 310 view_params.never_visible = false; |
305 view_params.initial_size = *InitialSizeParams(); | 311 view_params.initial_size = *InitialSizeParams(); |
306 view_params.enable_auto_resize = false; | 312 view_params.enable_auto_resize = false; |
307 view_params.min_size = gfx::Size(); | 313 view_params.min_size = gfx::Size(); |
308 view_params.max_size = gfx::Size(); | 314 view_params.max_size = gfx::Size(); |
309 | 315 |
310 InitializeMojo(); | |
311 test_io_thread_.reset(new base::TestIOThread(base::TestIOThread::kAutoStart)); | |
312 ipc_support_.reset( | |
313 new mojo::edk::test::ScopedIPCSupport(test_io_thread_->task_runner())); | |
314 | |
315 // This needs to pass the mock render thread to the view. | 316 // This needs to pass the mock render thread to the view. |
316 RenderViewImpl* view = | 317 RenderViewImpl* view = |
317 RenderViewImpl::Create(compositor_deps_.get(), view_params, false); | 318 RenderViewImpl::Create(compositor_deps_.get(), view_params, false); |
318 view_ = view; | 319 view_ = view; |
319 } | 320 } |
320 | 321 |
321 void RenderViewTest::TearDown() { | 322 void RenderViewTest::TearDown() { |
322 // Run the loop so the release task from the renderwidget executes. | 323 // Run the loop so the release task from the renderwidget executes. |
323 ProcessPendingMessages(); | 324 ProcessPendingMessages(); |
324 | 325 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 659 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
659 frame->Navigate(common_params, StartNavigationParams(), request_params); | 660 frame->Navigate(common_params, StartNavigationParams(), request_params); |
660 | 661 |
661 // The load actually happens asynchronously, so we pump messages to process | 662 // The load actually happens asynchronously, so we pump messages to process |
662 // the pending continuation. | 663 // the pending continuation. |
663 FrameLoadWaiter(frame).Wait(); | 664 FrameLoadWaiter(frame).Wait(); |
664 view_->GetWebView()->updateAllLifecyclePhases(); | 665 view_->GetWebView()->updateAllLifecyclePhases(); |
665 } | 666 } |
666 | 667 |
667 } // namespace content | 668 } // namespace content |
OLD | NEW |