| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cctype> | 9 #include <cctype> |
| 10 | 10 |
| 11 #include "base/location.h" | 11 #include "base/location.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "content/app/mojo/mojo_init.h" | 17 #include "content/app/mojo/mojo_init.h" |
| 18 #include "content/common/dom_storage/dom_storage_types.h" | 18 #include "content/common/dom_storage/dom_storage_types.h" |
| 19 #include "content/common/frame_messages.h" | 19 #include "content/common/frame_messages.h" |
| 20 #include "content/common/input_messages.h" | 20 #include "content/common/input_messages.h" |
| 21 #include "content/common/renderer.mojom.h" | 21 #include "content/common/renderer.mojom.h" |
| 22 #include "content/common/resize_params.h" | 22 #include "content/common/resize_params.h" |
| 23 #include "content/common/site_isolation_policy.h" | 23 #include "content/common/site_isolation_policy.h" |
| 24 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
| 25 #include "content/public/browser/content_browser_client.h" | 25 #include "content/public/browser/content_browser_client.h" |
| 26 #include "content/public/browser/native_web_keyboard_event.h" | 26 #include "content/public/browser/native_web_keyboard_event.h" |
| 27 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
| 28 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
| 29 #include "content/public/common/previews_state.h" |
| 29 #include "content/public/common/renderer_preferences.h" | 30 #include "content/public/common/renderer_preferences.h" |
| 30 #include "content/public/renderer/content_renderer_client.h" | 31 #include "content/public/renderer/content_renderer_client.h" |
| 31 #include "content/public/test/frame_load_waiter.h" | 32 #include "content/public/test/frame_load_waiter.h" |
| 32 #include "content/renderer/history_controller.h" | 33 #include "content/renderer/history_controller.h" |
| 33 #include "content/renderer/history_serialization.h" | 34 #include "content/renderer/history_serialization.h" |
| 34 #include "content/renderer/render_thread_impl.h" | 35 #include "content/renderer/render_thread_impl.h" |
| 35 #include "content/renderer/render_view_impl.h" | 36 #include "content/renderer/render_view_impl.h" |
| 36 #include "content/renderer/renderer_blink_platform_impl.h" | 37 #include "content/renderer/renderer_blink_platform_impl.h" |
| 37 #include "content/renderer/renderer_main_platform_delegate.h" | 38 #include "content/renderer/renderer_main_platform_delegate.h" |
| 38 #include "content/test/fake_compositor_dependencies.h" | 39 #include "content/test/fake_compositor_dependencies.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 516 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
| 516 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 517 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 517 impl->focusedNodeChanged(blink::WebNode(), node); | 518 impl->focusedNodeChanged(blink::WebNode(), node); |
| 518 } | 519 } |
| 519 | 520 |
| 520 void RenderViewTest::Reload(const GURL& url) { | 521 void RenderViewTest::Reload(const GURL& url) { |
| 521 CommonNavigationParams common_params( | 522 CommonNavigationParams common_params( |
| 522 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, | 523 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, |
| 523 true, false, base::TimeTicks(), | 524 true, false, base::TimeTicks(), |
| 524 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 525 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
| 525 LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); | 526 PREVIEWS_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); |
| 526 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 527 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 527 TestRenderFrame* frame = | 528 TestRenderFrame* frame = |
| 528 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 529 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 529 frame->Navigate(common_params, StartNavigationParams(), | 530 frame->Navigate(common_params, StartNavigationParams(), |
| 530 RequestNavigationParams()); | 531 RequestNavigationParams()); |
| 531 FrameLoadWaiter(frame).Wait(); | 532 FrameLoadWaiter(frame).Wait(); |
| 532 view_->GetWebView()->updateAllLifecyclePhases(); | 533 view_->GetWebView()->updateAllLifecyclePhases(); |
| 533 } | 534 } |
| 534 | 535 |
| 535 uint32_t RenderViewTest::GetNavigationIPCType() { | 536 uint32_t RenderViewTest::GetNavigationIPCType() { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 653 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 653 | 654 |
| 654 int history_list_length = impl->historyBackListCount() + | 655 int history_list_length = impl->historyBackListCount() + |
| 655 impl->historyForwardListCount() + 1; | 656 impl->historyForwardListCount() + 1; |
| 656 int pending_offset = offset + impl->history_list_offset_; | 657 int pending_offset = offset + impl->history_list_offset_; |
| 657 | 658 |
| 658 CommonNavigationParams common_params( | 659 CommonNavigationParams common_params( |
| 659 url, Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | 660 url, Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, |
| 660 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | 661 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), |
| 661 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 662 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
| 662 LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); | 663 PREVIEWS_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); |
| 663 RequestNavigationParams request_params; | 664 RequestNavigationParams request_params; |
| 664 request_params.page_state = state; | 665 request_params.page_state = state; |
| 665 request_params.nav_entry_id = pending_offset + 1; | 666 request_params.nav_entry_id = pending_offset + 1; |
| 666 request_params.pending_history_list_offset = pending_offset; | 667 request_params.pending_history_list_offset = pending_offset; |
| 667 request_params.current_history_list_offset = impl->history_list_offset_; | 668 request_params.current_history_list_offset = impl->history_list_offset_; |
| 668 request_params.current_history_list_length = history_list_length; | 669 request_params.current_history_list_length = history_list_length; |
| 669 | 670 |
| 670 TestRenderFrame* frame = | 671 TestRenderFrame* frame = |
| 671 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 672 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 672 frame->Navigate(common_params, StartNavigationParams(), request_params); | 673 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 673 | 674 |
| 674 // The load actually happens asynchronously, so we pump messages to process | 675 // The load actually happens asynchronously, so we pump messages to process |
| 675 // the pending continuation. | 676 // the pending continuation. |
| 676 FrameLoadWaiter(frame).Wait(); | 677 FrameLoadWaiter(frame).Wait(); |
| 677 view_->GetWebView()->updateAllLifecyclePhases(); | 678 view_->GetWebView()->updateAllLifecyclePhases(); |
| 678 } | 679 } |
| 679 | 680 |
| 680 } // namespace content | 681 } // namespace content |
| OLD | NEW |