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

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

Issue 12340035: Ensure that the pending entry is cleared when a navigation commits. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1588 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); 1588 EXPECT_EQ(2, controller.GetCurrentEntryIndex());
1589 1589
1590 // Go back one. 1590 // Go back one.
1591 controller.GoBack(); 1591 controller.GoBack();
1592 params.url = url2; 1592 params.url = url2;
1593 params.page_id = 1; 1593 params.page_id = 1;
1594 EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); 1594 EXPECT_TRUE(controller.RendererDidNavigate(params, &details));
1595 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); 1595 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED));
1596 EXPECT_EQ(3, controller.GetEntryCount()); 1596 EXPECT_EQ(3, controller.GetEntryCount());
1597 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); 1597 EXPECT_EQ(1, controller.GetCurrentEntryIndex());
1598 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
1599 EXPECT_FALSE(controller.GetPendingEntry());
1598 1600
1599 // Go back one more. 1601 // Go back one more.
1600 controller.GoBack(); 1602 controller.GoBack();
1601 params.url = url1; 1603 params.url = url1;
1602 params.page_id = 0; 1604 params.page_id = 0;
1603 EXPECT_TRUE(controller.RendererDidNavigate(params, &details)); 1605 EXPECT_TRUE(controller.RendererDidNavigate(params, &details));
1604 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED)); 1606 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_COMMITTED));
1605 EXPECT_EQ(3, controller.GetEntryCount()); 1607 EXPECT_EQ(3, controller.GetEntryCount());
1606 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 1608 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
1609 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
1610 EXPECT_FALSE(controller.GetPendingEntry());
1607 } 1611 }
1608 1612
1609 TEST_F(NavigationControllerTest, LinkClick) { 1613 TEST_F(NavigationControllerTest, LinkClick) {
1610 NavigationControllerImpl& controller = controller_impl(); 1614 NavigationControllerImpl& controller = controller_impl();
1611 TestNotificationTracker notifications; 1615 TestNotificationTracker notifications;
1612 RegisterForAllNavNotifications(&notifications, &controller); 1616 RegisterForAllNavNotifications(&notifications, &controller);
1613 1617
1614 const GURL url1("http://foo1"); 1618 const GURL url1("http://foo1");
1615 const GURL url2("http://foo2"); 1619 const GURL url2("http://foo2");
1616 1620
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
3282 PAGE_TRANSITION_LINK); 3286 PAGE_TRANSITION_LINK);
3283 session_helper_.AssertNavigationEquals(nav, 3287 session_helper_.AssertNavigationEquals(nav,
3284 windows_[0]->tabs[0]->navigations[0]); 3288 windows_[0]->tabs[0]->navigations[0]);
3285 nav.set_url(url2); 3289 nav.set_url(url2);
3286 session_helper_.AssertNavigationEquals(nav, 3290 session_helper_.AssertNavigationEquals(nav,
3287 windows_[0]->tabs[0]->navigations[1]); 3291 windows_[0]->tabs[0]->navigations[1]);
3288 } 3292 }
3289 */ 3293 */
3290 3294
3291 } // namespace content 3295 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698