OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <tuple> | 9 #include <tuple> |
10 #include <utility> | 10 #include <utility> |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 const NavigationEntryImpl& entry) { | 427 const NavigationEntryImpl& entry) { |
428 // Tests currently only navigate using main frame FrameNavigationEntries. | 428 // Tests currently only navigate using main frame FrameNavigationEntries. |
429 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); | 429 FrameNavigationEntry* frame_entry = entry.root_node()->frame_entry.get(); |
430 if (IsBrowserSideNavigationEnabled()) { | 430 if (IsBrowserSideNavigationEnabled()) { |
431 NavigationControllerImpl* controller = | 431 NavigationControllerImpl* controller = |
432 static_cast<NavigationControllerImpl*>(manager->current_frame_host() | 432 static_cast<NavigationControllerImpl*>(manager->current_frame_host() |
433 ->frame_tree_node() | 433 ->frame_tree_node() |
434 ->navigator() | 434 ->navigator() |
435 ->GetController()); | 435 ->GetController()); |
436 FrameMsg_Navigate_Type::Value navigate_type = | 436 FrameMsg_Navigate_Type::Value navigate_type = |
437 entry.restore_type() == NavigationEntryImpl::RESTORE_NONE | 437 entry.restore_type() == RestoreType::NONE |
438 ? FrameMsg_Navigate_Type::NORMAL | 438 ? FrameMsg_Navigate_Type::NORMAL |
439 : FrameMsg_Navigate_Type::RESTORE; | 439 : FrameMsg_Navigate_Type::RESTORE; |
440 std::unique_ptr<NavigationRequest> navigation_request = | 440 std::unique_ptr<NavigationRequest> navigation_request = |
441 NavigationRequest::CreateBrowserInitiated( | 441 NavigationRequest::CreateBrowserInitiated( |
442 manager->frame_tree_node_, frame_entry->url(), | 442 manager->frame_tree_node_, frame_entry->url(), |
443 frame_entry->referrer(), *frame_entry, entry, navigate_type, | 443 frame_entry->referrer(), *frame_entry, entry, navigate_type, |
444 LOFI_UNSPECIFIED, false, false, base::TimeTicks::Now(), | 444 LOFI_UNSPECIFIED, false, false, base::TimeTicks::Now(), |
445 controller); | 445 controller); |
446 | 446 |
447 // Simulates request creation that triggers the 1st internal call to | 447 // Simulates request creation that triggers the 1st internal call to |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2529 NavigationControllerImpl& controller = web_contents->GetController(); | 2529 NavigationControllerImpl& controller = web_contents->GetController(); |
2530 | 2530 |
2531 // Setup a restored entry. | 2531 // Setup a restored entry. |
2532 std::vector<std::unique_ptr<NavigationEntry>> entries; | 2532 std::vector<std::unique_ptr<NavigationEntry>> entries; |
2533 std::unique_ptr<NavigationEntry> new_entry = | 2533 std::unique_ptr<NavigationEntry> new_entry = |
2534 NavigationControllerImpl::CreateNavigationEntry( | 2534 NavigationControllerImpl::CreateNavigationEntry( |
2535 kInitUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, false, std::string(), | 2535 kInitUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, false, std::string(), |
2536 browser_context()); | 2536 browser_context()); |
2537 new_entry->SetPageID(0); | 2537 new_entry->SetPageID(0); |
2538 entries.push_back(std::move(new_entry)); | 2538 entries.push_back(std::move(new_entry)); |
2539 controller.Restore( | 2539 controller.Restore(0, RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries); |
2540 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); | |
2541 ASSERT_EQ(0u, entries.size()); | 2540 ASSERT_EQ(0u, entries.size()); |
2542 ASSERT_EQ(1, controller.GetEntryCount()); | 2541 ASSERT_EQ(1, controller.GetEntryCount()); |
2543 | 2542 |
2544 RenderFrameHostImpl* initial_host = manager->current_frame_host(); | 2543 RenderFrameHostImpl* initial_host = manager->current_frame_host(); |
2545 ASSERT_TRUE(initial_host); | 2544 ASSERT_TRUE(initial_host); |
2546 EXPECT_FALSE(initial_host->IsRenderFrameLive()); | 2545 EXPECT_FALSE(initial_host->IsRenderFrameLive()); |
2547 EXPECT_FALSE(initial_host->web_ui()); | 2546 EXPECT_FALSE(initial_host->web_ui()); |
2548 | 2547 |
2549 // Navigation request to an entry from a previous browsing session. | 2548 // Navigation request to an entry from a previous browsing session. |
2550 NavigationEntryImpl entry(nullptr /* instance */, 0 /* page_id */, kInitUrl, | 2549 NavigationEntryImpl entry(nullptr /* instance */, 0 /* page_id */, kInitUrl, |
2551 Referrer(), base::string16() /* title */, | 2550 Referrer(), base::string16() /* title */, |
2552 ui::PAGE_TRANSITION_RELOAD, | 2551 ui::PAGE_TRANSITION_RELOAD, |
2553 false /* is_renderer_init */); | 2552 false /* is_renderer_init */); |
2554 entry.set_restore_type( | 2553 entry.set_restore_type(RestoreType::LAST_SESSION_EXITED_CLEANLY); |
2555 NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY); | |
2556 NavigateToEntry(manager, entry); | 2554 NavigateToEntry(manager, entry); |
2557 | 2555 |
2558 // As the initial renderer was not live, the new RenderFrameHost should be | 2556 // As the initial renderer was not live, the new RenderFrameHost should be |
2559 // made immediately active at request time. | 2557 // made immediately active at request time. |
2560 EXPECT_FALSE(GetPendingFrameHost(manager)); | 2558 EXPECT_FALSE(GetPendingFrameHost(manager)); |
2561 TestRenderFrameHost* current_host = | 2559 TestRenderFrameHost* current_host = |
2562 static_cast<TestRenderFrameHost*>(manager->current_frame_host()); | 2560 static_cast<TestRenderFrameHost*>(manager->current_frame_host()); |
2563 ASSERT_TRUE(current_host); | 2561 ASSERT_TRUE(current_host); |
2564 EXPECT_EQ(current_host, initial_host); | 2562 EXPECT_EQ(current_host, initial_host); |
2565 EXPECT_TRUE(current_host->IsRenderFrameLive()); | 2563 EXPECT_TRUE(current_host->IsRenderFrameLive()); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3094 child_host->SendNavigateWithParams(&commit_params); | 3092 child_host->SendNavigateWithParams(&commit_params); |
3095 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC( | 3093 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC( |
3096 main_test_rfh(), blink::kLeaveInsecureRequestsAlone, | 3094 main_test_rfh(), blink::kLeaveInsecureRequestsAlone, |
3097 proxy_to_parent->GetRoutingID())); | 3095 proxy_to_parent->GetRoutingID())); |
3098 EXPECT_EQ( | 3096 EXPECT_EQ( |
3099 blink::kLeaveInsecureRequestsAlone, | 3097 blink::kLeaveInsecureRequestsAlone, |
3100 root->child_at(0)->current_replication_state().insecure_request_policy); | 3098 root->child_at(0)->current_replication_state().insecure_request_policy); |
3101 } | 3099 } |
3102 | 3100 |
3103 } // namespace content | 3101 } // namespace content |
OLD | NEW |