Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 2368183004: Move redirect_chain from NavigationEntry to FrameNavigationEntry. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1627 url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 1627 url1, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
1628 int entry_id = controller.GetPendingEntry()->GetUniqueID(); 1628 int entry_id = controller.GetPendingEntry()->GetUniqueID();
1629 1629
1630 // Set up some redirect values. 1630 // Set up some redirect values.
1631 std::vector<GURL> redirects; 1631 std::vector<GURL> redirects;
1632 redirects.push_back(url2); 1632 redirects.push_back(url2);
1633 auto set_redirects_callback = base::Bind(SetRedirects, redirects); 1633 auto set_redirects_callback = base::Bind(SetRedirects, redirects);
1634 1634
1635 // Set redirects on the pending entry. 1635 // Set redirects on the pending entry.
1636 NavigationEntryImpl* pending_entry = controller.GetPendingEntry(); 1636 NavigationEntryImpl* pending_entry = controller.GetPendingEntry();
1637 pending_entry->SetRedirectChain(redirects); 1637 pending_entry->SetMainFrameRedirectChain(redirects);
1638 EXPECT_EQ(1U, pending_entry->GetRedirectChain().size()); 1638 EXPECT_EQ(1U, pending_entry->GetMainFrameRedirectChain().size());
1639 EXPECT_EQ(url2, pending_entry->GetRedirectChain()[0]); 1639 EXPECT_EQ(url2, pending_entry->GetMainFrameRedirectChain()[0]);
1640 1640
1641 // Normal navigation will preserve redirects in the committed entry. 1641 // Normal navigation will preserve redirects in the committed entry.
1642 main_test_rfh()->PrepareForCommitWithServerRedirect(url2); 1642 main_test_rfh()->PrepareForCommitWithServerRedirect(url2);
1643 main_test_rfh()->SendNavigateWithModificationCallback(0, entry_id, true, url1, 1643 main_test_rfh()->SendNavigateWithModificationCallback(0, entry_id, true, url1,
1644 set_redirects_callback); 1644 set_redirects_callback);
1645 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry(); 1645 NavigationEntryImpl* committed_entry = controller.GetLastCommittedEntry();
1646 ASSERT_EQ(1U, committed_entry->GetRedirectChain().size()); 1646 ASSERT_EQ(1U, committed_entry->GetMainFrameRedirectChain().size());
1647 EXPECT_EQ(url2, committed_entry->GetRedirectChain()[0]); 1647 EXPECT_EQ(url2, committed_entry->GetMainFrameRedirectChain()[0]);
1648 } 1648 }
1649 1649
1650 // Tests what happens when we navigate back successfully 1650 // Tests what happens when we navigate back successfully
1651 TEST_F(NavigationControllerTest, Back) { 1651 TEST_F(NavigationControllerTest, Back) {
1652 NavigationControllerImpl& controller = controller_impl(); 1652 NavigationControllerImpl& controller = controller_impl();
1653 TestNotificationTracker notifications; 1653 TestNotificationTracker notifications;
1654 RegisterForAllNavNotifications(&notifications, &controller); 1654 RegisterForAllNavNotifications(&notifications, &controller);
1655 1655
1656 const GURL url1("http://foo1"); 1656 const GURL url1("http://foo1");
1657 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1); 1657 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url1);
(...skipping 3672 matching lines...) Expand 10 before | Expand all | Expand 10 after
5330 // means that occasionally a navigation conflict will end up with one entry 5330 // means that occasionally a navigation conflict will end up with one entry
5331 // bubbling to the end of the entry list, but that's the least-bad option. 5331 // bubbling to the end of the entry list, but that's the least-bad option.
5332 EXPECT_EQ(3, controller.GetEntryCount()); 5332 EXPECT_EQ(3, controller.GetEntryCount());
5333 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); 5333 EXPECT_EQ(2, controller.GetCurrentEntryIndex());
5334 EXPECT_EQ(url_a, controller.GetEntryAtIndex(0)->GetURL()); 5334 EXPECT_EQ(url_a, controller.GetEntryAtIndex(0)->GetURL());
5335 EXPECT_EQ(url_c, controller.GetEntryAtIndex(1)->GetURL()); 5335 EXPECT_EQ(url_c, controller.GetEntryAtIndex(1)->GetURL());
5336 EXPECT_EQ(url_b, controller.GetEntryAtIndex(2)->GetURL()); 5336 EXPECT_EQ(url_b, controller.GetEntryAtIndex(2)->GetURL());
5337 } 5337 }
5338 5338
5339 } // namespace content 5339 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698