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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 void RenderViewTest::SetFocused(const blink::WebNode& node) { | 511 void RenderViewTest::SetFocused(const blink::WebNode& node) { |
511 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 512 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
512 impl->focusedNodeChanged(blink::WebNode(), node); | 513 impl->focusedNodeChanged(blink::WebNode(), node); |
513 } | 514 } |
514 | 515 |
515 void RenderViewTest::Reload(const GURL& url) { | 516 void RenderViewTest::Reload(const GURL& url) { |
516 CommonNavigationParams common_params( | 517 CommonNavigationParams common_params( |
517 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, | 518 url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::RELOAD, |
518 true, false, base::TimeTicks(), | 519 true, false, base::TimeTicks(), |
519 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 520 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
520 LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); | 521 PREVIEWS_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); |
521 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 522 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
522 TestRenderFrame* frame = | 523 TestRenderFrame* frame = |
523 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 524 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
524 frame->Navigate(common_params, StartNavigationParams(), | 525 frame->Navigate(common_params, StartNavigationParams(), |
525 RequestNavigationParams()); | 526 RequestNavigationParams()); |
526 FrameLoadWaiter(frame).Wait(); | 527 FrameLoadWaiter(frame).Wait(); |
527 view_->GetWebView()->updateAllLifecyclePhases(); | 528 view_->GetWebView()->updateAllLifecyclePhases(); |
528 } | 529 } |
529 | 530 |
530 uint32_t RenderViewTest::GetNavigationIPCType() { | 531 uint32_t RenderViewTest::GetNavigationIPCType() { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 646 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
646 | 647 |
647 int history_list_length = impl->historyBackListCount() + | 648 int history_list_length = impl->historyBackListCount() + |
648 impl->historyForwardListCount() + 1; | 649 impl->historyForwardListCount() + 1; |
649 int pending_offset = offset + impl->history_list_offset_; | 650 int pending_offset = offset + impl->history_list_offset_; |
650 | 651 |
651 CommonNavigationParams common_params( | 652 CommonNavigationParams common_params( |
652 url, Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, | 653 url, Referrer(), ui::PAGE_TRANSITION_FORWARD_BACK, |
653 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), | 654 FrameMsg_Navigate_Type::NORMAL, true, false, base::TimeTicks(), |
654 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), | 655 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), |
655 LOFI_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); | 656 PREVIEWS_UNSPECIFIED, base::TimeTicks::Now(), "GET", nullptr); |
656 RequestNavigationParams request_params; | 657 RequestNavigationParams request_params; |
657 request_params.page_state = state; | 658 request_params.page_state = state; |
658 request_params.nav_entry_id = pending_offset + 1; | 659 request_params.nav_entry_id = pending_offset + 1; |
659 request_params.pending_history_list_offset = pending_offset; | 660 request_params.pending_history_list_offset = pending_offset; |
660 request_params.current_history_list_offset = impl->history_list_offset_; | 661 request_params.current_history_list_offset = impl->history_list_offset_; |
661 request_params.current_history_list_length = history_list_length; | 662 request_params.current_history_list_length = history_list_length; |
662 | 663 |
663 TestRenderFrame* frame = | 664 TestRenderFrame* frame = |
664 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 665 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
665 frame->Navigate(common_params, StartNavigationParams(), request_params); | 666 frame->Navigate(common_params, StartNavigationParams(), request_params); |
666 | 667 |
667 // The load actually happens asynchronously, so we pump messages to process | 668 // The load actually happens asynchronously, so we pump messages to process |
668 // the pending continuation. | 669 // the pending continuation. |
669 FrameLoadWaiter(frame).Wait(); | 670 FrameLoadWaiter(frame).Wait(); |
670 view_->GetWebView()->updateAllLifecyclePhases(); | 671 view_->GetWebView()->updateAllLifecyclePhases(); |
671 } | 672 } |
672 | 673 |
673 } // namespace content | 674 } // namespace content |
OLD | NEW |