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/core/downloads/download_ui_adapter.h" | 5 #include "components/offline_pages/core/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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 adapter->RemoveObserver(this); | 448 adapter->RemoveObserver(this); |
449 items_loaded = false; | 449 items_loaded = false; |
450 | 450 |
451 PumpLoop(); | 451 PumpLoop(); |
452 | 452 |
453 adapter->AddObserver(this); | 453 adapter->AddObserver(this); |
454 PumpLoop(); | 454 PumpLoop(); |
455 EXPECT_TRUE(items_loaded); | 455 EXPECT_TRUE(items_loaded); |
456 } | 456 } |
457 | 457 |
| 458 TEST_F(DownloadUIAdapterTest, UpdateProgress) { |
| 459 offliner_stub->enable_callback(true); |
| 460 AddRequest(GURL(kTestUrl), kTestClientId1); |
| 461 PumpLoop(); |
| 462 |
| 463 int64_t offline_id = adapter->GetOfflineIdByGuid(kTestGuid1); |
| 464 const DownloadUIItem* item = adapter->GetItem(kTestGuid1); |
| 465 |
| 466 ASSERT_NE(nullptr, item); |
| 467 EXPECT_EQ(item->download_progress_bytes, 0); |
| 468 updated_guids.clear(); |
| 469 |
| 470 adapter->UpdateProgress(offline_id, 15); |
| 471 EXPECT_EQ(kTestGuid1, updated_guids[0]); |
| 472 EXPECT_EQ(item->download_progress_bytes, 15); |
| 473 } |
| 474 |
458 } // namespace offline_pages | 475 } // namespace offline_pages |
OLD | NEW |