| 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 <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "components/scheduler/renderer/renderer_scheduler.h" | 12 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 13 #include "content/app/mojo/mojo_init.h" | 13 #include "content/app/mojo/mojo_init.h" |
| 14 #include "content/common/dom_storage/dom_storage_types.h" | 14 #include "content/common/dom_storage/dom_storage_types.h" |
| 15 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
| 16 #include "content/common/input_messages.h" | 16 #include "content/common/input_messages.h" |
| 17 #include "content/common/service_worker/service_worker_types.h" |
| 17 #include "content/common/view_messages.h" | 18 #include "content/common/view_messages.h" |
| 18 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
| 19 #include "content/public/browser/native_web_keyboard_event.h" | 20 #include "content/public/browser/native_web_keyboard_event.h" |
| 20 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
| 21 #include "content/public/common/renderer_preferences.h" | 22 #include "content/public/common/renderer_preferences.h" |
| 22 #include "content/public/renderer/content_renderer_client.h" | 23 #include "content/public/renderer/content_renderer_client.h" |
| 23 #include "content/public/test/frame_load_waiter.h" | 24 #include "content/public/test/frame_load_waiter.h" |
| 24 #include "content/renderer/history_controller.h" | 25 #include "content/renderer/history_controller.h" |
| 25 #include "content/renderer/history_serialization.h" | 26 #include "content/renderer/history_serialization.h" |
| 26 #include "content/renderer/render_thread_impl.h" | 27 #include "content/renderer/render_thread_impl.h" |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 444 |
| 444 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 445 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
| 445 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 446 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 446 impl->focusedNodeChanged(blink::WebNode(), node); | 447 impl->focusedNodeChanged(blink::WebNode(), node); |
| 447 } | 448 } |
| 448 | 449 |
| 449 void RenderViewTest::Reload(const GURL& url) { | 450 void RenderViewTest::Reload(const GURL& url) { |
| 450 CommonNavigationParams common_params( | 451 CommonNavigationParams common_params( |
| 451 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, | 452 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, |
| 452 true, false, base::TimeTicks(), | 453 true, false, base::TimeTicks(), |
| 453 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); | 454 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
| 455 kInvalidServiceWorkerProviderId); |
| 454 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 456 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 455 TestRenderFrame* frame = | 457 TestRenderFrame* frame = |
| 456 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 458 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 457 frame->Navigate(common_params, StartNavigationParams(), | 459 frame->Navigate(common_params, StartNavigationParams(), |
| 458 RequestNavigationParams()); | 460 RequestNavigationParams()); |
| 459 FrameLoadWaiter(frame).Wait(); | 461 FrameLoadWaiter(frame).Wait(); |
| 460 } | 462 } |
| 461 | 463 |
| 462 uint32 RenderViewTest::GetNavigationIPCType() { | 464 uint32 RenderViewTest::GetNavigationIPCType() { |
| 463 return FrameHostMsg_DidCommitProvisionalLoad::ID; | 465 return FrameHostMsg_DidCommitProvisionalLoad::ID; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 void RenderViewTest::GoToOffset(int offset, const PageState& state) { | 577 void RenderViewTest::GoToOffset(int offset, const PageState& state) { |
| 576 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 578 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 577 | 579 |
| 578 int history_list_length = impl->historyBackListCount() + | 580 int history_list_length = impl->historyBackListCount() + |
| 579 impl->historyForwardListCount() + 1; | 581 impl->historyForwardListCount() + 1; |
| 580 int pending_offset = offset + impl->history_list_offset_; | 582 int pending_offset = offset + impl->history_list_offset_; |
| 581 | 583 |
| 582 CommonNavigationParams common_params( | 584 CommonNavigationParams common_params( |
| 583 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | 585 GURL(), Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, |
| 584 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | 586 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), |
| 585 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL()); | 587 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
| 588 kInvalidServiceWorkerProviderId); |
| 586 RequestNavigationParams request_params; | 589 RequestNavigationParams request_params; |
| 587 request_params.page_state = state; | 590 request_params.page_state = state; |
| 588 request_params.page_id = impl->page_id_ + offset; | 591 request_params.page_id = impl->page_id_ + offset; |
| 589 request_params.nav_entry_id = pending_offset + 1; | 592 request_params.nav_entry_id = pending_offset + 1; |
| 590 request_params.pending_history_list_offset = pending_offset; | 593 request_params.pending_history_list_offset = pending_offset; |
| 591 request_params.current_history_list_offset = impl->history_list_offset_; | 594 request_params.current_history_list_offset = impl->history_list_offset_; |
| 592 request_params.current_history_list_length = history_list_length; | 595 request_params.current_history_list_length = history_list_length; |
| 593 | 596 |
| 594 TestRenderFrame* frame = | 597 TestRenderFrame* frame = |
| 595 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 598 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 596 frame->Navigate(common_params, StartNavigationParams(), request_params); | 599 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 597 | 600 |
| 598 // The load actually happens asynchronously, so we pump messages to process | 601 // The load actually happens asynchronously, so we pump messages to process |
| 599 // the pending continuation. | 602 // the pending continuation. |
| 600 FrameLoadWaiter(frame).Wait(); | 603 FrameLoadWaiter(frame).Wait(); |
| 601 } | 604 } |
| 602 | 605 |
| 603 } // namespace content | 606 } // namespace content |
| OLD | NEW |