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

Side by Side Diff: ios/web/navigation/navigation_manager_impl_unittest.mm

Issue 2724073005: Remove NavigationManager::GetPreviousItem(). (Closed)
Patch Set: Address comments. Created 3 years, 9 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
« no previous file with comments | « ios/web/navigation/navigation_manager_impl.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/web/navigation/navigation_manager_impl.h" 5 #import "ios/web/navigation/navigation_manager_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #import "ios/web/navigation/crw_session_controller+private_constructors.h" 9 #import "ios/web/navigation/crw_session_controller+private_constructors.h"
10 #import "ios/web/navigation/navigation_manager_delegate.h" 10 #import "ios/web/navigation/navigation_manager_delegate.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 TestBrowserState browser_state_; 45 TestBrowserState browser_state_;
46 TestNavigationManagerDelegate delegate_; 46 TestNavigationManagerDelegate delegate_;
47 std::unique_ptr<NavigationManagerImpl> manager_; 47 std::unique_ptr<NavigationManagerImpl> manager_;
48 base::scoped_nsobject<CRWSessionController> controller_; 48 base::scoped_nsobject<CRWSessionController> controller_;
49 }; 49 };
50 50
51 // Tests state of an empty navigation manager. 51 // Tests state of an empty navigation manager.
52 TEST_F(NavigationManagerTest, EmptyManager) { 52 TEST_F(NavigationManagerTest, EmptyManager) {
53 EXPECT_EQ(0, navigation_manager()->GetItemCount()); 53 EXPECT_EQ(0, navigation_manager()->GetItemCount());
54 EXPECT_EQ(-1, navigation_manager()->GetCurrentItemIndex()); 54 EXPECT_EQ(-1, navigation_manager()->GetCurrentItemIndex());
55 EXPECT_FALSE(navigation_manager()->GetPreviousItem());
56 EXPECT_EQ(-1, navigation_manager()->GetCurrentItemIndex()); 55 EXPECT_EQ(-1, navigation_manager()->GetCurrentItemIndex());
57 EXPECT_FALSE(navigation_manager()->GetPendingItem()); 56 EXPECT_FALSE(navigation_manager()->GetPendingItem());
58 EXPECT_EQ(-1, navigation_manager()->GetPendingItemIndex()); 57 EXPECT_EQ(-1, navigation_manager()->GetPendingItemIndex());
59 EXPECT_EQ(-1, navigation_manager()->GetIndexForOffset(0)); 58 EXPECT_EQ(-1, navigation_manager()->GetIndexForOffset(0));
60 } 59 }
61 60
62 // Tests that GetPendingItemIndex() returns -1 if there is no pending entry. 61 // Tests that GetPendingItemIndex() returns -1 if there is no pending entry.
63 TEST_F(NavigationManagerTest, GetPendingItemIndexWithoutPendingEntry) { 62 TEST_F(NavigationManagerTest, GetPendingItemIndexWithoutPendingEntry) {
64 navigation_manager()->AddPendingItem( 63 navigation_manager()->AddPendingItem(
65 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, 64 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED,
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 GURL("http://www.3.com"), Referrer(), ui::PAGE_TRANSITION_TYPED, 592 GURL("http://www.3.com"), Referrer(), ui::PAGE_TRANSITION_TYPED,
594 web::NavigationInitiationType::USER_INITIATED); 593 web::NavigationInitiationType::USER_INITIATED);
595 [session_controller() commitPendingItem]; 594 [session_controller() commitPendingItem];
596 web::NavigationItem* item3 = navigation_manager()->GetLastCommittedItem(); 595 web::NavigationItem* item3 = navigation_manager()->GetLastCommittedItem();
597 596
598 // Verify that |item2|'s UserAgentType is propagated to |item3|. 597 // Verify that |item2|'s UserAgentType is propagated to |item3|.
599 EXPECT_EQ(item2->GetUserAgentType(), item3->GetUserAgentType()); 598 EXPECT_EQ(item2->GetUserAgentType(), item3->GetUserAgentType());
600 } 599 }
601 600
602 } // namespace web 601 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/navigation_manager_impl.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698