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

Unified Diff: ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm

Issue 2587173002: Cleanup NetworkActivityIndicatorTabHelper and add unittest. (Closed)
Patch Set: Created 4 years 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/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm
diff --git a/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm b/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm
index e3912dbea41a2539346aecd0ce1d0582be21884c..871691a35100adc0184355dc54e030e9649a4d4b 100644
--- a/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm
+++ b/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm
@@ -62,3 +62,22 @@ TEST(NetworkActivityIndicatorTabHelperTest, MultipleWebStateActivity) {
EXPECT_FALSE(
[[UIApplication sharedApplication] isNetworkActivityIndicatorVisible]);
}
+
+// Tests that the network activity for a single WebState correctly stops when
+// the WebState is deallocated.
+TEST(NetworkActivityIndicatorTabHelperTest, WebStateDeallocated) {
+ std::unique_ptr<TestWebState> web_state(new TestWebState());
+ NetworkActivityIndicatorTabHelper::CreateForWebState(web_state.get(),
+ @"web_state1");
+
+ EXPECT_FALSE(
+ [[UIApplication sharedApplication] isNetworkActivityIndicatorVisible]);
+
+ web_state->SetLoading(true);
+ EXPECT_TRUE(
+ [[UIApplication sharedApplication] isNetworkActivityIndicatorVisible]);
+
+ web_state.reset(nil);
+ EXPECT_FALSE(
+ [[UIApplication sharedApplication] isNetworkActivityIndicatorVisible]);
+}

Powered by Google App Engine
This is Rietveld 408576698