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

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

Issue 2264233002: Fix a crash in DownloadUIAddapter that happens when Java bridge is created/removed quickly while (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more checks Created 4 years, 4 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/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/downloads/download_ui_adapter_unittest.cc
diff --git a/components/offline_pages/downloads/download_ui_adapter_unittest.cc b/components/offline_pages/downloads/download_ui_adapter_unittest.cc
index a8a6152232ec40dce2b43e776e521198685cc1fd..1484ca9fd37aac9fabbe1f5b718d90fa602837e3 100644
--- a/components/offline_pages/downloads/download_ui_adapter_unittest.cc
+++ b/components/offline_pages/downloads/download_ui_adapter_unittest.cc
@@ -281,4 +281,17 @@ TEST_F(DownloadUIAdapterTest, ItemUpdated) {
EXPECT_EQ(0UL, updated_guids.size());
}
+TEST_F(DownloadUIAdapterTest, NoHangingLoad) {
+ EXPECT_NE(nullptr, model->adapter);
+ EXPECT_FALSE(items_loaded);
+ // Removal of last observer causes cache unload of not-yet-loaded cache.
+ model->adapter->RemoveObserver(this);
+ // This will complete async fetch of items, but...
+ PumpLoop();
+ // items should not be loaded when there is no observers!
+ EXPECT_FALSE(items_loaded);
+ // This should not crash.
+ model->adapter->AddObserver(this);
+}
+
} // namespace offline_pages
« no previous file with comments | « components/offline_pages/downloads/download_ui_adapter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698