| 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 void RenderViewTest::ClearHistory() { | 318 void RenderViewTest::ClearHistory() { |
| 319 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 319 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 320 impl->page_id_ = -1; | 320 impl->page_id_ = -1; |
| 321 impl->history_list_offset_ = -1; | 321 impl->history_list_offset_ = -1; |
| 322 impl->history_list_length_ = 0; | 322 impl->history_list_length_ = 0; |
| 323 impl->history_page_ids_.clear(); | 323 impl->history_page_ids_.clear(); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void RenderViewTest::Reload(const GURL& url) { | 326 void RenderViewTest::Reload(const GURL& url) { |
| 327 FrameMsg_Navigate_Params params; | 327 ViewMsg_Navigate_Params params; |
| 328 params.url = url; | 328 params.url = url; |
| 329 params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 329 params.navigation_type = ViewMsg_Navigate_Type::RELOAD; |
| 330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 330 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 331 impl->main_render_frame()->OnNavigate(params); | 331 impl->OnNavigate(params); |
| 332 } | 332 } |
| 333 | 333 |
| 334 uint32 RenderViewTest::GetNavigationIPCType() { | 334 uint32 RenderViewTest::GetNavigationIPCType() { |
| 335 return FrameHostMsg_DidCommitProvisionalLoad::ID; | 335 return FrameHostMsg_DidCommitProvisionalLoad::ID; |
| 336 } | 336 } |
| 337 | 337 |
| 338 void RenderViewTest::Resize(gfx::Size new_size, | 338 void RenderViewTest::Resize(gfx::Size new_size, |
| 339 gfx::Rect resizer_rect, | 339 gfx::Rect resizer_rect, |
| 340 bool is_fullscreen) { | 340 bool is_fullscreen) { |
| 341 ViewMsg_Resize_Params params; | 341 ViewMsg_Resize_Params params; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 371 } | 371 } |
| 372 | 372 |
| 373 void RenderViewTest::GoToOffset(int offset, | 373 void RenderViewTest::GoToOffset(int offset, |
| 374 const blink::WebHistoryItem& history_item) { | 374 const blink::WebHistoryItem& history_item) { |
| 375 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 375 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 376 | 376 |
| 377 int history_list_length = impl->historyBackListCount() + | 377 int history_list_length = impl->historyBackListCount() + |
| 378 impl->historyForwardListCount() + 1; | 378 impl->historyForwardListCount() + 1; |
| 379 int pending_offset = offset + impl->history_list_offset(); | 379 int pending_offset = offset + impl->history_list_offset(); |
| 380 | 380 |
| 381 FrameMsg_Navigate_Params navigate_params; | 381 ViewMsg_Navigate_Params navigate_params; |
| 382 navigate_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 382 navigate_params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 383 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK; | 383 navigate_params.transition = PAGE_TRANSITION_FORWARD_BACK; |
| 384 navigate_params.current_history_list_length = history_list_length; | 384 navigate_params.current_history_list_length = history_list_length; |
| 385 navigate_params.current_history_list_offset = impl->history_list_offset(); | 385 navigate_params.current_history_list_offset = impl->history_list_offset(); |
| 386 navigate_params.pending_history_list_offset = pending_offset; | 386 navigate_params.pending_history_list_offset = pending_offset; |
| 387 navigate_params.page_id = impl->GetPageId() + offset; | 387 navigate_params.page_id = impl->GetPageId() + offset; |
| 388 navigate_params.page_state = HistoryItemToPageState(history_item); | 388 navigate_params.page_state = HistoryItemToPageState(history_item); |
| 389 navigate_params.request_time = base::Time::Now(); | 389 navigate_params.request_time = base::Time::Now(); |
| 390 | 390 |
| 391 FrameMsg_Navigate navigate_message(impl->main_render_frame()->GetRoutingID(), | 391 ViewMsg_Navigate navigate_message(impl->GetRoutingID(), navigate_params); |
| 392 navigate_params); | 392 OnMessageReceived(navigate_message); |
| 393 impl->main_render_frame()->OnMessageReceived(navigate_message); | |
| 394 | 393 |
| 395 // The load actually happens asynchronously, so we pump messages to process | 394 // The load actually happens asynchronously, so we pump messages to process |
| 396 // the pending continuation. | 395 // the pending continuation. |
| 397 ProcessPendingMessages(); | 396 ProcessPendingMessages(); |
| 398 } | 397 } |
| 399 | 398 |
| 400 } // namespace content | 399 } // namespace content |
| OLD | NEW |