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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1306 std::vector<GURL> redirects; | 1306 std::vector<GURL> redirects; |
1307 redirects.push_back(GURL("http://foo2")); | 1307 redirects.push_back(GURL("http://foo2")); |
1308 | 1308 |
1309 // Set non-persisted values on the pending entry. | 1309 // Set non-persisted values on the pending entry. |
1310 NavigationEntryImpl* pending_entry = | 1310 NavigationEntryImpl* pending_entry = |
1311 NavigationEntryImpl::FromNavigationEntry(controller.GetPendingEntry()); | 1311 NavigationEntryImpl::FromNavigationEntry(controller.GetPendingEntry()); |
1312 pending_entry->SetBrowserInitiatedPostData(post_data.get()); | 1312 pending_entry->SetBrowserInitiatedPostData(post_data.get()); |
1313 pending_entry->set_is_renderer_initiated(true); | 1313 pending_entry->set_is_renderer_initiated(true); |
1314 pending_entry->set_transferred_global_request_id(transfer_id); | 1314 pending_entry->set_transferred_global_request_id(transfer_id); |
1315 pending_entry->set_should_replace_entry(true); | 1315 pending_entry->set_should_replace_entry(true); |
1316 pending_entry->set_redirect_chain(redirects); | 1316 pending_entry->SetRedirectChain(redirects); |
1317 pending_entry->set_should_clear_history_list(true); | 1317 pending_entry->set_should_clear_history_list(true); |
1318 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); | 1318 EXPECT_EQ(post_data.get(), pending_entry->GetBrowserInitiatedPostData()); |
1319 EXPECT_TRUE(pending_entry->is_renderer_initiated()); | 1319 EXPECT_TRUE(pending_entry->is_renderer_initiated()); |
1320 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); | 1320 EXPECT_EQ(transfer_id, pending_entry->transferred_global_request_id()); |
1321 EXPECT_TRUE(pending_entry->should_replace_entry()); | 1321 EXPECT_TRUE(pending_entry->should_replace_entry()); |
1322 EXPECT_EQ(1U, pending_entry->redirect_chain().size()); | 1322 EXPECT_EQ(1U, pending_entry->GetRedirectChain().size()); |
1323 EXPECT_TRUE(pending_entry->should_clear_history_list()); | 1323 EXPECT_TRUE(pending_entry->should_clear_history_list()); |
1324 | 1324 |
1325 main_test_rfh()->SendNavigate(0, url1); | 1325 main_test_rfh()->SendNavigate(0, url1); |
1326 | 1326 |
1327 // Certain values that are only used for pending entries get reset after | 1327 // Certain values that are only used for pending entries get reset after |
1328 // commit. | 1328 // commit. |
1329 NavigationEntryImpl* committed_entry = | 1329 NavigationEntryImpl* committed_entry = |
1330 NavigationEntryImpl::FromNavigationEntry( | 1330 NavigationEntryImpl::FromNavigationEntry( |
1331 controller.GetLastCommittedEntry()); | 1331 controller.GetLastCommittedEntry()); |
1332 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); | 1332 EXPECT_FALSE(committed_entry->GetBrowserInitiatedPostData()); |
1333 EXPECT_FALSE(committed_entry->is_renderer_initiated()); | 1333 EXPECT_FALSE(committed_entry->is_renderer_initiated()); |
1334 EXPECT_EQ(GlobalRequestID(-1, -1), | 1334 EXPECT_EQ(GlobalRequestID(-1, -1), |
1335 committed_entry->transferred_global_request_id()); | 1335 committed_entry->transferred_global_request_id()); |
1336 EXPECT_FALSE(committed_entry->should_replace_entry()); | 1336 EXPECT_FALSE(committed_entry->should_replace_entry()); |
1337 EXPECT_EQ(0U, committed_entry->redirect_chain().size()); | 1337 EXPECT_EQ(0U, committed_entry->GetRedirectChain().size()); |
Charlie Reis
2014/03/31 22:06:08
I thought you were preserving this after commit no
donnd
2014/04/01 04:36:26
This test includes both a ResetForCommit and also
Charlie Reis
2014/04/05 00:09:10
1) I don't think a check for GetRedirectChain belo
donnd
2014/04/08 21:38:27
Made a separate test that the redirect chain is pr
| |
1338 EXPECT_FALSE(committed_entry->should_clear_history_list()); | 1338 EXPECT_FALSE(committed_entry->should_clear_history_list()); |
1339 } | 1339 } |
1340 | 1340 |
1341 // Tests what happens when we navigate back successfully | 1341 // Tests what happens when we navigate back successfully |
1342 TEST_F(NavigationControllerTest, Back) { | 1342 TEST_F(NavigationControllerTest, Back) { |
1343 NavigationControllerImpl& controller = controller_impl(); | 1343 NavigationControllerImpl& controller = controller_impl(); |
1344 TestNotificationTracker notifications; | 1344 TestNotificationTracker notifications; |
1345 RegisterForAllNavNotifications(¬ifications, &controller); | 1345 RegisterForAllNavNotifications(¬ifications, &controller); |
1346 | 1346 |
1347 const GURL url1("http://foo1"); | 1347 const GURL url1("http://foo1"); |
(...skipping 2669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4017 EXPECT_EQ(1, controller.GetEntryCount()); | 4017 EXPECT_EQ(1, controller.GetEntryCount()); |
4018 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); | 4018 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); |
4019 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); | 4019 EXPECT_EQ(0, controller.GetLastCommittedEntryIndex()); |
4020 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); | 4020 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); |
4021 EXPECT_FALSE(controller.CanGoBack()); | 4021 EXPECT_FALSE(controller.CanGoBack()); |
4022 EXPECT_FALSE(controller.CanGoForward()); | 4022 EXPECT_FALSE(controller.CanGoForward()); |
4023 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); | 4023 EXPECT_EQ(url4, controller.GetVisibleEntry()->GetURL()); |
4024 } | 4024 } |
4025 | 4025 |
4026 } // namespace content | 4026 } // namespace content |
OLD | NEW |