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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 | 1194 |
1195 // The second load should be committed, and bindings should be remembered. | 1195 // The second load should be committed, and bindings should be remembered. |
1196 EXPECT_EQ(controller.GetEntryCount(), 2); | 1196 EXPECT_EQ(controller.GetEntryCount(), 2); |
1197 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); | 1197 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); |
1198 EXPECT_TRUE(controller.CanGoBack()); | 1198 EXPECT_TRUE(controller.CanGoBack()); |
1199 EXPECT_EQ(1, controller.GetLastCommittedEntry()->bindings()); | 1199 EXPECT_EQ(1, controller.GetLastCommittedEntry()->bindings()); |
1200 | 1200 |
1201 // Going back, the first entry should still appear unprivileged. | 1201 // Going back, the first entry should still appear unprivileged. |
1202 controller.GoBack(); | 1202 controller.GoBack(); |
1203 new_rfh->PrepareForCommit(); | 1203 new_rfh->PrepareForCommit(); |
1204 orig_rfh->SendNavigate(0, entry1_id, false, url1); | 1204 contents()->GetPendingMainFrame()->SendNavigate(0, entry1_id, false, url1); |
1205 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 1205 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
1206 EXPECT_EQ(0, controller.GetLastCommittedEntry()->bindings()); | 1206 EXPECT_EQ(0, controller.GetLastCommittedEntry()->bindings()); |
1207 } | 1207 } |
1208 | 1208 |
1209 TEST_F(NavigationControllerTest, Reload) { | 1209 TEST_F(NavigationControllerTest, Reload) { |
1210 NavigationControllerImpl& controller = controller_impl(); | 1210 NavigationControllerImpl& controller = controller_impl(); |
1211 TestNotificationTracker notifications; | 1211 TestNotificationTracker notifications; |
1212 RegisterForAllNavNotifications(¬ifications, &controller); | 1212 RegisterForAllNavNotifications(¬ifications, &controller); |
1213 | 1213 |
1214 const GURL url1("http://foo1"); | 1214 const GURL url1("http://foo1"); |
(...skipping 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2846 our_controller.GetEntryAtIndex(0)->restore_type()); | 2846 our_controller.GetEntryAtIndex(0)->restore_type()); |
2847 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); | 2847 EXPECT_TRUE(our_controller.GetEntryAtIndex(0)->site_instance()); |
2848 | 2848 |
2849 // This pending navigation may have caused a different navigation to fail, | 2849 // This pending navigation may have caused a different navigation to fail, |
2850 // which causes the pending entry to be cleared. | 2850 // which causes the pending entry to be cleared. |
2851 FrameHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; | 2851 FrameHostMsg_DidFailProvisionalLoadWithError_Params fail_load_params; |
2852 fail_load_params.error_code = net::ERR_ABORTED; | 2852 fail_load_params.error_code = net::ERR_ABORTED; |
2853 fail_load_params.error_description = base::string16(); | 2853 fail_load_params.error_description = base::string16(); |
2854 fail_load_params.url = url; | 2854 fail_load_params.url = url; |
2855 fail_load_params.showing_repost_interstitial = false; | 2855 fail_load_params.showing_repost_interstitial = false; |
| 2856 main_test_rfh()->InitializeRenderFrameIfNeeded(); |
2856 main_test_rfh()->OnMessageReceived( | 2857 main_test_rfh()->OnMessageReceived( |
2857 FrameHostMsg_DidFailProvisionalLoadWithError(0, // routing_id | 2858 FrameHostMsg_DidFailProvisionalLoadWithError(0, // routing_id |
2858 fail_load_params)); | 2859 fail_load_params)); |
2859 | 2860 |
2860 // Now the pending restored entry commits. | 2861 // Now the pending restored entry commits. |
2861 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2862 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
2862 params.page_id = 0; | 2863 params.page_id = 0; |
2863 params.nav_entry_id = entry->GetUniqueID(); | 2864 params.nav_entry_id = entry->GetUniqueID(); |
2864 params.did_create_new_entry = false; | 2865 params.did_create_new_entry = false; |
2865 params.url = url; | 2866 params.url = url; |
(...skipping 2035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4901 { | 4902 { |
4902 LoadCommittedDetails details; | 4903 LoadCommittedDetails details; |
4903 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); | 4904 controller_impl().RendererDidNavigate(main_test_rfh(), params, &details); |
4904 EXPECT_EQ(PAGE_TYPE_ERROR, | 4905 EXPECT_EQ(PAGE_TYPE_ERROR, |
4905 controller_impl().GetLastCommittedEntry()->GetPageType()); | 4906 controller_impl().GetLastCommittedEntry()->GetPageType()); |
4906 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); | 4907 EXPECT_EQ(NAVIGATION_TYPE_IN_PAGE, details.type); |
4907 } | 4908 } |
4908 } | 4909 } |
4909 | 4910 |
4910 } // namespace content | 4911 } // namespace content |
OLD | NEW |