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 <cctype> | 7 #include <cctype> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { | 572 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { |
573 return new ContentRendererClient; | 573 return new ContentRendererClient; |
574 } | 574 } |
575 | 575 |
576 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { | 576 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { |
577 return make_scoped_ptr(new ViewMsg_Resize_Params()); | 577 return make_scoped_ptr(new ViewMsg_Resize_Params()); |
578 } | 578 } |
579 | 579 |
580 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 580 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
| 581 CommonNavigationParams common_params; |
| 582 common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
| 583 GoToOffsetWithParams(offset, state, common_params, StartNavigationParams(), |
| 584 RequestNavigationParams()); |
| 585 } |
| 586 |
| 587 void RenderViewTest::GoToOffsetWithParams( |
| 588 int offset, |
| 589 const PageState& state, |
| 590 const CommonNavigationParams common_params, |
| 591 const StartNavigationParams start_params, |
| 592 RequestNavigationParams request_params) { |
581 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 593 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
582 | 594 |
583 int history_list_length = impl->historyBackListCount() + | 595 int history_list_length = impl->historyBackListCount() + |
584 impl->historyForwardListCount() + 1; | 596 impl->historyForwardListCount() + 1; |
585 int pending_offset = offset + impl->history_list_offset_; | 597 int pending_offset = offset + impl->history_list_offset_; |
586 | 598 |
587 CommonNavigationParams common_params( | |
588 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | |
589 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | |
590 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | |
591 LOFI_UNSPECIFIED, base::TimeTicks::Now()); | |
592 RequestNavigationParams request_params; | |
593 request_params.page_state = state; | 599 request_params.page_state = state; |
594 request_params.page_id = impl->page_id_ + offset; | 600 request_params.page_id = impl->page_id_ + offset; |
595 request_params.nav_entry_id = pending_offset + 1; | 601 request_params.nav_entry_id = pending_offset + 1; |
596 request_params.pending_history_list_offset = pending_offset; | 602 request_params.pending_history_list_offset = pending_offset; |
597 request_params.current_history_list_offset = impl->history_list_offset_; | 603 request_params.current_history_list_offset = impl->history_list_offset_; |
598 request_params.current_history_list_length = history_list_length; | 604 request_params.current_history_list_length = history_list_length; |
599 | 605 |
600 TestRenderFrame* frame = | 606 TestRenderFrame* frame = |
601 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 607 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
602 frame->Navigate(common_params, StartNavigationParams(), request_params); | 608 frame->Navigate(common_params, start_params, request_params); |
603 | 609 |
604 // The load actually happens asynchronously, so we pump messages to process | 610 // The load actually happens asynchronously, so we pump messages to process |
605 // the pending continuation. | 611 // the pending continuation. |
606 FrameLoadWaiter(frame).Wait(); | 612 FrameLoadWaiter(frame).Wait(); |
607 } | 613 } |
608 | 614 |
609 } // namespace content | 615 } // namespace content |
OLD | NEW |