Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/offline_pages/downloads/download_ui_adapter.h" | 5 #include "components/offline_pages/downloads/download_ui_adapter.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 model->AddPageAndNotifyAdapter(page2); | 274 model->AddPageAndNotifyAdapter(page2); |
| 275 PumpLoop(); | 275 PumpLoop(); |
| 276 EXPECT_EQ(1UL, added_guids.size()); | 276 EXPECT_EQ(1UL, added_guids.size()); |
| 277 EXPECT_EQ(kTestGuid2, added_guids[0]); | 277 EXPECT_EQ(kTestGuid2, added_guids[0]); |
| 278 // TODO(dimich): we currently don't report updated items since OPM doesn't | 278 // TODO(dimich): we currently don't report updated items since OPM doesn't |
| 279 // have support for that. Add as needed, this will have to be updated when | 279 // have support for that. Add as needed, this will have to be updated when |
| 280 // support is added. | 280 // support is added. |
| 281 EXPECT_EQ(0UL, updated_guids.size()); | 281 EXPECT_EQ(0UL, updated_guids.size()); |
| 282 } | 282 } |
| 283 | 283 |
| 284 TEST_F(DownloadUIAdapterTest, NoHangingLoad) { | |
| 285 EXPECT_NE(nullptr, model->adapter); | |
| 286 EXPECT_FALSE(items_loaded); | |
| 287 // Removal of last observer causes cache unload of not-yet-loaded cache. | |
| 288 model->adapter->RemoveObserver(this); | |
| 289 // This will complete async fetch of items, but... | |
| 290 PumpLoop(); | |
| 291 // items should not be loaded when there is no observers! | |
| 292 EXPECT_FALSE(items_loaded); | |
| 293 // This should not crash. | |
| 294 model->adapter->AddObserver(this); | |
| 295 } | |
| 296 | |
|
fgorski
2016/08/22 22:52:22
nit: remove extra space.
Dmitry Titov
2016/08/23 01:21:34
Done.
| |
| 297 | |
| 284 } // namespace offline_pages | 298 } // namespace offline_pages |
| OLD | NEW |