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/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 // Ensure main page navigation to same url respects the was_within_same_page | 2624 // Ensure main page navigation to same url respects the was_within_same_page |
2625 // hint provided in the params. | 2625 // hint provided in the params. |
2626 FrameHostMsg_DidCommitProvisionalLoad_Params self_params; | 2626 FrameHostMsg_DidCommitProvisionalLoad_Params self_params; |
2627 self_params.nav_entry_id = 0; | 2627 self_params.nav_entry_id = 0; |
2628 self_params.did_create_new_entry = false; | 2628 self_params.did_create_new_entry = false; |
2629 self_params.url = url1; | 2629 self_params.url = url1; |
2630 self_params.transition = ui::PAGE_TRANSITION_LINK; | 2630 self_params.transition = ui::PAGE_TRANSITION_LINK; |
2631 self_params.should_update_history = false; | 2631 self_params.should_update_history = false; |
2632 self_params.gesture = NavigationGestureUser; | 2632 self_params.gesture = NavigationGestureUser; |
2633 self_params.method = "GET"; | 2633 self_params.method = "GET"; |
2634 self_params.page_state = PageState::CreateFromURL(url1); | 2634 self_params.item_sequence_number = GenerateSequenceNumber(); |
| 2635 self_params.document_sequence_number = GenerateSequenceNumber(); |
| 2636 self_params.page_state = PageState::CreateForTestingWithSequenceNumbers( |
| 2637 url1, self_params.item_sequence_number, |
| 2638 self_params.document_sequence_number); |
2635 self_params.was_within_same_page = true; | 2639 self_params.was_within_same_page = true; |
2636 | 2640 |
2637 LoadCommittedDetailsObserver observer(contents()); | 2641 LoadCommittedDetailsObserver observer(contents()); |
2638 main_test_rfh()->SendRendererInitiatedNavigationRequest(url1, false); | 2642 main_test_rfh()->SendRendererInitiatedNavigationRequest(url1, false); |
2639 main_test_rfh()->PrepareForCommit(); | 2643 main_test_rfh()->PrepareForCommit(); |
2640 main_test_rfh()->SendNavigateWithParams(&self_params); | 2644 main_test_rfh()->SendNavigateWithParams(&self_params); |
2641 NavigationEntry* entry1 = controller.GetLastCommittedEntry(); | 2645 NavigationEntry* entry1 = controller.GetLastCommittedEntry(); |
2642 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2646 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2643 navigation_entry_committed_counter_ = 0; | 2647 navigation_entry_committed_counter_ = 0; |
2644 EXPECT_TRUE(observer.details().is_in_page); | 2648 EXPECT_TRUE(observer.details().is_in_page); |
2645 EXPECT_TRUE(observer.details().did_replace_entry); | 2649 EXPECT_TRUE(observer.details().did_replace_entry); |
2646 EXPECT_EQ(1, controller.GetEntryCount()); | 2650 EXPECT_EQ(1, controller.GetEntryCount()); |
2647 | 2651 |
2648 // Fragment navigation to a new page. | 2652 // Fragment navigation to a new page. |
2649 const GURL url2("http://foo#a"); | 2653 const GURL url2("http://foo#a"); |
2650 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2654 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
2651 params.nav_entry_id = 0; | 2655 params.nav_entry_id = 0; |
2652 params.did_create_new_entry = true; | 2656 params.did_create_new_entry = true; |
2653 params.url = url2; | 2657 params.url = url2; |
2654 params.transition = ui::PAGE_TRANSITION_LINK; | 2658 params.transition = ui::PAGE_TRANSITION_LINK; |
2655 params.should_update_history = false; | 2659 params.should_update_history = false; |
2656 params.gesture = NavigationGestureUser; | 2660 params.gesture = NavigationGestureUser; |
2657 params.method = "GET"; | 2661 params.method = "GET"; |
2658 params.page_state = PageState::CreateFromURL(url2); | 2662 params.item_sequence_number = GenerateSequenceNumber(); |
| 2663 params.document_sequence_number = self_params.document_sequence_number; |
| 2664 params.page_state = PageState::CreateForTestingWithSequenceNumbers( |
| 2665 url2, params.item_sequence_number, params.document_sequence_number); |
2659 params.was_within_same_page = true; | 2666 params.was_within_same_page = true; |
2660 | 2667 |
2661 // This should generate a new entry. | 2668 // This should generate a new entry. |
2662 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); | |
2663 main_test_rfh()->PrepareForCommit(); | |
2664 main_test_rfh()->SendNavigateWithParams(¶ms); | 2669 main_test_rfh()->SendNavigateWithParams(¶ms); |
2665 NavigationEntry* entry2 = controller.GetLastCommittedEntry(); | 2670 NavigationEntry* entry2 = controller.GetLastCommittedEntry(); |
2666 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2671 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2667 navigation_entry_committed_counter_ = 0; | 2672 navigation_entry_committed_counter_ = 0; |
2668 EXPECT_TRUE(observer.details().is_in_page); | 2673 EXPECT_TRUE(observer.details().is_in_page); |
2669 EXPECT_FALSE(observer.details().did_replace_entry); | 2674 EXPECT_FALSE(observer.details().did_replace_entry); |
2670 EXPECT_EQ(2, controller.GetEntryCount()); | 2675 EXPECT_EQ(2, controller.GetEntryCount()); |
2671 | 2676 |
2672 // Go back one. | 2677 // Go back one. |
2673 FrameHostMsg_DidCommitProvisionalLoad_Params back_params(params); | 2678 FrameHostMsg_DidCommitProvisionalLoad_Params back_params(self_params); |
2674 controller.GoBack(); | 2679 controller.GoBack(); |
2675 back_params.url = url1; | |
2676 back_params.nav_entry_id = entry1->GetUniqueID(); | 2680 back_params.nav_entry_id = entry1->GetUniqueID(); |
2677 back_params.did_create_new_entry = false; | 2681 back_params.did_create_new_entry = false; |
2678 main_test_rfh()->PrepareForCommit(); | |
2679 main_test_rfh()->SendNavigateWithParams(&back_params); | 2682 main_test_rfh()->SendNavigateWithParams(&back_params); |
2680 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2683 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2681 navigation_entry_committed_counter_ = 0; | 2684 navigation_entry_committed_counter_ = 0; |
2682 EXPECT_TRUE(observer.details().is_in_page); | 2685 EXPECT_TRUE(observer.details().is_in_page); |
2683 EXPECT_EQ(2, controller.GetEntryCount()); | 2686 EXPECT_EQ(2, controller.GetEntryCount()); |
2684 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 2687 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
2685 EXPECT_EQ(back_params.url, controller.GetVisibleEntry()->GetURL()); | 2688 EXPECT_EQ(back_params.url, controller.GetVisibleEntry()->GetURL()); |
2686 | 2689 |
2687 // Go forward. | 2690 // Go forward. |
2688 FrameHostMsg_DidCommitProvisionalLoad_Params forward_params(params); | 2691 FrameHostMsg_DidCommitProvisionalLoad_Params forward_params(params); |
2689 controller.GoForward(); | 2692 controller.GoForward(); |
2690 forward_params.url = url2; | |
2691 forward_params.nav_entry_id = entry2->GetUniqueID(); | 2693 forward_params.nav_entry_id = entry2->GetUniqueID(); |
2692 forward_params.did_create_new_entry = false; | 2694 forward_params.did_create_new_entry = false; |
2693 main_test_rfh()->PrepareForCommit(); | |
2694 main_test_rfh()->SendNavigateWithParams(&forward_params); | 2695 main_test_rfh()->SendNavigateWithParams(&forward_params); |
2695 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2696 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2696 navigation_entry_committed_counter_ = 0; | 2697 navigation_entry_committed_counter_ = 0; |
2697 EXPECT_TRUE(observer.details().is_in_page); | 2698 EXPECT_TRUE(observer.details().is_in_page); |
2698 EXPECT_EQ(2, controller.GetEntryCount()); | 2699 EXPECT_EQ(2, controller.GetEntryCount()); |
2699 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); | 2700 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); |
2700 EXPECT_EQ(forward_params.url, | 2701 EXPECT_EQ(forward_params.url, |
2701 controller.GetVisibleEntry()->GetURL()); | 2702 controller.GetVisibleEntry()->GetURL()); |
2702 | 2703 |
2703 // Now go back and forward again. This is to work around a bug where we would | 2704 // Now go back and forward again. This is to work around a bug where we would |
2704 // compare the incoming URL with the last committed entry rather than the | 2705 // compare the incoming URL with the last committed entry rather than the |
2705 // one identified by an existing page ID. This would result in the second URL | 2706 // one identified by an existing page ID. This would result in the second URL |
2706 // losing the reference fragment when you navigate away from it and then back. | 2707 // losing the reference fragment when you navigate away from it and then back. |
2707 controller.GoBack(); | 2708 controller.GoBack(); |
2708 main_test_rfh()->PrepareForCommit(); | |
2709 main_test_rfh()->SendNavigateWithParams(&back_params); | 2709 main_test_rfh()->SendNavigateWithParams(&back_params); |
2710 controller.GoForward(); | 2710 controller.GoForward(); |
2711 main_test_rfh()->PrepareForCommit(); | |
2712 main_test_rfh()->SendNavigateWithParams(&forward_params); | 2711 main_test_rfh()->SendNavigateWithParams(&forward_params); |
2713 EXPECT_EQ(forward_params.url, | 2712 EXPECT_EQ(forward_params.url, |
2714 controller.GetVisibleEntry()->GetURL()); | 2713 controller.GetVisibleEntry()->GetURL()); |
2715 | 2714 |
2716 // Finally, navigate to an unrelated URL to make sure in_page is not sticky. | 2715 // Finally, navigate to an unrelated URL to make sure in_page is not sticky. |
2717 const GURL url3("http://bar"); | 2716 const GURL url3("http://bar"); |
2718 params.nav_entry_id = 0; | 2717 params.nav_entry_id = 0; |
2719 params.did_create_new_entry = true; | 2718 params.did_create_new_entry = true; |
2720 params.url = url3; | 2719 params.url = url3; |
| 2720 params.item_sequence_number = 0; |
| 2721 params.document_sequence_number = 0; |
| 2722 params.page_state = PageState::CreateFromURL(url3); |
| 2723 params.was_within_same_page = false; |
2721 navigation_entry_committed_counter_ = 0; | 2724 navigation_entry_committed_counter_ = 0; |
2722 main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, false); | 2725 main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, false); |
2723 main_test_rfh()->PrepareForCommit(); | 2726 main_test_rfh()->PrepareForCommit(); |
2724 main_test_rfh()->SendNavigateWithParams(¶ms); | 2727 main_test_rfh()->SendNavigateWithParams(¶ms); |
2725 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2728 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2726 navigation_entry_committed_counter_ = 0; | 2729 navigation_entry_committed_counter_ = 0; |
2727 EXPECT_FALSE(observer.details().is_in_page); | 2730 EXPECT_FALSE(observer.details().is_in_page); |
2728 EXPECT_EQ(3, controller.GetEntryCount()); | 2731 EXPECT_EQ(3, controller.GetEntryCount()); |
2729 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); | 2732 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); |
2730 } | 2733 } |
(...skipping 17 matching lines...) Expand all Loading... |
2748 params.url = url2; | 2751 params.url = url2; |
2749 params.transition = ui::PAGE_TRANSITION_LINK; | 2752 params.transition = ui::PAGE_TRANSITION_LINK; |
2750 params.should_update_history = false; | 2753 params.should_update_history = false; |
2751 params.gesture = NavigationGestureUser; | 2754 params.gesture = NavigationGestureUser; |
2752 params.method = "GET"; | 2755 params.method = "GET"; |
2753 params.page_state = PageState::CreateFromURL(url2); | 2756 params.page_state = PageState::CreateFromURL(url2); |
2754 params.was_within_same_page = true; | 2757 params.was_within_same_page = true; |
2755 | 2758 |
2756 // This should NOT generate a new entry, nor prune the list. | 2759 // This should NOT generate a new entry, nor prune the list. |
2757 LoadCommittedDetailsObserver observer(contents()); | 2760 LoadCommittedDetailsObserver observer(contents()); |
2758 main_test_rfh()->SendRendererInitiatedNavigationRequest(url2, false); | |
2759 main_test_rfh()->PrepareForCommit(); | |
2760 main_test_rfh()->SendNavigateWithParams(¶ms); | 2761 main_test_rfh()->SendNavigateWithParams(¶ms); |
2761 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2762 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2762 navigation_entry_committed_counter_ = 0; | 2763 navigation_entry_committed_counter_ = 0; |
2763 EXPECT_TRUE(observer.details().is_in_page); | 2764 EXPECT_TRUE(observer.details().is_in_page); |
2764 EXPECT_TRUE(observer.details().did_replace_entry); | 2765 EXPECT_TRUE(observer.details().did_replace_entry); |
2765 EXPECT_EQ(1, controller.GetEntryCount()); | 2766 EXPECT_EQ(1, controller.GetEntryCount()); |
2766 } | 2767 } |
2767 | 2768 |
2768 // Tests for http://crbug.com/40395 | 2769 // Tests for http://crbug.com/40395 |
2769 // Simulates this: | 2770 // Simulates this: |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2802 params.transition = ui::PAGE_TRANSITION_LINK; | 2803 params.transition = ui::PAGE_TRANSITION_LINK; |
2803 params.redirects.push_back(url); | 2804 params.redirects.push_back(url); |
2804 params.should_update_history = true; | 2805 params.should_update_history = true; |
2805 params.gesture = NavigationGestureUnknown; | 2806 params.gesture = NavigationGestureUnknown; |
2806 params.method = "GET"; | 2807 params.method = "GET"; |
2807 params.page_state = PageState::CreateFromURL(url); | 2808 params.page_state = PageState::CreateFromURL(url); |
2808 params.was_within_same_page = true; | 2809 params.was_within_same_page = true; |
2809 | 2810 |
2810 // This should NOT generate a new entry, nor prune the list. | 2811 // This should NOT generate a new entry, nor prune the list. |
2811 LoadCommittedDetailsObserver observer(contents()); | 2812 LoadCommittedDetailsObserver observer(contents()); |
2812 main_test_rfh()->SendRendererInitiatedNavigationRequest(url, false); | |
2813 main_test_rfh()->PrepareForCommit(); | |
2814 main_test_rfh()->SendNavigateWithParams(¶ms); | 2813 main_test_rfh()->SendNavigateWithParams(¶ms); |
2815 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2814 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
2816 navigation_entry_committed_counter_ = 0; | 2815 navigation_entry_committed_counter_ = 0; |
2817 EXPECT_TRUE(observer.details().is_in_page); | 2816 EXPECT_TRUE(observer.details().is_in_page); |
2818 EXPECT_TRUE(observer.details().did_replace_entry); | 2817 EXPECT_TRUE(observer.details().did_replace_entry); |
2819 EXPECT_EQ(2, controller.GetEntryCount()); | 2818 EXPECT_EQ(2, controller.GetEntryCount()); |
2820 } | 2819 } |
2821 | 2820 |
2822 // Perform a client redirect to a new page. | 2821 // Perform a client redirect to a new page. |
2823 { | 2822 { |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 main_test_rfh()->PrepareForCommit(); | 3400 main_test_rfh()->PrepareForCommit(); |
3402 main_test_rfh()->SendNavigate(entry_id, false, url3); | 3401 main_test_rfh()->SendNavigate(entry_id, false, url3); |
3403 EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); | 3402 EXPECT_EQ(url3, controller.GetVisibleEntry()->GetURL()); |
3404 | 3403 |
3405 // Add a transient and do an in-page navigation, replacing the current entry. | 3404 // Add a transient and do an in-page navigation, replacing the current entry. |
3406 transient_entry.reset(new NavigationEntryImpl); | 3405 transient_entry.reset(new NavigationEntryImpl); |
3407 transient_entry->SetURL(transient_url); | 3406 transient_entry->SetURL(transient_url); |
3408 controller.SetTransientEntry(std::move(transient_entry)); | 3407 controller.SetTransientEntry(std::move(transient_entry)); |
3409 EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); | 3408 EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); |
3410 | 3409 |
3411 main_test_rfh()->SendRendererInitiatedNavigationRequest(url3_ref, false); | |
3412 main_test_rfh()->PrepareForCommit(); | |
3413 main_test_rfh()->SendNavigate(0, false, url3_ref); | 3410 main_test_rfh()->SendNavigate(0, false, url3_ref); |
3414 // Transient entry should be gone. | 3411 // Transient entry should be gone. |
3415 EXPECT_FALSE(controller.GetTransientEntry()); | 3412 EXPECT_FALSE(controller.GetTransientEntry()); |
3416 EXPECT_EQ(url3_ref, controller.GetVisibleEntry()->GetURL()); | 3413 EXPECT_EQ(url3_ref, controller.GetVisibleEntry()->GetURL()); |
3417 | 3414 |
3418 // Ensure the URLs are correct. | 3415 // Ensure the URLs are correct. |
3419 EXPECT_EQ(controller.GetEntryCount(), 5); | 3416 EXPECT_EQ(controller.GetEntryCount(), 5); |
3420 EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0); | 3417 EXPECT_EQ(controller.GetEntryAtIndex(0)->GetURL(), url0); |
3421 EXPECT_EQ(controller.GetEntryAtIndex(1)->GetURL(), url1); | 3418 EXPECT_EQ(controller.GetEntryAtIndex(1)->GetURL(), url1); |
3422 EXPECT_EQ(controller.GetEntryAtIndex(2)->GetURL(), url2); | 3419 EXPECT_EQ(controller.GetEntryAtIndex(2)->GetURL(), url2); |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4957 controller().GetLastCommittedEntry()->GetFavicon() = favicon; | 4954 controller().GetLastCommittedEntry()->GetFavicon() = favicon; |
4958 | 4955 |
4959 // history.pushState() is called. | 4956 // history.pushState() is called. |
4960 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 4957 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
4961 GURL kUrl2("http://foo#foo"); | 4958 GURL kUrl2("http://foo#foo"); |
4962 params.nav_entry_id = 0; | 4959 params.nav_entry_id = 0; |
4963 params.did_create_new_entry = true; | 4960 params.did_create_new_entry = true; |
4964 params.url = kUrl2; | 4961 params.url = kUrl2; |
4965 params.page_state = PageState::CreateFromURL(kUrl2); | 4962 params.page_state = PageState::CreateFromURL(kUrl2); |
4966 params.was_within_same_page = true; | 4963 params.was_within_same_page = true; |
4967 main_test_rfh()->SendRendererInitiatedNavigationRequest(kUrl2, false); | |
4968 main_test_rfh()->PrepareForCommit(); | |
4969 main_test_rfh()->SendNavigateWithParams(¶ms); | 4964 main_test_rfh()->SendNavigateWithParams(¶ms); |
4970 | 4965 |
4971 // The title should immediately be visible on the new NavigationEntry. | 4966 // The title should immediately be visible on the new NavigationEntry. |
4972 base::string16 new_title = | 4967 base::string16 new_title = |
4973 controller().GetLastCommittedEntry()->GetTitleForDisplay(); | 4968 controller().GetLastCommittedEntry()->GetTitleForDisplay(); |
4974 EXPECT_EQ(title, new_title); | 4969 EXPECT_EQ(title, new_title); |
4975 FaviconStatus new_favicon = | 4970 FaviconStatus new_favicon = |
4976 controller().GetLastCommittedEntry()->GetFavicon(); | 4971 controller().GetLastCommittedEntry()->GetFavicon(); |
4977 EXPECT_EQ(favicon.valid, new_favicon.valid); | 4972 EXPECT_EQ(favicon.valid, new_favicon.valid); |
4978 EXPECT_EQ(favicon.url, new_favicon.url); | 4973 EXPECT_EQ(favicon.url, new_favicon.url); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5054 GURL replace_url("http://foo#foo"); | 5049 GURL replace_url("http://foo#foo"); |
5055 params.nav_entry_id = 0; | 5050 params.nav_entry_id = 0; |
5056 params.did_create_new_entry = false; | 5051 params.did_create_new_entry = false; |
5057 params.url = replace_url; | 5052 params.url = replace_url; |
5058 params.transition = ui::PAGE_TRANSITION_LINK; | 5053 params.transition = ui::PAGE_TRANSITION_LINK; |
5059 params.gesture = NavigationGestureUser; | 5054 params.gesture = NavigationGestureUser; |
5060 params.page_state = PageState::CreateFromURL(replace_url); | 5055 params.page_state = PageState::CreateFromURL(replace_url); |
5061 params.was_within_same_page = true; | 5056 params.was_within_same_page = true; |
5062 params.method = "GET"; | 5057 params.method = "GET"; |
5063 params.post_id = -1; | 5058 params.post_id = -1; |
5064 main_test_rfh()->SendRendererInitiatedNavigationRequest(replace_url, false); | |
5065 main_test_rfh()->PrepareForCommit(); | |
5066 contents()->GetMainFrame()->SendNavigateWithParams(¶ms); | 5059 contents()->GetMainFrame()->SendNavigateWithParams(¶ms); |
5067 | 5060 |
5068 // Now reload. replaceState overrides the POST, so we should not show a | 5061 // Now reload. replaceState overrides the POST, so we should not show a |
5069 // repost warning dialog. | 5062 // repost warning dialog. |
5070 controller_impl().Reload(ReloadType::NORMAL, true); | 5063 controller_impl().Reload(ReloadType::NORMAL, true); |
5071 EXPECT_EQ(0, delegate->repost_form_warning_count()); | 5064 EXPECT_EQ(0, delegate->repost_form_warning_count()); |
5072 } | 5065 } |
5073 | 5066 |
5074 TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { | 5067 TEST_F(NavigationControllerTest, UnreachableURLGivesErrorPage) { |
5075 GURL url("http://foo"); | 5068 GURL url("http://foo"); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 controller_impl().GetLastCommittedEntry()->GetPageType()); | 5118 controller_impl().GetLastCommittedEntry()->GetPageType()); |
5126 EXPECT_EQ(NAVIGATION_TYPE_SAME_PAGE, observer.details().type); | 5119 EXPECT_EQ(NAVIGATION_TYPE_SAME_PAGE, observer.details().type); |
5127 } | 5120 } |
5128 | 5121 |
5129 // Navigate in page. | 5122 // Navigate in page. |
5130 params.url = GURL("http://foo#foo"); | 5123 params.url = GURL("http://foo#foo"); |
5131 params.transition = ui::PAGE_TRANSITION_LINK; | 5124 params.transition = ui::PAGE_TRANSITION_LINK; |
5132 params.was_within_same_page = true; | 5125 params.was_within_same_page = true; |
5133 { | 5126 { |
5134 LoadCommittedDetailsObserver observer(contents()); | 5127 LoadCommittedDetailsObserver observer(contents()); |
5135 main_test_rfh()->SendRendererInitiatedNavigationRequest(params.url, false); | |
5136 main_test_rfh()->PrepareForCommit(); | |
5137 main_test_rfh()->SendNavigateWithParams(¶ms); | 5128 main_test_rfh()->SendNavigateWithParams(¶ms); |
5138 EXPECT_EQ(PAGE_TYPE_ERROR, | 5129 EXPECT_EQ(PAGE_TYPE_ERROR, |
5139 controller_impl().GetLastCommittedEntry()->GetPageType()); | 5130 controller_impl().GetLastCommittedEntry()->GetPageType()); |
5140 EXPECT_TRUE(observer.details().is_in_page); | 5131 EXPECT_TRUE(observer.details().is_in_page); |
5141 } | 5132 } |
5142 } | 5133 } |
5143 | 5134 |
5144 // Tests that if a stale navigation comes back from the renderer, it is properly | 5135 // Tests that if a stale navigation comes back from the renderer, it is properly |
5145 // resurrected. | 5136 // resurrected. |
5146 TEST_F(NavigationControllerTest, StaleNavigationsResurrected) { | 5137 TEST_F(NavigationControllerTest, StaleNavigationsResurrected) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5279 main_test_rfh()->SimulateNavigationStart(url_1); | 5270 main_test_rfh()->SimulateNavigationStart(url_1); |
5280 EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL()); | 5271 EXPECT_EQ(url_1, controller.GetVisibleEntry()->GetURL()); |
5281 EXPECT_EQ(ReloadType::NONE, last_reload_type_); | 5272 EXPECT_EQ(ReloadType::NONE, last_reload_type_); |
5282 | 5273 |
5283 main_test_rfh()->SimulateNavigationCommit(url_2); | 5274 main_test_rfh()->SimulateNavigationCommit(url_2); |
5284 main_test_rfh()->SimulateNavigationCommit(url_1); | 5275 main_test_rfh()->SimulateNavigationCommit(url_1); |
5285 main_test_rfh()->SimulateNavigationCommit(url_1); | 5276 main_test_rfh()->SimulateNavigationCommit(url_1); |
5286 } | 5277 } |
5287 | 5278 |
5288 } // namespace content | 5279 } // namespace content |
OLD | NEW |