Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: content/public/test/render_view_test.cc

Issue 248013003: Remove WebHistoryItem child usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/renderer/context_menu_params_builder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 url_str.append(html); 118 url_str.append(html);
119 GURL url(url_str); 119 GURL url(url_str);
120 120
121 GetMainFrame()->loadRequest(WebURLRequest(url)); 121 GetMainFrame()->loadRequest(WebURLRequest(url));
122 122
123 // The load actually happens asynchronously, so we pump messages to process 123 // The load actually happens asynchronously, so we pump messages to process
124 // the pending continuation. 124 // the pending continuation.
125 ProcessPendingMessages(); 125 ProcessPendingMessages();
126 } 126 }
127 127
128 void RenderViewTest::GoBack(const blink::WebHistoryItem& item) { 128 void RenderViewTest::GoBack(const PageState& state) {
129 GoToOffset(-1, item); 129 GoToOffset(-1, state);
130 } 130 }
131 131
132 void RenderViewTest::GoForward(const blink::WebHistoryItem& item) { 132 void RenderViewTest::GoForward(const PageState& state) {
133 GoToOffset(1, item); 133 GoToOffset(1, state);
134 } 134 }
135 135
136 void RenderViewTest::GoBackToPrevious() { 136 void RenderViewTest::GoBackToPrevious() {
137 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 137 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
138 GoBack(impl->history_controller()->GetPreviousItemForExport()); 138 GoBack(HistoryEntryToPageState(
139 impl->history_controller()->GetPreviousEntry()));
139 } 140 }
140 141
141 void RenderViewTest::SetUp() { 142 void RenderViewTest::SetUp() {
142 content_client_.reset(CreateContentClient()); 143 content_client_.reset(CreateContentClient());
143 content_browser_client_.reset(CreateContentBrowserClient()); 144 content_browser_client_.reset(CreateContentBrowserClient());
144 content_renderer_client_.reset(CreateContentRendererClient()); 145 content_renderer_client_.reset(CreateContentRendererClient());
145 SetContentClient(content_client_.get()); 146 SetContentClient(content_client_.get());
146 SetBrowserClientForTesting(content_browser_client_.get()); 147 SetBrowserClientForTesting(content_browser_client_.get());
147 SetRendererClientForTesting(content_renderer_client_.get()); 148 SetRendererClientForTesting(content_renderer_client_.get());
148 149
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 394 }
394 395
395 ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() { 396 ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() {
396 return new ContentBrowserClient; 397 return new ContentBrowserClient;
397 } 398 }
398 399
399 ContentRendererClient* RenderViewTest::CreateContentRendererClient() { 400 ContentRendererClient* RenderViewTest::CreateContentRendererClient() {
400 return new ContentRendererClient; 401 return new ContentRendererClient;
401 } 402 }
402 403
403 void RenderViewTest::GoToOffset(int offset, 404 void RenderViewTest::GoToOffset(int offset, const PageState& state) {
404 const blink::WebHistoryItem& history_item) {
405 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); 405 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_);
406 406
407 int history_list_length = impl->historyBackListCount() + 407 int history_list_length = impl->historyBackListCount() +
408 impl->historyForwardListCount() + 1; 408 impl->historyForwardListCount() + 1;
409 int pending_offset = offset + impl->history_list_offset(); 409 int pending_offset = offset + impl->history_list_offset();
410 410
411 FrameMsg_Navigate_Params navigate_params; 411 FrameMsg_Navigate_Params navigate_params;
412 navigate_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; 412 navigate_params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
413 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK; 413 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK;
414 navigate_params.current_history_list_length = history_list_length; 414 navigate_params.current_history_list_length = history_list_length;
415 navigate_params.current_history_list_offset = impl->history_list_offset(); 415 navigate_params.current_history_list_offset = impl->history_list_offset();
416 navigate_params.pending_history_list_offset = pending_offset; 416 navigate_params.pending_history_list_offset = pending_offset;
417 navigate_params.page_id = impl->GetPageId() + offset; 417 navigate_params.page_id = impl->GetPageId() + offset;
418 navigate_params.page_state = HistoryItemToPageState(history_item); 418 navigate_params.page_state = state;
419 navigate_params.request_time = base::Time::Now(); 419 navigate_params.request_time = base::Time::Now();
420 420
421 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), 421 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(),
422 navigate_params); 422 navigate_params);
423 impl->main_render_frame()->OnMessageReceived(navigate_message); 423 impl->main_render_frame()->OnMessageReceived(navigate_message);
424 424
425 // The load actually happens asynchronously, so we pump messages to process 425 // The load actually happens asynchronously, so we pump messages to process
426 // the pending continuation. 426 // the pending continuation.
427 ProcessPendingMessages(); 427 ProcessPendingMessages();
428 } 428 }
429 429
430 } // namespace content 430 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/render_view_test.h ('k') | content/renderer/context_menu_params_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698