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

Unified Diff: ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm

Issue 2838593002: Allow storing null navigations in CRWWKNavigationStates. (Closed)
Patch Set: Rebased Created 3 years, 7 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
« no previous file with comments | « ios/web/web_state/ui/crw_wk_navigation_states.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm
diff --git a/ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm b/ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm
index ce9f645753b767a83715bddb9c03edc5599644a8..eea2f4c5cc88002b59c80ca482a6f350bbe3c863 100644
--- a/ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm
+++ b/ios/web/web_state/ui/crw_wk_navigation_states_unittest.mm
@@ -110,4 +110,22 @@ TEST_F(CRWWKNavigationStatesTest, Context) {
EXPECT_TRUE([states_ contextForNavigation:navigation1_]->IsErrorPage());
}
+// Tests null WKNavigation object.
+TEST_F(CRWWKNavigationStatesTest, NullNavigation) {
+ // navigation_1 is the only navigation and it is the latest.
+ [states_ setState:WKNavigationState::REQUESTED forNavigation:navigation1_];
+ ASSERT_EQ(navigation1_, [states_ lastAddedNavigation]);
+ EXPECT_EQ(WKNavigationState::REQUESTED, [states_ lastAddedNavigationState]);
+
+ // null navigation is added later and hence the latest.
+ [states_ setState:WKNavigationState::STARTED forNavigation:nil];
+ EXPECT_FALSE([states_ lastAddedNavigation]);
+ EXPECT_EQ(WKNavigationState::STARTED, [states_ lastAddedNavigationState]);
+
+ // navigation_1 is the is the latest again after removing null navigation.
+ [states_ removeNavigation:nil];
+ ASSERT_EQ(navigation1_, [states_ lastAddedNavigation]);
+ EXPECT_EQ(WKNavigationState::REQUESTED, [states_ lastAddedNavigationState]);
+}
+
} // namespace web
« no previous file with comments | « ios/web/web_state/ui/crw_wk_navigation_states.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698