| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 273     // cannot include out-of-process frames. | 273     // cannot include out-of-process frames. | 
| 274     TestRenderFrame* frame = | 274     TestRenderFrame* frame = | 
| 275         static_cast<TestRenderFrame*>(view_impl->GetMainRenderFrame()); | 275         static_cast<TestRenderFrame*>(view_impl->GetMainRenderFrame()); | 
| 276     return SingleHistoryItemToPageState(frame->current_history_item()); | 276     return SingleHistoryItemToPageState(frame->current_history_item()); | 
| 277   } else { | 277   } else { | 
| 278     return HistoryEntryToPageState( | 278     return HistoryEntryToPageState( | 
| 279         view_impl->history_controller()->GetCurrentEntry()); | 279         view_impl->history_controller()->GetCurrentEntry()); | 
| 280   } | 280   } | 
| 281 } | 281 } | 
| 282 | 282 | 
| 283 void RenderViewTest::GoBack(const PageState& state) { | 283 void RenderViewTest::GoBack(const GURL& url, const PageState& state) { | 
| 284   GoToOffset(-1, state); | 284   GoToOffset(-1, url, state); | 
| 285 } | 285 } | 
| 286 | 286 | 
| 287 void RenderViewTest::GoForward(const PageState& state) { | 287 void RenderViewTest::GoForward(const GURL& url, const PageState& state) { | 
| 288   GoToOffset(1, state); | 288   GoToOffset(1, url, state); | 
| 289 } | 289 } | 
| 290 | 290 | 
| 291 void RenderViewTest::SetUp() { | 291 void RenderViewTest::SetUp() { | 
| 292   // Blink needs to be initialized before calling CreateContentRendererClient() | 292   // Blink needs to be initialized before calling CreateContentRendererClient() | 
| 293   // because it uses blink internally. | 293   // because it uses blink internally. | 
| 294   blink::initialize(blink_platform_impl_.Get()); | 294   blink::initialize(blink_platform_impl_.Get()); | 
| 295 | 295 | 
| 296   content_client_.reset(CreateContentClient()); | 296   content_client_.reset(CreateContentClient()); | 
| 297   content_browser_client_.reset(CreateContentBrowserClient()); | 297   content_browser_client_.reset(CreateContentBrowserClient()); | 
| 298   content_renderer_client_.reset(CreateContentRendererClient()); | 298   content_renderer_client_.reset(CreateContentRendererClient()); | 
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 690 } | 690 } | 
| 691 | 691 | 
| 692 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { | 692 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { | 
| 693   return new ContentRendererClient; | 693   return new ContentRendererClient; | 
| 694 } | 694 } | 
| 695 | 695 | 
| 696 scoped_ptr<ResizeParams> RenderViewTest::InitialSizeParams() { | 696 scoped_ptr<ResizeParams> RenderViewTest::InitialSizeParams() { | 
| 697   return make_scoped_ptr(new ResizeParams()); | 697   return make_scoped_ptr(new ResizeParams()); | 
| 698 } | 698 } | 
| 699 | 699 | 
| 700 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 700 void RenderViewTest::GoToOffset(int offset, | 
|  | 701                                 const GURL& url, | 
|  | 702                                 const PageState& state) { | 
| 701   RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 703   RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 
| 702 | 704 | 
| 703   int history_list_length = impl->historyBackListCount() + | 705   int history_list_length = impl->historyBackListCount() + | 
| 704                             impl->historyForwardListCount() + 1; | 706                             impl->historyForwardListCount() + 1; | 
| 705   int pending_offset = offset + impl->history_list_offset_; | 707   int pending_offset = offset + impl->history_list_offset_; | 
| 706 | 708 | 
| 707   CommonNavigationParams common_params( | 709   CommonNavigationParams common_params( | 
| 708       GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | 710       url, Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | 
| 709       FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | 711       FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | 
| 710       FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 712       FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 
| 711       LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET"); | 713       LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET"); | 
| 712   RequestNavigationParams request_params; | 714   RequestNavigationParams request_params; | 
| 713   request_params.page_state = state; | 715   request_params.page_state = state; | 
| 714   request_params.page_id = impl->page_id_ + offset; | 716   request_params.page_id = impl->page_id_ + offset; | 
| 715   request_params.nav_entry_id = pending_offset + 1; | 717   request_params.nav_entry_id = pending_offset + 1; | 
| 716   request_params.pending_history_list_offset = pending_offset; | 718   request_params.pending_history_list_offset = pending_offset; | 
| 717   request_params.current_history_list_offset = impl->history_list_offset_; | 719   request_params.current_history_list_offset = impl->history_list_offset_; | 
| 718   request_params.current_history_list_length = history_list_length; | 720   request_params.current_history_list_length = history_list_length; | 
| 719 | 721 | 
| 720   TestRenderFrame* frame = | 722   TestRenderFrame* frame = | 
| 721       static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 723       static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 
| 722   frame->Navigate(common_params, StartNavigationParams(), request_params); | 724   frame->Navigate(common_params, StartNavigationParams(), request_params); | 
| 723 | 725 | 
| 724   // The load actually happens asynchronously, so we pump messages to process | 726   // The load actually happens asynchronously, so we pump messages to process | 
| 725   // the pending continuation. | 727   // the pending continuation. | 
| 726   FrameLoadWaiter(frame).Wait(); | 728   FrameLoadWaiter(frame).Wait(); | 
| 727 } | 729 } | 
| 728 | 730 | 
| 729 }  // namespace content | 731 }  // namespace content | 
| OLD | NEW | 
|---|