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/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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 1014 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
1015 EXPECT_TRUE(controller.GetPendingEntry()); | 1015 EXPECT_TRUE(controller.GetPendingEntry()); |
1016 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 1016 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
1017 EXPECT_EQ(0, delegate->navigation_state_change_count()); | 1017 EXPECT_EQ(0, delegate->navigation_state_change_count()); |
1018 | 1018 |
1019 // The visible entry should be the last committed URL, not the pending one. | 1019 // The visible entry should be the last committed URL, not the pending one. |
1020 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL()); | 1020 EXPECT_EQ(kExistingURL, controller.GetVisibleEntry()->GetURL()); |
1021 | 1021 |
1022 // Now the navigation redirects. | 1022 // Now the navigation redirects. |
1023 const GURL kRedirectURL("http://foo/see"); | 1023 const GURL kRedirectURL("http://foo/see"); |
1024 test_rvh()->OnMessageReceived( | 1024 main_test_rfh()->OnMessageReceived( |
1025 ViewHostMsg_DidRedirectProvisionalLoad(0, // routing_id | 1025 FrameHostMsg_DidRedirectProvisionalLoad(0, // routing_id |
1026 -1, // pending page_id | 1026 -1, // pending page_id |
1027 kNewURL, // old url | 1027 kNewURL, // old url |
1028 kRedirectURL)); // new url | 1028 kRedirectURL)); // new url |
1029 | 1029 |
1030 // We don't want to change the NavigationEntry's url, in case it cancels. | 1030 // We don't want to change the NavigationEntry's url, in case it cancels. |
1031 // Prevents regression of http://crbug.com/77786. | 1031 // Prevents regression of http://crbug.com/77786. |
1032 EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL()); | 1032 EXPECT_EQ(kNewURL, controller.GetPendingEntry()->GetURL()); |
1033 | 1033 |
1034 // It may abort before committing, if it's a download or due to a stop or | 1034 // It may abort before committing, if it's a download or due to a stop or |
1035 // a new navigation from the user. | 1035 // a new navigation from the user. |
1036 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; | 1036 FrameHostMsg_DidFailProvisionalLoadWithError_Params params; |
1037 params.frame_id = 1; | 1037 params.frame_id = 1; |
1038 params.is_main_frame = true; | 1038 params.is_main_frame = true; |
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4015 EXPECT_EQ(1, controller.GetEntryCount()); | 4015 EXPECT_EQ(1, controller.GetEntryCount()); |
4016 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 4016 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
4017 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 4017 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
4018 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 4018 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
4019 EXPECT_FALSE(controller.CanGoBack()); | 4019 EXPECT_FALSE(controller.CanGoBack()); |
4020 EXPECT_FALSE(controller.CanGoForward()); | 4020 EXPECT_FALSE(controller.CanGoForward()); |
4021 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); | 4021 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); |
4022 } | 4022 } |
4023 | 4023 |
4024 } // namespace content | 4024 } // namespace content |
OLD | NEW |