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]); |
+} |