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

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

Issue 2775023002: add DCHECK that a server redirect pending item should never be added. (Closed)
Patch Set: 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/crw_session_controller_unittest.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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Tests CanGoToOffset API for positive, negative and zero delta. Tested 247 // Tests CanGoToOffset API for positive, negative and zero delta. Tested
248 // navigation manager will have redirect entries to make sure they are 248 // navigation manager will have redirect entries to make sure they are
249 // appropriately skipped. 249 // appropriately skipped.
250 TEST_F(NavigationManagerTest, OffsetsWithoutPendingIndex) { 250 TEST_F(NavigationManagerTest, OffsetsWithoutPendingIndex) {
251 navigation_manager()->AddPendingItem( 251 navigation_manager()->AddPendingItem(
252 GURL("http://www.url.com/0"), Referrer(), ui::PAGE_TRANSITION_LINK, 252 GURL("http://www.url.com/0"), Referrer(), ui::PAGE_TRANSITION_LINK,
253 web::NavigationInitiationType::USER_INITIATED); 253 web::NavigationInitiationType::USER_INITIATED);
254 [session_controller() commitPendingItem]; 254 [session_controller() commitPendingItem];
255 navigation_manager()->AddPendingItem( 255 navigation_manager()->AddPendingItem(
256 GURL("http://www.url.com/redirect"), Referrer(), 256 GURL("http://www.url.com/redirect"), Referrer(),
257 ui::PAGE_TRANSITION_IS_REDIRECT_MASK, 257 ui::PAGE_TRANSITION_CLIENT_REDIRECT,
258 web::NavigationInitiationType::USER_INITIATED); 258 web::NavigationInitiationType::USER_INITIATED);
259 [session_controller() commitPendingItem]; 259 [session_controller() commitPendingItem];
260 navigation_manager()->AddPendingItem( 260 navigation_manager()->AddPendingItem(
261 GURL("http://www.url.com/1"), Referrer(), ui::PAGE_TRANSITION_LINK, 261 GURL("http://www.url.com/1"), Referrer(), ui::PAGE_TRANSITION_LINK,
262 web::NavigationInitiationType::USER_INITIATED); 262 web::NavigationInitiationType::USER_INITIATED);
263 [session_controller() commitPendingItem]; 263 [session_controller() commitPendingItem];
264 navigation_manager()->AddPendingItem( 264 navigation_manager()->AddPendingItem(
265 GURL("http://www.url.com/2"), Referrer(), ui::PAGE_TRANSITION_LINK, 265 GURL("http://www.url.com/2"), Referrer(), ui::PAGE_TRANSITION_LINK,
266 web::NavigationInitiationType::USER_INITIATED); 266 web::NavigationInitiationType::USER_INITIATED);
267 [session_controller() commitPendingItem]; 267 [session_controller() commitPendingItem];
268 navigation_manager()->AddPendingItem( 268 navigation_manager()->AddPendingItem(
269 GURL("http://www.url.com/redirect"), Referrer(), 269 GURL("http://www.url.com/redirect"), Referrer(),
270 ui::PAGE_TRANSITION_IS_REDIRECT_MASK, 270 ui::PAGE_TRANSITION_CLIENT_REDIRECT,
271 web::NavigationInitiationType::USER_INITIATED); 271 web::NavigationInitiationType::USER_INITIATED);
272 [session_controller() commitPendingItem]; 272 [session_controller() commitPendingItem];
273 ASSERT_EQ(5, navigation_manager()->GetItemCount()); 273 ASSERT_EQ(5, navigation_manager()->GetItemCount());
274 ASSERT_EQ(4, navigation_manager()->GetLastCommittedItemIndex()); 274 ASSERT_EQ(4, navigation_manager()->GetLastCommittedItemIndex());
275 275
276 // Go to entry at index 1 and test API from that state. 276 // Go to entry at index 1 and test API from that state.
277 [session_controller() goToItemAtIndex:1]; 277 [session_controller() goToItemAtIndex:1];
278 ASSERT_EQ(1, navigation_manager()->GetLastCommittedItemIndex()); 278 ASSERT_EQ(1, navigation_manager()->GetLastCommittedItemIndex());
279 ASSERT_EQ(-1, navigation_manager()->GetPendingItemIndex()); 279 ASSERT_EQ(-1, navigation_manager()->GetPendingItemIndex());
280 EXPECT_FALSE(navigation_manager()->CanGoToOffset(-1)); 280 EXPECT_FALSE(navigation_manager()->CanGoToOffset(-1));
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 608
609 GURL url_before_reload = navigation_manager()->GetVisibleItem()->GetURL(); 609 GURL url_before_reload = navigation_manager()->GetVisibleItem()->GetURL();
610 navigation_manager()->Reload(web::ReloadType::NORMAL, 610 navigation_manager()->Reload(web::ReloadType::NORMAL,
611 false /* check_for_repost */); 611 false /* check_for_repost */);
612 612
613 EXPECT_EQ(url_before_reload, 613 EXPECT_EQ(url_before_reload,
614 navigation_manager()->GetVisibleItem()->GetURL()); 614 navigation_manager()->GetVisibleItem()->GetURL());
615 } 615 }
616 616
617 } // namespace web 617 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/crw_session_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698