OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1717 rvh()->SendNavigate(3, url3); | 1717 rvh()->SendNavigate(3, url3); |
1718 | 1718 |
1719 // Add a transient and go to an entry before the current one. | 1719 // Add a transient and go to an entry before the current one. |
1720 transient_entry = new NavigationEntry; | 1720 transient_entry = new NavigationEntry; |
1721 transient_entry->set_url(transient_url); | 1721 transient_entry->set_url(transient_url); |
1722 controller().AddTransientEntry(transient_entry); | 1722 controller().AddTransientEntry(transient_entry); |
1723 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); | 1723 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); |
1724 controller().GoToIndex(1); | 1724 controller().GoToIndex(1); |
1725 // The navigation should have been initiated, transient entry should be gone. | 1725 // The navigation should have been initiated, transient entry should be gone. |
1726 EXPECT_EQ(url1, controller().GetActiveEntry()->url()); | 1726 EXPECT_EQ(url1, controller().GetActiveEntry()->url()); |
| 1727 // Visible entry does not update for history navigations until commit. |
| 1728 EXPECT_EQ(url3, controller().GetVisibleEntry()->url()); |
1727 rvh()->SendNavigate(1, url1); | 1729 rvh()->SendNavigate(1, url1); |
| 1730 EXPECT_EQ(url1, controller().GetVisibleEntry()->url()); |
1728 | 1731 |
1729 // Add a transient and go to an entry after the current one. | 1732 // Add a transient and go to an entry after the current one. |
1730 transient_entry = new NavigationEntry; | 1733 transient_entry = new NavigationEntry; |
1731 transient_entry->set_url(transient_url); | 1734 transient_entry->set_url(transient_url); |
1732 controller().AddTransientEntry(transient_entry); | 1735 controller().AddTransientEntry(transient_entry); |
1733 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); | 1736 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); |
1734 controller().GoToIndex(3); | 1737 controller().GoToIndex(3); |
1735 // The navigation should have been initiated, transient entry should be gone. | 1738 // The navigation should have been initiated, transient entry should be gone. |
1736 // Because of the transient entry that is removed, going to index 3 makes us | 1739 // Because of the transient entry that is removed, going to index 3 makes us |
1737 // land on url2. | 1740 // land on url2 (which is visible after the commit). |
1738 EXPECT_EQ(url2, controller().GetActiveEntry()->url()); | 1741 EXPECT_EQ(url2, controller().GetActiveEntry()->url()); |
| 1742 EXPECT_EQ(url1, controller().GetVisibleEntry()->url()); |
1739 rvh()->SendNavigate(2, url2); | 1743 rvh()->SendNavigate(2, url2); |
| 1744 EXPECT_EQ(url2, controller().GetVisibleEntry()->url()); |
1740 | 1745 |
1741 // Add a transient and go forward. | 1746 // Add a transient and go forward. |
1742 transient_entry = new NavigationEntry; | 1747 transient_entry = new NavigationEntry; |
1743 transient_entry->set_url(transient_url); | 1748 transient_entry->set_url(transient_url); |
1744 controller().AddTransientEntry(transient_entry); | 1749 controller().AddTransientEntry(transient_entry); |
1745 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); | 1750 EXPECT_EQ(transient_url, controller().GetActiveEntry()->url()); |
1746 EXPECT_TRUE(controller().CanGoForward()); | 1751 EXPECT_TRUE(controller().CanGoForward()); |
1747 controller().GoForward(); | 1752 controller().GoForward(); |
1748 // We should have navigated, transient entry should be gone. | 1753 // We should have navigated, transient entry should be gone. |
1749 EXPECT_EQ(url3, controller().GetActiveEntry()->url()); | 1754 EXPECT_EQ(url3, controller().GetActiveEntry()->url()); |
| 1755 EXPECT_EQ(url2, controller().GetVisibleEntry()->url()); |
1750 rvh()->SendNavigate(3, url3); | 1756 rvh()->SendNavigate(3, url3); |
| 1757 EXPECT_EQ(url3, controller().GetVisibleEntry()->url()); |
1751 | 1758 |
1752 // Ensure the URLS are correct. | 1759 // Ensure the URLS are correct. |
1753 EXPECT_EQ(controller().entry_count(), 5); | 1760 EXPECT_EQ(controller().entry_count(), 5); |
1754 EXPECT_EQ(controller().GetEntryAtIndex(0)->url(), url0); | 1761 EXPECT_EQ(controller().GetEntryAtIndex(0)->url(), url0); |
1755 EXPECT_EQ(controller().GetEntryAtIndex(1)->url(), url1); | 1762 EXPECT_EQ(controller().GetEntryAtIndex(1)->url(), url1); |
1756 EXPECT_EQ(controller().GetEntryAtIndex(2)->url(), url2); | 1763 EXPECT_EQ(controller().GetEntryAtIndex(2)->url(), url2); |
1757 EXPECT_EQ(controller().GetEntryAtIndex(3)->url(), url3); | 1764 EXPECT_EQ(controller().GetEntryAtIndex(3)->url(), url3); |
1758 EXPECT_EQ(controller().GetEntryAtIndex(4)->url(), url4); | 1765 EXPECT_EQ(controller().GetEntryAtIndex(4)->url(), url4); |
1759 } | 1766 } |
1760 | 1767 |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 TabNavigation nav(0, url0, GURL(), string16(), | 2384 TabNavigation nav(0, url0, GURL(), string16(), |
2378 webkit_glue::CreateHistoryStateForURL(url0), | 2385 webkit_glue::CreateHistoryStateForURL(url0), |
2379 PageTransition::LINK); | 2386 PageTransition::LINK); |
2380 session_helper_.AssertNavigationEquals(nav, | 2387 session_helper_.AssertNavigationEquals(nav, |
2381 windows_[0]->tabs[0]->navigations[0]); | 2388 windows_[0]->tabs[0]->navigations[0]); |
2382 nav.set_url(url2); | 2389 nav.set_url(url2); |
2383 session_helper_.AssertNavigationEquals(nav, | 2390 session_helper_.AssertNavigationEquals(nav, |
2384 windows_[0]->tabs[0]->navigations[1]); | 2391 windows_[0]->tabs[0]->navigations[1]); |
2385 } | 2392 } |
2386 */ | 2393 */ |
OLD | NEW |