| 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
| 8 #include "base/stl_util-inl.h" | 8 #include "base/stl_util-inl.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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 | 606 |
| 607 // Now start going back one to the second page. It will be pending. | 607 // Now start going back one to the second page. It will be pending. |
| 608 controller().GoBack(); | 608 controller().GoBack(); |
| 609 EXPECT_EQ(1, controller().pending_entry_index()); | 609 EXPECT_EQ(1, controller().pending_entry_index()); |
| 610 EXPECT_EQ(2, controller().last_committed_entry_index()); | 610 EXPECT_EQ(2, controller().last_committed_entry_index()); |
| 611 | 611 |
| 612 // Not synthesize a totally new back event to the first page. This will not | 612 // Not synthesize a totally new back event to the first page. This will not |
| 613 // match the pending one. | 613 // match the pending one. |
| 614 rvh()->SendNavigate(0, kUrl1); | 614 rvh()->SendNavigate(0, kUrl1); |
| 615 | 615 |
| 616 // The navigation should not have affected the pending entry. | 616 // The committed navigation should clear the pending entry. |
| 617 EXPECT_EQ(1, controller().pending_entry_index()); | 617 EXPECT_EQ(-1, controller().pending_entry_index()); |
| 618 | 618 |
| 619 // But the navigated entry should be the last committed. | 619 // But the navigated entry should be the last committed. |
| 620 EXPECT_EQ(0, controller().last_committed_entry_index()); | 620 EXPECT_EQ(0, controller().last_committed_entry_index()); |
| 621 EXPECT_EQ(kUrl1, controller().GetLastCommittedEntry()->url()); | 621 EXPECT_EQ(kUrl1, controller().GetLastCommittedEntry()->url()); |
| 622 } | 622 } |
| 623 | 623 |
| 624 // Tests what happens when we navigate forward successfully. | 624 // Tests what happens when we navigate forward successfully. |
| 625 TEST_F(NavigationControllerTest, Forward) { | 625 TEST_F(NavigationControllerTest, Forward) { |
| 626 TestNotificationTracker notifications; | 626 TestNotificationTracker notifications; |
| 627 RegisterForAllNavNotifications(¬ifications, &controller()); | 627 RegisterForAllNavNotifications(¬ifications, &controller()); |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 TabNavigation nav(0, url0, GURL(), string16(), | 2121 TabNavigation nav(0, url0, GURL(), string16(), |
| 2122 webkit_glue::CreateHistoryStateForURL(url0), | 2122 webkit_glue::CreateHistoryStateForURL(url0), |
| 2123 PageTransition::LINK); | 2123 PageTransition::LINK); |
| 2124 session_helper_.AssertNavigationEquals(nav, | 2124 session_helper_.AssertNavigationEquals(nav, |
| 2125 windows_[0]->tabs[0]->navigations[0]); | 2125 windows_[0]->tabs[0]->navigations[0]); |
| 2126 nav.set_url(url2); | 2126 nav.set_url(url2); |
| 2127 session_helper_.AssertNavigationEquals(nav, | 2127 session_helper_.AssertNavigationEquals(nav, |
| 2128 windows_[0]->tabs[0]->navigations[1]); | 2128 windows_[0]->tabs[0]->navigations[1]); |
| 2129 } | 2129 } |
| 2130 */ | 2130 */ |
| OLD | NEW |