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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 406 |
415 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { | 407 scoped_ptr<ViewMsg_Resize_Params> RenderViewTest::InitialSizeParams() { |
416 return make_scoped_ptr(new ViewMsg_Resize_Params()); | 408 return make_scoped_ptr(new ViewMsg_Resize_Params()); |
417 } | 409 } |
418 | 410 |
419 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 411 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
420 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 412 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
421 | 413 |
422 int history_list_length = impl->historyBackListCount() + | 414 int history_list_length = impl->historyBackListCount() + |
423 impl->historyForwardListCount() + 1; | 415 impl->historyForwardListCount() + 1; |
424 int pending_offset = offset + impl->history_list_offset(); | 416 int pending_offset = offset + impl->history_list_offset_; |
425 | 417 |
426 FrameMsg_Navigate_Params navigate_params; | 418 FrameMsg_Navigate_Params navigate_params; |
427 navigate_params.common_params.navigation_type = | 419 navigate_params.common_params.navigation_type = |
428 FrameMsg_Navigate_Type::NORMAL; | 420 FrameMsg_Navigate_Type::NORMAL; |
429 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; | 421 navigate_params.common_params.transition = ui::PAGE_TRANSITION_FORWARD_BACK; |
430 navigate_params.current_history_list_length = history_list_length; | 422 navigate_params.current_history_list_length = history_list_length; |
431 navigate_params.current_history_list_offset = impl->history_list_offset(); | 423 navigate_params.current_history_list_offset = impl->history_list_offset_; |
432 navigate_params.pending_history_list_offset = pending_offset; | 424 navigate_params.pending_history_list_offset = pending_offset; |
433 navigate_params.page_id = impl->page_id_ + offset; | 425 navigate_params.page_id = impl->page_id_ + offset; |
434 navigate_params.commit_params.page_state = state; | 426 navigate_params.commit_params.page_state = state; |
435 navigate_params.request_time = base::Time::Now(); | 427 navigate_params.request_time = base::Time::Now(); |
436 | 428 |
437 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), | 429 FrameMsg_Navigate navigate_message(impl->GetMainRenderFrame()->GetRoutingID(), |
438 navigate_params); | 430 navigate_params); |
439 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); | 431 impl->GetMainRenderFrame()->OnMessageReceived(navigate_message); |
440 | 432 |
441 // The load actually happens asynchronously, so we pump messages to process | 433 // The load actually happens asynchronously, so we pump messages to process |
442 // the pending continuation. | 434 // the pending continuation. |
443 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); | 435 FrameLoadWaiter(view_->GetMainRenderFrame()).Wait(); |
444 } | 436 } |
445 | 437 |
446 } // namespace content | 438 } // namespace content |
OLD | NEW |