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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 InputMsg_HandleInputEvent(0, &gesture_event, ui::LatencyInfo(), false)); | 355 InputMsg_HandleInputEvent(0, &gesture_event, ui::LatencyInfo(), false)); |
356 impl->FocusChangeComplete(); | 356 impl->FocusChangeComplete(); |
357 } | 357 } |
358 | 358 |
359 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 359 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
360 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 360 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
361 impl->focusedNodeChanged(blink::WebNode(), node); | 361 impl->focusedNodeChanged(blink::WebNode(), node); |
362 } | 362 } |
363 | 363 |
364 void RenderViewTest::Reload(const GURL& url) { | 364 void RenderViewTest::Reload(const GURL& url) { |
365 FrameMsg_Navigate_Params params; | 365 CommonNavigationParams common_params( |
366 params.common_params.url = url; | 366 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, |
367 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 367 true, base::TimeTicks(), FrameMsg_UILoadMetricsReportType::NO_REPORT, |
| 368 GURL(), GURL()); |
368 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 369 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
369 impl->GetMainRenderFrame()->OnNavigate(params); | 370 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), |
| 371 CommitNavigationParams(), |
| 372 HistoryNavigationParams()); |
370 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); | 373 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); |
371 } | 374 } |
372 | 375 |
373 uint32 RenderViewTest::GetNavigationIPCType() { | 376 uint32 RenderViewTest::GetNavigationIPCType() { |
374 return FrameHostMsg_DidCommitProvisionalLoad::ID; | 377 return FrameHostMsg_DidCommitProvisionalLoad::ID; |
375 } | 378 } |
376 | 379 |
377 void RenderViewTest::Resize(gfx::Size new_size, | 380 void RenderViewTest::Resize(gfx::Size new_size, |
378 gfx::Rect resizer_rect, | 381 gfx::Rect resizer_rect, |
379 bool is_fullscreen) { | 382 bool is_fullscreen) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 return make_scoped_ptr(new ViewMsg_Resize_Params()); | 436 return make_scoped_ptr(new ViewMsg_Resize_Params()); |
434 } | 437 } |
435 | 438 |
436 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 439 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
437 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 440 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
438 | 441 |
439 int history_list_length = impl->historyBackListCount() + | 442 int history_list_length = impl->historyBackListCount() + |
440 impl->historyForwardListCount() + 1; | 443 impl->historyForwardListCount() + 1; |
441 int pending_offset = offset + impl->history_list_offset_; | 444 int pending_offset = offset + impl->history_list_offset_; |
442 | 445 |
443 FrameMsg_Navigate_Params navigate_params; | 446 CommonNavigationParams common_params( |
444 navigate_params.common_params.navigation_type = | 447 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, |
445 FrameMsg_Navigate_Type::NORMAL; | 448 FrameMsg_Navigate_Type::NORMAL, true, base::TimeTicks(), |
446 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 449 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); |
447 navigate_params.history_params.current_history_list_length = | 450 HistoryNavigationParams history_params( |
448 history_list_length; | 451 state, impl->page_id_ + offset, pending_offset, |
449 navigate_params.history_params.current_history_list_offset = | 452 impl->history_list_offset_, history_list_length, false); |
450 impl->history_list_offset_; | |
451 navigate_params.history_params.pending_history_list_offset = pending_offset; | |
452 navigate_params.history_params.page_id = impl->page_id_ + offset; | |
453 navigate_params.history_params.page_state = state; | |
454 navigate_params.request_time = base::Time::Now(); | |
455 | 453 |
456 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 454 impl->GetMainRenderFrame()->OnNavigate(common_params, StartNavigationParams(), |
457 navigate_params); | 455 CommitNavigationParams(), |
458 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 456 history_params); |
459 | 457 |
460 // The load actually happens asynchronously, so we pump messages to process | 458 // The load actually happens asynchronously, so we pump messages to process |
461 // the pending continuation. | 459 // the pending continuation. |
462 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 460 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
463 } | 461 } |
464 | 462 |
465 } // namespace content | 463 } // namespace content |
OLD | NEW |