Chromium Code Reviews| 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..bcf9277509a1e27ff414040c77d45b1b8b1545c1 100644 |
| --- a/components/offline_pages/downloads/download_ui_adapter_unittest.cc |
| +++ b/components/offline_pages/downloads/download_ui_adapter_unittest.cc |
| @@ -281,4 +281,18 @@ 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); |
| +} |
| + |
|
fgorski
2016/08/22 22:52:22
nit: remove extra space.
Dmitry Titov
2016/08/23 01:21:34
Done.
|
| + |
| } // namespace offline_pages |