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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void RenderViewTest::ClearHistory() { | 331 void RenderViewTest::ClearHistory() { |
332 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 332 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
333 impl->page_id_ = -1; | 333 impl->page_id_ = -1; |
334 impl->history_list_offset_ = -1; | 334 impl->history_list_offset_ = -1; |
335 impl->history_list_length_ = 0; | 335 impl->history_list_length_ = 0; |
336 impl->history_page_ids_.clear(); | 336 impl->history_page_ids_.clear(); |
337 } | 337 } |
338 | 338 |
339 void RenderViewTest::Reload(const GURL& url) { | 339 void RenderViewTest::Reload(const GURL& url) { |
340 FrameMsg_Navigate_Params params; | 340 FrameMsg_Navigate_Params params; |
341 params.url = url; | 341 params.common_params.url = url; |
342 params.navigation_type = FrameMsg_Navigate_Type::RELOAD; | 342 params.common_params.navigation_type = FrameMsg_Navigate_Type::RELOAD; |
343 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 343 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
344 impl->GetMainRenderFrame()->OnNavigate(params); | 344 impl->GetMainRenderFrame()->OnNavigate(params); |
345 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); | 345 FrameLoadWaiter(impl->GetMainRenderFrame()).Wait(); |
346 } | 346 } |
347 | 347 |
348 uint32 RenderViewTest::GetNavigationIPCType() { | 348 uint32 RenderViewTest::GetNavigationIPCType() { |
349 return FrameHostMsg_DidCommitProvisionalLoad::ID; | 349 return FrameHostMsg_DidCommitProvisionalLoad::ID; |
350 } | 350 } |
351 | 351 |
352 void RenderViewTest::Resize(gfx::Size new_size, | 352 void RenderViewTest::Resize(gfx::Size new_size, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 | 405 |
406 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 406 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
407 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 407 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
408 | 408 |
409 int history_list_length = impl->historyBackListCount() + | 409 int history_list_length = impl->historyBackListCount() + |
410 impl->historyForwardListCount() + 1; | 410 impl->historyForwardListCount() + 1; |
411 int pending_offset = offset + impl->history_list_offset(); | 411 int pending_offset = offset + impl->history_list_offset(); |
412 | 412 |
413 FrameMsg_Navigate_Params navigate_params; | 413 FrameMsg_Navigate_Params navigate_params; |
414 navigate_params.navigation_type = FrameMsg_Navigate_Type::NORMAL; | 414 navigate_params.common_params.navigation_type = |
415 navigate_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 415 FrameMsg_Navigate_Type::NORMAL; |
| 416 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
416 navigate_params.current_history_list_length = history_list_length; | 417 navigate_params.current_history_list_length = history_list_length; |
417 navigate_params.current_history_list_offset = impl->history_list_offset(); | 418 navigate_params.current_history_list_offset = impl->history_list_offset(); |
418 navigate_params.pending_history_list_offset = pending_offset; | 419 navigate_params.pending_history_list_offset = pending_offset; |
419 navigate_params.page_id = impl->page_id_ + offset; | 420 navigate_params.page_id = impl->page_id_ + offset; |
420 navigate_params.page_state = state; | 421 navigate_params.commit_params.page_state = state; |
421 navigate_params.request_time = base::Time::Now(); | 422 navigate_params.request_time = base::Time::Now(); |
422 | 423 |
423 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 424 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), |
424 navigate_params); | 425 navigate_params); |
425 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 426 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); |
426 | 427 |
427 // The load actually happens asynchronously, so we pump messages to process | 428 // The load actually happens asynchronously, so we pump messages to process |
428 // the pending continuation. | 429 // the pending continuation. |
429 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 430 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
430 } | 431 } |
431 | 432 |
432 } // namespace content | 433 } // namespace content |
OLD | NEW |