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 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.next_page_id = 1; | 311 view_params.next_page_id = 1; |
306 view_params.initial_size = *InitialSizeParams(); | 312 view_params.initial_size = *InitialSizeParams(); |
307 view_params.enable_auto_resize = false; | 313 view_params.enable_auto_resize = false; |
308 view_params.min_size = gfx::Size(); | 314 view_params.min_size = gfx::Size(); |
309 view_params.max_size = gfx::Size(); | 315 view_params.max_size = gfx::Size(); |
310 | 316 |
311 InitializeMojo(); | |
312 test_io_thread_.reset(new base::TestIOThread(base::TestIOThread::kAutoStart)); | |
313 ipc_support_.reset( | |
314 new mojo::edk::test::ScopedIPCSupport(test_io_thread_->task_runner())); | |
315 | |
316 // This needs to pass the mock render thread to the view. | 317 // This needs to pass the mock render thread to the view. |
317 RenderViewImpl* view = | 318 RenderViewImpl* view = |
318 RenderViewImpl::Create(compositor_deps_.get(), view_params, false); | 319 RenderViewImpl::Create(compositor_deps_.get(), view_params, false); |
319 view_ = view; | 320 view_ = view; |
320 } | 321 } |
321 | 322 |
322 void RenderViewTest::TearDown() { | 323 void RenderViewTest::TearDown() { |
323 // Run the loop so the release task from the renderwidget executes. | 324 // Run the loop so the release task from the renderwidget executes. |
324 ProcessPendingMessages(); | 325 ProcessPendingMessages(); |
325 | 326 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 661 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
661 frame->Navigate(common_params, StartNavigationParams(), request_params); | 662 frame->Navigate(common_params, StartNavigationParams(), request_params); |
662 | 663 |
663 // The load actually happens asynchronously, so we pump messages to process | 664 // The load actually happens asynchronously, so we pump messages to process |
664 // the pending continuation. | 665 // the pending continuation. |
665 FrameLoadWaiter(frame).Wait(); | 666 FrameLoadWaiter(frame).Wait(); |
666 view_->GetWebView()->updateAllLifecyclePhases(); | 667 view_->GetWebView()->updateAllLifecyclePhases(); |
667 } | 668 } |
668 | 669 |
669 } // namespace content | 670 } // namespace content |
OLD | NEW |