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

Unified Diff: ios/web/navigation/navigation_manager_impl_unittest.mm

Issue 2741413007: Refactoring Reload in NavigationManager and CRWWebController. (Closed)
Patch Set: fixed more check_for_repost errors 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 side-by-side diff with in-line comments
Download patch
Index: ios/web/navigation/navigation_manager_impl_unittest.mm
diff --git a/ios/web/navigation/navigation_manager_impl_unittest.mm b/ios/web/navigation/navigation_manager_impl_unittest.mm
index 38394c937603ad695921d37fd62384cc3dc0aa05..6869947ef1ba7386140ac767cdf2c285002aeaf0 100644
--- a/ios/web/navigation/navigation_manager_impl_unittest.mm
+++ b/ios/web/navigation/navigation_manager_impl_unittest.mm
@@ -20,6 +20,7 @@
class TestNavigationManagerDelegate : public NavigationManagerDelegate {
void GoToIndex(int index) override {}
void LoadURLWithParams(const NavigationManager::WebLoadParams&) override {}
+ void Reload() override {}
void OnNavigationItemsPruned(size_t pruned_item_count) override {}
void OnNavigationItemChanged() override{};
void OnNavigationItemCommitted(const LoadCommittedDetails&) override {}
@@ -598,4 +599,20 @@ void OnNavigationItemCommitted(const LoadCommittedDetails&) override {}
EXPECT_EQ(item2->GetUserAgentType(), item3->GetUserAgentType());
}
+// Tests that calling |Reload| on NavigationManager leaves the Url of the
+// visible item unchanged.
+TEST_F(NavigationManagerTest, ReloadWithNormalReloadType) {
+ navigation_manager()->AddPendingItem(
+ GURL("http://www.url.com"), Referrer(), ui::PAGE_TRANSITION_TYPED,
+ web::NavigationInitiationType::USER_INITIATED);
+ ASSERT_TRUE(navigation_manager()->GetVisibleItem());
+
+ GURL url_before_reload = navigation_manager()->GetVisibleItem()->GetURL();
+ navigation_manager()->Reload(web::ReloadType::NORMAL,
+ false /* check_for_repost */);
+
+ EXPECT_EQ(url_before_reload,
+ navigation_manager()->GetVisibleItem()->GetURL());
+}
+
} // namespace web

Powered by Google App Engine
This is Rietveld 408576698