| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/stl_util-inl.h" | 7 #include "base/stl_util-inl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/profile_manager.h" | 9 #include "chrome/browser/profile_manager.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 | 550 |
| 551 const GURL kUrl1("http://foo1"); | 551 const GURL kUrl1("http://foo1"); |
| 552 const GURL kUrl2("http://foo2"); | 552 const GURL kUrl2("http://foo2"); |
| 553 const GURL kUrl3("http://foo3"); | 553 const GURL kUrl3("http://foo3"); |
| 554 | 554 |
| 555 // First navigate two places so we have some back history. | 555 // First navigate two places so we have some back history. |
| 556 rvh()->SendNavigate(0, kUrl1); | 556 rvh()->SendNavigate(0, kUrl1); |
| 557 EXPECT_TRUE(notifications.Check1AndReset( | 557 EXPECT_TRUE(notifications.Check1AndReset( |
| 558 NotificationType::NAV_ENTRY_COMMITTED)); | 558 NotificationType::NAV_ENTRY_COMMITTED)); |
| 559 | 559 |
| 560 //controller().LoadURL(kUrl2, PageTransition::TYPED); | 560 // controller().LoadURL(kUrl2, PageTransition::TYPED); |
| 561 rvh()->SendNavigate(1, kUrl2); | 561 rvh()->SendNavigate(1, kUrl2); |
| 562 EXPECT_TRUE(notifications.Check1AndReset( | 562 EXPECT_TRUE(notifications.Check1AndReset( |
| 563 NotificationType::NAV_ENTRY_COMMITTED)); | 563 NotificationType::NAV_ENTRY_COMMITTED)); |
| 564 | 564 |
| 565 // Now start a new pending navigation and go back before it commits. | 565 // Now start a new pending navigation and go back before it commits. |
| 566 controller().LoadURL(kUrl3, GURL(), PageTransition::TYPED); | 566 controller().LoadURL(kUrl3, GURL(), PageTransition::TYPED); |
| 567 EXPECT_EQ(-1, controller().pending_entry_index()); | 567 EXPECT_EQ(-1, controller().pending_entry_index()); |
| 568 EXPECT_EQ(kUrl3, controller().pending_entry()->url()); | 568 EXPECT_EQ(kUrl3, controller().pending_entry()->url()); |
| 569 controller().GoBack(); | 569 controller().GoBack(); |
| 570 | 570 |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 | 1075 |
| 1076 // Details from the last NAV_LIST_PRUNED. | 1076 // Details from the last NAV_LIST_PRUNED. |
| 1077 NavigationController::PrunedDetails details_; | 1077 NavigationController::PrunedDetails details_; |
| 1078 | 1078 |
| 1079 private: | 1079 private: |
| 1080 NotificationRegistrar registrar_; | 1080 NotificationRegistrar registrar_; |
| 1081 | 1081 |
| 1082 DISALLOW_COPY_AND_ASSIGN(PrunedListener); | 1082 DISALLOW_COPY_AND_ASSIGN(PrunedListener); |
| 1083 }; | 1083 }; |
| 1084 | 1084 |
| 1085 } | 1085 } // namespace |
| 1086 | 1086 |
| 1087 // Tests that we limit the number of navigation entries created correctly. | 1087 // Tests that we limit the number of navigation entries created correctly. |
| 1088 TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { | 1088 TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { |
| 1089 size_t original_count = NavigationController::max_entry_count(); | 1089 size_t original_count = NavigationController::max_entry_count(); |
| 1090 const int kMaxEntryCount = 5; | 1090 const int kMaxEntryCount = 5; |
| 1091 | 1091 |
| 1092 NavigationController::set_max_entry_count(kMaxEntryCount); | 1092 NavigationController::set_max_entry_count(kMaxEntryCount); |
| 1093 | 1093 |
| 1094 int url_index; | 1094 int url_index; |
| 1095 // Load up to the max count, all entries should be there. | 1095 // Load up to the max count, all entries should be there. |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 TabNavigation nav(0, url0, GURL(), string16(), | 1508 TabNavigation nav(0, url0, GURL(), string16(), |
| 1509 webkit_glue::CreateHistoryStateForURL(url0), | 1509 webkit_glue::CreateHistoryStateForURL(url0), |
| 1510 PageTransition::LINK); | 1510 PageTransition::LINK); |
| 1511 session_helper_.AssertNavigationEquals(nav, | 1511 session_helper_.AssertNavigationEquals(nav, |
| 1512 windows_[0]->tabs[0]->navigations[0]); | 1512 windows_[0]->tabs[0]->navigations[0]); |
| 1513 nav.set_url(url2); | 1513 nav.set_url(url2); |
| 1514 session_helper_.AssertNavigationEquals(nav, | 1514 session_helper_.AssertNavigationEquals(nav, |
| 1515 windows_[0]->tabs[0]->navigations[1]); | 1515 windows_[0]->tabs[0]->navigations[1]); |
| 1516 } | 1516 } |
| 1517 */ | 1517 */ |
| OLD | NEW |