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

Unified Diff: components/offline_pages/core/downloads/download_ui_adapter_unittest.cc

Issue 2700773003: [Offline Pages] Download UI: Remove all observers when clearing cache. (Closed)
Patch Set: Created 3 years, 10 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 | « components/offline_pages/core/downloads/download_ui_adapter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/offline_pages/core/downloads/download_ui_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698