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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
858 TEST_F(NavigationControllerTest, LoadURL_AbortDoesntCancelPending) { | 858 TEST_F(NavigationControllerTest, LoadURL_AbortDoesntCancelPending) { |
859 NavigationControllerImpl& controller = controller_impl(); | 859 NavigationControllerImpl& controller = controller_impl(); |
860 TestNotificationTracker notifications; | 860 TestNotificationTracker notifications; |
861 RegisterForAllNavNotifications(¬ifications, &controller); | 861 RegisterForAllNavNotifications(¬ifications, &controller); |
862 | 862 |
863 // Set a WebContentsDelegate to listen for state changes. | 863 // Set a WebContentsDelegate to listen for state changes. |
864 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); | 864 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); |
865 EXPECT_FALSE(contents()->GetDelegate()); | 865 EXPECT_FALSE(contents()->GetDelegate()); |
866 contents()->SetDelegate(delegate.get()); | 866 contents()->SetDelegate(delegate.get()); |
867 | 867 |
868 // Without any navigations, the renderer starts at about:blank. | 868 // Start with a pending new navigation. |
869 const GURL kExistingURL("about:blank"); | |
870 | |
871 // Now make a pending new navigation. | |
872 const GURL kNewURL("http://eh"); | 869 const GURL kNewURL("http://eh"); |
873 controller.LoadURL( | 870 controller.LoadURL( |
874 kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); | 871 kNewURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
875 EXPECT_EQ(0U, notifications.size()); | 872 EXPECT_EQ(0U, notifications.size()); |
876 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 873 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
877 EXPECT_TRUE(controller.GetPendingEntry()); | 874 EXPECT_TRUE(controller.GetPendingEntry()); |
878 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 875 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
879 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 876 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
880 | 877 |
881 // It may abort before committing, if it's a download or due to a stop or | 878 // It may abort before committing, if it's a download or due to a stop or |
882 // a new navigation from the user. | 879 // a new navigation from the user. |
883 ViewHostMsg_DidFailProvisionalLoadWithError_Params params; | 880 ViewHostMsg_DidFailProvisionalLoadWithError_Params params; |
884 params.frame_id = 1; | 881 params.frame_id = 1; |
885 params.is_main_frame = true; | 882 params.is_main_frame = true; |
886 params.error_code = net::ERR_ABORTED; | 883 params.error_code = net::ERR_ABORTED; |
887 params.error_description = string16(); | 884 params.error_description = string16(); |
888 params.url = kNewURL; | 885 params.url = kNewURL; |
889 params.showing_repost_interstitial = false; | 886 params.showing_repost_interstitial = false; |
890 test_rvh()->OnMessageReceived( | 887 test_rvh()->OnMessageReceived( |
891 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 888 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id |
892 params)); | 889 params)); |
893 | 890 |
894 // This should not clear the pending entry or notify of a navigation state | 891 // This should not clear the pending entry or notify of a navigation state |
895 // change, so that we keep displaying kNewURL (until the user clears it). | 892 // change, so that we keep displaying kNewURL (until the user clears it). |
896 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 893 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
897 EXPECT_TRUE(controller.GetPendingEntry()); | 894 EXPECT_TRUE(controller.GetPendingEntry()); |
898 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 895 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
899 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 896 EXPECT_EQ(1, delegate->navigation_state_change_count()); |
| 897 NavigationEntry* pending_entry = controller.GetPendingEntry(); |
| 898 |
| 899 // Ensure that a reload keeps the same pending entry. |
| 900 controller.Reload(true); |
| 901 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
| 902 EXPECT_TRUE(controller.GetPendingEntry()); |
| 903 EXPECT_EQ(pending_entry, controller.GetPendingEntry()); |
| 904 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); |
900 | 905 |
901 contents()->SetDelegate(NULL); | 906 contents()->SetDelegate(NULL); |
902 } | 907 } |
903 | 908 |
904 // Tests that the pending URL is not visible during a renderer-initiated | 909 // Tests that the pending URL is not visible during a renderer-initiated |
905 // redirect and abort. See http://crbug.com/83031. | 910 // redirect and abort. See http://crbug.com/83031. |
906 TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) { | 911 TEST_F(NavigationControllerTest, LoadURL_RedirectAbortDoesntShowPendingURL) { |
907 NavigationControllerImpl& controller = controller_impl(); | 912 NavigationControllerImpl& controller = controller_impl(); |
908 TestNotificationTracker notifications; | 913 TestNotificationTracker notifications; |
909 RegisterForAllNavNotifications(¬ifications, &controller); | 914 RegisterForAllNavNotifications(¬ifications, &controller); |
910 | 915 |
| 916 // First make an existing committed entry. |
| 917 const GURL kExistingURL("http://foo/eh"); |
| 918 controller.LoadURL(kExistingURL, content::Referrer(), |
| 919 content::PAGE_TRANSITION_TYPED, std::string()); |
| 920 test_rvh()->SendNavigate(0, kExistingURL); |
| 921 EXPECT_TRUE(notifications.Check1AndReset( |
| 922 content::NOTIFICATION_NAV_ENTRY_COMMITTED)); |
| 923 |
911 // Set a WebContentsDelegate to listen for state changes. | 924 // Set a WebContentsDelegate to listen for state changes. |
912 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); | 925 scoped_ptr<TestWebContentsDelegate> delegate(new TestWebContentsDelegate()); |
913 EXPECT_FALSE(contents()->GetDelegate()); | 926 EXPECT_FALSE(contents()->GetDelegate()); |
914 contents()->SetDelegate(delegate.get()); | 927 contents()->SetDelegate(delegate.get()); |
915 | 928 |
916 // Without any navigations, the renderer starts at about:blank. | |
917 const GURL kExistingURL("about:blank"); | |
918 | |
919 // Now make a pending new navigation, initiated by the renderer. | 929 // Now make a pending new navigation, initiated by the renderer. |
920 const GURL kNewURL("http://eh"); | 930 const GURL kNewURL("http://foo/bee"); |
921 NavigationController::LoadURLParams load_url_params(kNewURL); | 931 NavigationController::LoadURLParams load_url_params(kNewURL); |
922 load_url_params.transition_type = PAGE_TRANSITION_TYPED; | 932 load_url_params.transition_type = PAGE_TRANSITION_TYPED; |
923 load_url_params.is_renderer_initiated = true; | 933 load_url_params.is_renderer_initiated = true; |
924 controller.LoadURLWithParams(load_url_params); | 934 controller.LoadURLWithParams(load_url_params); |
925 EXPECT_EQ(0U, notifications.size()); | 935 EXPECT_EQ(0U, notifications.size()); |
926 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 936 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
927 EXPECT_TRUE(controller.GetPendingEntry()); | 937 EXPECT_TRUE(controller.GetPendingEntry()); |
928 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 938 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
929 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 939 EXPECT_EQ(0, delegate->navigation_state_change_count()); |
930 | 940 |
931 // There should be no visible entry (resulting in about:blank in the | 941 // The visible entry should be the last committed URL, not the pending one. |
932 // omnibox), because it was renderer-initiated and there's no last committed | 942 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL()); |
933 // entry. | |
934 EXPECT_FALSE(controller.GetVisibleEntry()); | |
935 | 943 |
936 // Now the navigation redirects. | 944 // Now the navigation redirects. |
937 const GURL kRedirectURL("http://bee"); | 945 const GURL kRedirectURL("http://foo/see"); |
938 test_rvh()->OnMessageReceived( | 946 test_rvh()->OnMessageReceived( |
939 ViewHostMsg_DidRedirectProvisionalLoad(0, // routing_id | 947 ViewHostMsg_DidRedirectProvisionalLoad(0, // routing_id |
940 -1, // pending page_id | 948 -1, // pending page_id |
941 kNewURL, // old url | 949 kNewURL, // old url |
942 kRedirectURL)); // new url | 950 kRedirectURL)); // new url |
943 | 951 |
944 // We don't want to change the NavigationEntry's url, in case it cancels. | 952 // We don't want to change the NavigationEntry's url, in case it cancels. |
945 // Prevents regression of http://crbug.com/77786. | 953 // Prevents regression of http://crbug.com/77786. |
946 EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL()); | 954 EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL()); |
947 | 955 |
948 // It may abort before committing, if it's a download or due to a stop or | 956 // It may abort before committing, if it's a download or due to a stop or |
949 // a new navigation from the user. | 957 // a new navigation from the user. |
950 ViewHostMsg_DidFailProvisionalLoadWithError_Params params; | 958 ViewHostMsg_DidFailProvisionalLoadWithError_Params params; |
951 params.frame_id = 1; | 959 params.frame_id = 1; |
952 params.is_main_frame = true; | 960 params.is_main_frame = true; |
953 params.error_code = net::ERR_ABORTED; | 961 params.error_code = net::ERR_ABORTED; |
954 params.error_description = string16(); | 962 params.error_description = string16(); |
955 params.url = kRedirectURL; | 963 params.url = kRedirectURL; |
956 params.showing_repost_interstitial = false; | 964 params.showing_repost_interstitial = false; |
957 test_rvh()->OnMessageReceived( | 965 test_rvh()->OnMessageReceived( |
958 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 966 ViewHostMsg_DidFailProvisionalLoadWithError(0, // routing_id |
959 params)); | 967 params)); |
960 | 968 |
961 // This should not clear the pending entry or notify of a navigation state | 969 // This should not clear the pending entry or notify of a navigation state |
962 // change. | 970 // change. |
963 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 971 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
964 EXPECT_TRUE(controller.GetPendingEntry()); | 972 EXPECT_TRUE(controller.GetPendingEntry()); |
965 EXPECT_EQ(-1, controller.GetLastCommittedEntryIndex()); | 973 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
966 EXPECT_EQ(1, delegate->navigation_state_change_count()); | 974 EXPECT_EQ(0, delegate->navigation_state_change_count()); |
967 | 975 |
968 // There should be no visible entry (resulting in about:blank in the | 976 // The visible entry should be the last committed URL, not the pending one, |
969 // omnibox), ensuring no spoof is possible. | 977 // so that no spoof is possible. |
970 EXPECT_FALSE(controller.GetVisibleEntry()); | 978 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL()); |
971 | 979 |
972 contents()->SetDelegate(NULL); | 980 contents()->SetDelegate(NULL); |
973 } | 981 } |
974 | 982 |
975 // Ensure that NavigationEntries track which bindings their RenderViewHost had | 983 // Ensure that NavigationEntries track which bindings their RenderViewHost had |
976 // at the time they committed. http://crbug.com/173672. | 984 // at the time they committed. http://crbug.com/173672. |
977 TEST_F(NavigationControllerTest, LoadURL_WithBindings) { | 985 TEST_F(NavigationControllerTest, LoadURL_WithBindings) { |
978 NavigationControllerImpl& controller = controller_impl(); | 986 NavigationControllerImpl& controller = controller_impl(); |
979 TestNotificationTracker notifications; | 987 TestNotificationTracker notifications; |
980 RegisterForAllNavNotifications(¬ifications, &controller); | 988 RegisterForAllNavNotifications(¬ifications, &controller); |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2537 test_rvh()->SendNavigate(1, url1); | 2545 test_rvh()->SendNavigate(1, url1); |
2538 EXPECT_EQ(url1, controller.GetActiveEntry()->GetURL()); | 2546 EXPECT_EQ(url1, controller.GetActiveEntry()->GetURL()); |
2539 EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); | 2547 EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
2540 EXPECT_FALSE( | 2548 EXPECT_FALSE( |
2541 NavigationEntryImpl::FromNavigationEntry( | 2549 NavigationEntryImpl::FromNavigationEntry( |
2542 controller.GetLastCommittedEntry())->is_renderer_initiated()); | 2550 controller.GetLastCommittedEntry())->is_renderer_initiated()); |
2543 | 2551 |
2544 notifications.Reset(); | 2552 notifications.Reset(); |
2545 } | 2553 } |
2546 | 2554 |
| 2555 // Tests that the URLs for renderer-initiated navigations in new tabs are |
| 2556 // displayed to the user before commit, as long as the initial about:blank |
| 2557 // page has not been modified. If so, we must revert to showing about:blank. |
| 2558 // See http://crbug.com/9682. |
| 2559 TEST_F(NavigationControllerTest, ShowRendererURLInNewTabUntilModified) { |
| 2560 NavigationControllerImpl& controller = controller_impl(); |
| 2561 TestNotificationTracker notifications; |
| 2562 RegisterForAllNavNotifications(¬ifications, &controller); |
| 2563 |
| 2564 const GURL url("http://foo"); |
| 2565 |
| 2566 // For renderer-initiated navigations in new tabs (with no committed entries), |
| 2567 // we show the pending entry's URL as long as the about:blank page is not |
| 2568 // modified. |
| 2569 NavigationController::LoadURLParams load_url_params(url); |
| 2570 load_url_params.transition_type = PAGE_TRANSITION_LINK; |
| 2571 load_url_params.is_renderer_initiated = true; |
| 2572 controller.LoadURLWithParams(load_url_params); |
| 2573 EXPECT_EQ(url, controller.GetActiveEntry()->GetURL()); |
| 2574 EXPECT_EQ(url, controller.GetVisibleEntry()->GetURL()); |
| 2575 EXPECT_TRUE( |
| 2576 NavigationEntryImpl::FromNavigationEntry(controller.GetPendingEntry())-> |
| 2577 is_renderer_initiated()); |
| 2578 EXPECT_TRUE(controller.IsInitialNavigation()); |
| 2579 EXPECT_FALSE(test_rvh()->has_accessed_initial_document()); |
| 2580 |
| 2581 // There should be no title yet. |
| 2582 EXPECT_TRUE(contents()->GetTitle().empty()); |
| 2583 |
| 2584 // If something else modifies the contents of the about:blank page, then |
| 2585 // we must revert to showing about:blank to avoid a URL spoof. |
| 2586 test_rvh()->OnMessageReceived( |
| 2587 ViewHostMsg_DidAccessInitialDocument(0)); |
| 2588 EXPECT_TRUE(test_rvh()->has_accessed_initial_document()); |
| 2589 EXPECT_FALSE(controller.GetVisibleEntry()); |
| 2590 EXPECT_EQ(url, controller.GetActiveEntry()->GetURL()); |
| 2591 |
| 2592 notifications.Reset(); |
| 2593 } |
| 2594 |
| 2595 TEST_F(NavigationControllerTest, DontShowRendererURLInNewTabAfterCommit) { |
| 2596 NavigationControllerImpl& controller = controller_impl(); |
| 2597 TestNotificationTracker notifications; |
| 2598 RegisterForAllNavNotifications(¬ifications, &controller); |
| 2599 |
| 2600 const GURL url1("http://foo/eh"); |
| 2601 const GURL url2("http://foo/bee"); |
| 2602 |
| 2603 // For renderer-initiated navigations in new tabs (with no committed entries), |
| 2604 // we show the pending entry's URL as long as the about:blank page is not |
| 2605 // modified. |
| 2606 NavigationController::LoadURLParams load_url_params(url1); |
| 2607 load_url_params.transition_type = PAGE_TRANSITION_LINK; |
| 2608 load_url_params.is_renderer_initiated = true; |
| 2609 controller.LoadURLWithParams(load_url_params); |
| 2610 EXPECT_EQ(url1, controller.GetActiveEntry()->GetURL()); |
| 2611 EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
| 2612 EXPECT_TRUE( |
| 2613 NavigationEntryImpl::FromNavigationEntry(controller.GetPendingEntry())-> |
| 2614 is_renderer_initiated()); |
| 2615 EXPECT_TRUE(controller.IsInitialNavigation()); |
| 2616 EXPECT_FALSE(test_rvh()->has_accessed_initial_document()); |
| 2617 |
| 2618 // Simulate a commit and then starting a new pending navigation. |
| 2619 test_rvh()->SendNavigate(0, url1); |
| 2620 NavigationController::LoadURLParams load_url2_params(url2); |
| 2621 load_url2_params.transition_type = PAGE_TRANSITION_LINK; |
| 2622 load_url2_params.is_renderer_initiated = true; |
| 2623 controller.LoadURLWithParams(load_url2_params); |
| 2624 |
| 2625 // We should not consider this an initial navigation, and thus should |
| 2626 // not show the pending URL. |
| 2627 EXPECT_FALSE(test_rvh()->has_accessed_initial_document()); |
| 2628 EXPECT_FALSE(controller.IsInitialNavigation()); |
| 2629 EXPECT_TRUE(controller.GetVisibleEntry()); |
| 2630 EXPECT_EQ(url1, controller.GetVisibleEntry()->GetURL()); |
| 2631 |
| 2632 notifications.Reset(); |
| 2633 } |
| 2634 |
2547 // Tests that IsInPageNavigation returns appropriate results. Prevents | 2635 // Tests that IsInPageNavigation returns appropriate results. Prevents |
2548 // regression for bug 1126349. | 2636 // regression for bug 1126349. |
2549 TEST_F(NavigationControllerTest, IsInPageNavigation) { | 2637 TEST_F(NavigationControllerTest, IsInPageNavigation) { |
2550 NavigationControllerImpl& controller = controller_impl(); | 2638 NavigationControllerImpl& controller = controller_impl(); |
2551 // Navigate to URL with no refs. | 2639 // Navigate to URL with no refs. |
2552 const GURL url("http://www.google.com/home.html"); | 2640 const GURL url("http://www.google.com/home.html"); |
2553 test_rvh()->SendNavigate(0, url); | 2641 test_rvh()->SendNavigate(0, url); |
2554 | 2642 |
2555 // Reloading the page is not an in-page navigation. | 2643 // Reloading the page is not an in-page navigation. |
2556 EXPECT_FALSE(controller.IsURLInPageNavigation(url)); | 2644 EXPECT_FALSE(controller.IsURLInPageNavigation(url)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2602 EXPECT_EQ(controller.GetEntryCount(), 1); | 2690 EXPECT_EQ(controller.GetEntryCount(), 1); |
2603 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); | 2691 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); |
2604 } | 2692 } |
2605 | 2693 |
2606 // Make sure that on cloning a WebContentsImpl and going back needs_reload is | 2694 // Make sure that on cloning a WebContentsImpl and going back needs_reload is |
2607 // false. | 2695 // false. |
2608 TEST_F(NavigationControllerTest, CloneAndGoBack) { | 2696 TEST_F(NavigationControllerTest, CloneAndGoBack) { |
2609 NavigationControllerImpl& controller = controller_impl(); | 2697 NavigationControllerImpl& controller = controller_impl(); |
2610 const GURL url1("http://foo1"); | 2698 const GURL url1("http://foo1"); |
2611 const GURL url2("http://foo2"); | 2699 const GURL url2("http://foo2"); |
| 2700 const string16 title(ASCIIToUTF16("Title")); |
2612 | 2701 |
2613 NavigateAndCommit(url1); | 2702 NavigateAndCommit(url1); |
| 2703 controller.GetActiveEntry()->SetTitle(title); |
2614 NavigateAndCommit(url2); | 2704 NavigateAndCommit(url2); |
2615 | 2705 |
2616 scoped_ptr<WebContents> clone(controller.GetWebContents()->Clone()); | 2706 scoped_ptr<WebContents> clone(controller.GetWebContents()->Clone()); |
2617 | 2707 |
2618 ASSERT_EQ(2, clone->GetController().GetEntryCount()); | 2708 ASSERT_EQ(2, clone->GetController().GetEntryCount()); |
2619 EXPECT_TRUE(clone->GetController().NeedsReload()); | 2709 EXPECT_TRUE(clone->GetController().NeedsReload()); |
2620 clone->GetController().GoBack(); | 2710 clone->GetController().GoBack(); |
2621 // Navigating back should have triggered needs_reload_ to go false. | 2711 // Navigating back should have triggered needs_reload_ to go false. |
2622 EXPECT_FALSE(clone->GetController().NeedsReload()); | 2712 EXPECT_FALSE(clone->GetController().NeedsReload()); |
| 2713 |
| 2714 // Ensure that the pending URL and its title are visible. |
| 2715 EXPECT_EQ(url1, clone->GetController().GetVisibleEntry()->GetURL()); |
| 2716 EXPECT_EQ(title, clone->GetTitle()); |
| 2717 } |
| 2718 |
| 2719 // Make sure that reloading a cloned tab doesn't change its pending entry index. |
| 2720 // See http://crbug.com/234491. |
| 2721 TEST_F(NavigationControllerTest, CloneAndReload) { |
| 2722 NavigationControllerImpl& controller = controller_impl(); |
| 2723 const GURL url1("http://foo1"); |
| 2724 const GURL url2("http://foo2"); |
| 2725 const string16 title(ASCIIToUTF16("Title")); |
| 2726 |
| 2727 NavigateAndCommit(url1); |
| 2728 controller.GetActiveEntry()->SetTitle(title); |
| 2729 NavigateAndCommit(url2); |
| 2730 |
| 2731 scoped_ptr<WebContents> clone(controller.GetWebContents()->Clone()); |
| 2732 clone->GetController().LoadIfNecessary(); |
| 2733 |
| 2734 ASSERT_EQ(2, clone->GetController().GetEntryCount()); |
| 2735 EXPECT_EQ(1, clone->GetController().GetPendingEntryIndex()); |
| 2736 |
| 2737 clone->GetController().Reload(true); |
| 2738 EXPECT_EQ(1, clone->GetController().GetPendingEntryIndex()); |
2623 } | 2739 } |
2624 | 2740 |
2625 // Make sure that cloning a WebContentsImpl doesn't copy interstitials. | 2741 // Make sure that cloning a WebContentsImpl doesn't copy interstitials. |
2626 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { | 2742 TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { |
2627 NavigationControllerImpl& controller = controller_impl(); | 2743 NavigationControllerImpl& controller = controller_impl(); |
2628 const GURL url1("http://foo1"); | 2744 const GURL url1("http://foo1"); |
2629 const GURL url2("http://foo2"); | 2745 const GURL url2("http://foo2"); |
2630 | 2746 |
2631 NavigateAndCommit(url1); | 2747 NavigateAndCommit(url1); |
2632 NavigateAndCommit(url2); | 2748 NavigateAndCommit(url2); |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3672 PAGE_TRANSITION_LINK); | 3788 PAGE_TRANSITION_LINK); |
3673 session_helper_.AssertNavigationEquals(nav, | 3789 session_helper_.AssertNavigationEquals(nav, |
3674 windows_[0]->tabs[0]->navigations[0]); | 3790 windows_[0]->tabs[0]->navigations[0]); |
3675 nav.set_url(url2); | 3791 nav.set_url(url2); |
3676 session_helper_.AssertNavigationEquals(nav, | 3792 session_helper_.AssertNavigationEquals(nav, |
3677 windows_[0]->tabs[0]->navigations[1]); | 3793 windows_[0]->tabs[0]->navigations[1]); |
3678 } | 3794 } |
3679 */ | 3795 */ |
3680 | 3796 |
3681 } // namespace content | 3797 } // namespace content |
OLD | NEW |