Index: ios/web/web_state/ui/crw_web_controller_unittest.mm |
diff --git a/ios/web/web_state/ui/crw_web_controller_unittest.mm b/ios/web/web_state/ui/crw_web_controller_unittest.mm |
index eba3aebc218e582d3b4abdf75098d617ab49057a..70497eda82d98ee7663a797ab588aad8a46ffd83 100644 |
--- a/ios/web/web_state/ui/crw_web_controller_unittest.mm |
+++ b/ios/web/web_state/ui/crw_web_controller_unittest.mm |
@@ -50,8 +50,8 @@ |
@interface CRWWebController (PrivateAPI) |
@property(nonatomic, readwrite) web::PageDisplayState pageDisplayState; |
-- (GURL)URLForHistoryNavigationFromItem:(web::NavigationItem*)fromItem |
- toItem:(web::NavigationItem*)toItem; |
+- (GURL)URLForHistoryNavigationToItem:(web::NavigationItem*)toItem |
+ previousURL:(const GURL&)previousURL; |
@end |
// Used to mock CRWWebDelegate methods with C++ params. |
@@ -276,27 +276,28 @@ CGRect ExpectedWebViewFrame() const { |
[urlsWithFragments addObject:[url stringByAppendingString:fragment]]; |
} |
} |
- web::NavigationItemImpl fromItem; |
+ |
+ GURL previous_url; |
web::NavigationItemImpl toItem; |
// No start fragment: the end url is never changed. |
for (NSString* start in urlsNoFragments) { |
for (NSString* end in urlsWithFragments) { |
- fromItem.SetURL(MAKE_URL(start)); |
+ previous_url = MAKE_URL(start); |
toItem.SetURL(MAKE_URL(end)); |
EXPECT_EQ(MAKE_URL(end), |
- [web_controller() URLForHistoryNavigationFromItem:&fromItem |
- toItem:&toItem]); |
+ [web_controller() URLForHistoryNavigationToItem:&toItem |
+ previousURL:previous_url]); |
} |
} |
// Both contain fragments: the end url is never changed. |
for (NSString* start in urlsWithFragments) { |
for (NSString* end in urlsWithFragments) { |
- fromItem.SetURL(MAKE_URL(start)); |
+ previous_url = MAKE_URL(start); |
toItem.SetURL(MAKE_URL(end)); |
EXPECT_EQ(MAKE_URL(end), |
- [web_controller() URLForHistoryNavigationFromItem:&fromItem |
- toItem:&toItem]); |
+ [web_controller() URLForHistoryNavigationToItem:&toItem |
+ previousURL:previous_url]); |
} |
} |
for (unsigned start_index = 0; start_index < [urlsWithFragments count]; |
@@ -305,21 +306,22 @@ CGRect ExpectedWebViewFrame() const { |
for (unsigned end_index = 0; end_index < [urlsNoFragments count]; |
++end_index) { |
NSString* end = urlsNoFragments[end_index]; |
+ previous_url = MAKE_URL(start); |
if (start_index / 2 != end_index) { |
// The URLs have nothing in common, they are left untouched. |
- fromItem.SetURL(MAKE_URL(start)); |
toItem.SetURL(MAKE_URL(end)); |
- EXPECT_EQ(MAKE_URL(end), |
- [web_controller() URLForHistoryNavigationFromItem:&fromItem |
- toItem:&toItem]); |
+ EXPECT_EQ( |
+ MAKE_URL(end), |
+ [web_controller() URLForHistoryNavigationToItem:&toItem |
+ previousURL:previous_url]); |
} else { |
// Start contains a fragment and matches end: An empty fragment is |
// added. |
- fromItem.SetURL(MAKE_URL(start)); |
toItem.SetURL(MAKE_URL(end)); |
- EXPECT_EQ(MAKE_URL([end stringByAppendingString:@"#"]), |
- [web_controller() URLForHistoryNavigationFromItem:&fromItem |
- toItem:&toItem]); |
+ EXPECT_EQ( |
+ MAKE_URL([end stringByAppendingString:@"#"]), |
+ [web_controller() URLForHistoryNavigationToItem:&toItem |
+ previousURL:previous_url]); |
} |
} |
} |