Index: components/offline_pages/core/downloads/download_ui_adapter_unittest.cc |
diff --git a/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc b/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc |
index f69153205aa23b2196065b70158756624ca5edd2..d74b2ed29969855e189649b38d45fc7034bfdb96 100644 |
--- a/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc |
+++ b/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc |
@@ -439,4 +439,20 @@ TEST_F(DownloadUIAdapterTest, RequestBecomesPage) { |
EXPECT_EQ(DownloadUIItem::DownloadState::COMPLETE, item->download_state); |
} |
+TEST_F(DownloadUIAdapterTest, RemoveObserversWhenClearingCache) { |
+ PumpLoop(); |
+ EXPECT_TRUE(items_loaded); |
+ |
+ // Remove this from the adapter's observer list. This should cause the cache |
+ // to be cleared. |
+ adapter->RemoveObserver(this); |
+ items_loaded = false; |
+ |
+ PumpLoop(); |
+ |
+ adapter->AddObserver(this); |
+ PumpLoop(); |
+ EXPECT_TRUE(items_loaded); |
+} |
+ |
} // namespace offline_pages |