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

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

Issue 2775893003: Removed dead code from NavigationManagerImpl::GetIndexForOffset. (Closed)
Patch Set: Actually removed dead code Created 3 years, 8 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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 [session_controller() goToItemAtIndex:0]; 163 [session_controller() goToItemAtIndex:0];
164 EXPECT_FALSE(navigation_manager()->CanGoBack()); 164 EXPECT_FALSE(navigation_manager()->CanGoBack());
165 EXPECT_FALSE(navigation_manager()->CanGoToOffset(-1)); 165 EXPECT_FALSE(navigation_manager()->CanGoToOffset(-1));
166 166
167 [session_controller() goToItemAtIndex:1]; 167 [session_controller() goToItemAtIndex:1];
168 EXPECT_TRUE(navigation_manager()->CanGoBack()); 168 EXPECT_TRUE(navigation_manager()->CanGoBack());
169 EXPECT_TRUE(navigation_manager()->CanGoToOffset(-1)); 169 EXPECT_TRUE(navigation_manager()->CanGoToOffset(-1));
170 } 170 }
171 171
172 // Tests that going forward or positive offset is not possible if there is a
173 // pending entry.
174 TEST_F(NavigationManagerTest, CanGoForwardWithPendingItem) {
175 navigation_manager()->AddPendingItem(
176 GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED,
177 web::NavigationInitiationType::USER_INITIATED);
178 [session_controller() commitPendingItem];
179 navigation_manager()->AddPendingItem(
180 GURL("http://www.url.com/0"), Referrer(), ui::PAGE_TRANSITION_TYPED,
181 web::NavigationInitiationType::USER_INITIATED);
182 [session_controller() commitPendingItem];
183 [session_controller() goToItemAtIndex:0];
184 navigation_manager()->AddPendingItem(
185 GURL("http://www.url.com/1"), Referrer(), ui::PAGE_TRANSITION_TYPED,
186 web::NavigationInitiationType::USER_INITIATED);
187
188 // Pending entry should not allow going forward.
189 EXPECT_FALSE(navigation_manager()->CanGoForward());
190 EXPECT_FALSE(navigation_manager()->CanGoToOffset(1));
191 }
192
193 // Tests that going forward or positive offset is not possible without a 172 // Tests that going forward or positive offset is not possible without a
194 // committed item. 173 // committed item.
195 TEST_F(NavigationManagerTest, CanGoForwardWithoutCommitedItem) { 174 TEST_F(NavigationManagerTest, CanGoForwardWithoutCommitedItem) {
196 EXPECT_FALSE(navigation_manager()->CanGoForward()); 175 EXPECT_FALSE(navigation_manager()->CanGoForward());
197 EXPECT_FALSE(navigation_manager()->CanGoToOffset(1)); 176 EXPECT_FALSE(navigation_manager()->CanGoToOffset(1));
198 } 177 }
199 178
200 // Tests that going forward or positive offset is not possible if there is ony 179 // Tests that going forward or positive offset is not possible if there is ony
201 // one committed item and no transient item. 180 // one committed item and no transient item.
202 TEST_F(NavigationManagerTest, CanGoForwardWithSingleCommitedItem) { 181 TEST_F(NavigationManagerTest, CanGoForwardWithSingleCommitedItem) {
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 587
609 GURL url_before_reload = navigation_manager()->GetVisibleItem()->GetURL(); 588 GURL url_before_reload = navigation_manager()->GetVisibleItem()->GetURL();
610 navigation_manager()->Reload(web::ReloadType::NORMAL, 589 navigation_manager()->Reload(web::ReloadType::NORMAL,
611 false /* check_for_repost */); 590 false /* check_for_repost */);
612 591
613 EXPECT_EQ(url_before_reload, 592 EXPECT_EQ(url_before_reload,
614 navigation_manager()->GetVisibleItem()->GetURL()); 593 navigation_manager()->GetVisibleItem()->GetURL());
615 } 594 }
616 595
617 } // namespace web 596 } // 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