OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 1776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 | 1787 |
1788 // There should be no longer any pending entry and one committed one. This | 1788 // There should be no longer any pending entry and one committed one. This |
1789 // means that we were able to locate the entry, assign its site instance, and | 1789 // means that we were able to locate the entry, assign its site instance, and |
1790 // commit it properly. | 1790 // commit it properly. |
1791 EXPECT_EQ(1, our_controller.GetEntryCount()); | 1791 EXPECT_EQ(1, our_controller.GetEntryCount()); |
1792 EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); | 1792 EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); |
1793 EXPECT_FALSE(our_controller.GetPendingEntry()); | 1793 EXPECT_FALSE(our_controller.GetPendingEntry()); |
1794 EXPECT_EQ(url, | 1794 EXPECT_EQ(url, |
1795 NavigationEntryImpl::FromNavigationEntry( | 1795 NavigationEntryImpl::FromNavigationEntry( |
1796 our_controller.GetLastCommittedEntry())->site_instance()-> | 1796 our_controller.GetLastCommittedEntry())->site_instance()-> |
1797 GetSite()); | 1797 GetSiteURL()); |
1798 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | 1798 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, |
1799 NavigationEntryImpl::FromNavigationEntry( | 1799 NavigationEntryImpl::FromNavigationEntry( |
1800 our_controller.GetEntryAtIndex(0))->restore_type()); | 1800 our_controller.GetEntryAtIndex(0))->restore_type()); |
1801 } | 1801 } |
1802 | 1802 |
1803 // Tests that we can still navigate to a restored entry after a different | 1803 // Tests that we can still navigate to a restored entry after a different |
1804 // navigation fails and clears the pending entry. http://crbug.com/90085 | 1804 // navigation fails and clears the pending entry. http://crbug.com/90085 |
1805 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { | 1805 TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { |
1806 // Create a NavigationController with a restored set of tabs. | 1806 // Create a NavigationController with a restored set of tabs. |
1807 GURL url("http://foo"); | 1807 GURL url("http://foo"); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1868 content::LoadCommittedDetails details; | 1868 content::LoadCommittedDetails details; |
1869 our_controller.RendererDidNavigate(params, &details); | 1869 our_controller.RendererDidNavigate(params, &details); |
1870 | 1870 |
1871 // There should be no pending entry and one committed one. | 1871 // There should be no pending entry and one committed one. |
1872 EXPECT_EQ(1, our_controller.GetEntryCount()); | 1872 EXPECT_EQ(1, our_controller.GetEntryCount()); |
1873 EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); | 1873 EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); |
1874 EXPECT_FALSE(our_controller.GetPendingEntry()); | 1874 EXPECT_FALSE(our_controller.GetPendingEntry()); |
1875 EXPECT_EQ(url, | 1875 EXPECT_EQ(url, |
1876 NavigationEntryImpl::FromNavigationEntry( | 1876 NavigationEntryImpl::FromNavigationEntry( |
1877 our_controller.GetLastCommittedEntry())->site_instance()-> | 1877 our_controller.GetLastCommittedEntry())->site_instance()-> |
1878 GetSite()); | 1878 GetSiteURL()); |
1879 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, | 1879 EXPECT_EQ(NavigationEntryImpl::RESTORE_NONE, |
1880 NavigationEntryImpl::FromNavigationEntry( | 1880 NavigationEntryImpl::FromNavigationEntry( |
1881 our_controller.GetEntryAtIndex(0))->restore_type()); | 1881 our_controller.GetEntryAtIndex(0))->restore_type()); |
1882 } | 1882 } |
1883 | 1883 |
1884 // Make sure that the page type and stuff is correct after an interstitial. | 1884 // Make sure that the page type and stuff is correct after an interstitial. |
1885 TEST_F(NavigationControllerTest, Interstitial) { | 1885 TEST_F(NavigationControllerTest, Interstitial) { |
1886 NavigationControllerImpl& controller = controller_impl(); | 1886 NavigationControllerImpl& controller = controller_impl(); |
1887 // First navigate somewhere normal. | 1887 // First navigate somewhere normal. |
1888 const GURL url1("http://foo"); | 1888 const GURL url1("http://foo"); |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2898 TabNavigation nav(0, url0, GURL(), string16(), | 2898 TabNavigation nav(0, url0, GURL(), string16(), |
2899 webkit_glue::CreateHistoryStateForURL(url0), | 2899 webkit_glue::CreateHistoryStateForURL(url0), |
2900 content::PAGE_TRANSITION_LINK); | 2900 content::PAGE_TRANSITION_LINK); |
2901 session_helper_.AssertNavigationEquals(nav, | 2901 session_helper_.AssertNavigationEquals(nav, |
2902 windows_[0]->tabs[0]->navigations[0]); | 2902 windows_[0]->tabs[0]->navigations[0]); |
2903 nav.set_url(url2); | 2903 nav.set_url(url2); |
2904 session_helper_.AssertNavigationEquals(nav, | 2904 session_helper_.AssertNavigationEquals(nav, |
2905 windows_[0]->tabs[0]->navigations[1]); | 2905 windows_[0]->tabs[0]->navigations[1]); |
2906 } | 2906 } |
2907 */ | 2907 */ |
OLD | NEW |