| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 329 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 330 impl->OnMessageReceived(*input_message); | 330 impl->OnMessageReceived(*input_message); |
| 331 return true; | 331 return true; |
| 332 } | 332 } |
| 333 | 333 |
| 334 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 334 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
| 335 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 335 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 336 impl->focusedNodeChanged(node); | 336 impl->focusedNodeChanged(node); |
| 337 } | 337 } |
| 338 | 338 |
| 339 void RenderViewTest::ClearHistory() { | |
| 340 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | |
| 341 impl->page_id_ = -1; | |
| 342 impl->history_list_offset_ = -1; | |
| 343 impl->history_list_length_ = 0; | |
| 344 impl->history_page_ids_.clear(); | |
| 345 } | |
| 346 | |
| 347 void RenderViewTest::Reload(const GURL& url) { | 339 void RenderViewTest::Reload(const GURL& url) { |
| 348 FrameMsg_Navigate_Params params; | 340 FrameMsg_Navigate_Params params; |
| 349 params.common_params.url = url; | 341 params.common_params.url = url; |
| 350 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 342 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; |
| 351 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 343 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 352 impl->GetMainRenderFrame()->OnNavigate(params); | 344 impl->GetMainRenderFrame()->OnNavigate(params); |
| 353 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); | 345 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); |
| 354 } | 346 } |
| 355 | 347 |
| 356 uint32 RenderViewTest::GetNavigationIPCType() { | 348 uint32 RenderViewTest::GetNavigationIPCType() { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 | 405 |
| 414 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { | 406 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { |
| 415 return make_scoped_ptr(new ViewMsg_Resize_Params()); | 407 return make_scoped_ptr(new ViewMsg_Resize_Params()); |
| 416 } | 408 } |
| 417 | 409 |
| 418 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 410 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
| 419 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 411 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 420 | 412 |
| 421 int history_list_length = impl->historyBackListCount() + | 413 int history_list_length = impl->historyBackListCount() + |
| 422 impl->historyForwardListCount() + 1; | 414 impl->historyForwardListCount() + 1; |
| 423 int pending_offset = offset + impl->history_list_offset(); | 415 int pending_offset = offset + impl->history_list_offset_; |
| 424 | 416 |
| 425 FrameMsg_Navigate_Params navigate_params; | 417 FrameMsg_Navigate_Params navigate_params; |
| 426 navigate_params.common_params.navigation_type = | 418 navigate_params.common_params.navigation_type = |
| 427 FrameMsg_Navigate_Type::NORMAL; | 419 FrameMsg_Navigate_Type::NORMAL; |
| 428 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 420 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
| 429 navigate_params.current_history_list_length = history_list_length; | 421 navigate_params.current_history_list_length = history_list_length; |
| 430 navigate_params.current_history_list_offset = impl->history_list_offset(); | 422 navigate_params.current_history_list_offset = impl->history_list_offset_; |
| 431 navigate_params.pending_history_list_offset = pending_offset; | 423 navigate_params.pending_history_list_offset = pending_offset; |
| 432 navigate_params.page_id = impl->page_id_ + offset; | 424 navigate_params.page_id = impl->page_id_ + offset; |
| 433 navigate_params.commit_params.page_state = state; | 425 navigate_params.commit_params.page_state = state; |
| 434 navigate_params.request_time = base::Time::Now(); | 426 navigate_params.request_time = base::Time::Now(); |
| 435 | 427 |
| 436 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 428 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), |
| 437 navigate_params); | 429 navigate_params); |
| 438 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 430 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); |
| 439 | 431 |
| 440 // The load actually happens asynchronously, so we pump messages to process | 432 // The load actually happens asynchronously, so we pump messages to process |
| 441 // the pending continuation. | 433 // the pending continuation. |
| 442 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 434 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
| 443 } | 435 } |
| 444 | 436 |
| 445 } // namespace content | 437 } // namespace content |
| OLD | NEW |