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

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

Issue 2736843002: Fix the Download Notifications for Offline Pages to indicate bytes loaded. (Closed)
Patch Set: more fixes to more tests. Created 3 years, 9 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 181bb3d49bd091e24d99364fc382257e2ef8925e..a52a10eccc440035dd94a4bf6b2b18626dffeb7c 100644
--- a/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc
+++ b/components/offline_pages/core/downloads/download_ui_adapter_unittest.cc
@@ -173,6 +173,7 @@ class DownloadUIAdapterTest : public testing::Test,
bool items_loaded;
std::vector<std::string> added_guids, updated_guids, deleted_guids;
+ int64_t download_progress_bytes;
std::unique_ptr<MockOfflinePageModel> model;
DownloadUIAdapterDelegate* adapter_delegate;
std::unique_ptr<DownloadUIAdapter> adapter;
@@ -220,6 +221,7 @@ void DownloadUIAdapterTest::ItemAdded(const DownloadUIItem& item) {
void DownloadUIAdapterTest::ItemUpdated(const DownloadUIItem& item) {
updated_guids.push_back(item.guid);
+ download_progress_bytes += item.download_progress_bytes;
}
void DownloadUIAdapterTest::ItemDeleted(const std::string& guid) {
@@ -462,16 +464,14 @@ TEST_F(DownloadUIAdapterTest, UpdateProgress) {
AddRequest(GURL(kTestUrl), kTestClientId1);
PumpLoop();
- int64_t offline_id = adapter->GetOfflineIdByGuid(kTestGuid1);
const DownloadUIItem* item = adapter->GetItem(kTestGuid1);
ASSERT_NE(nullptr, item);
- EXPECT_EQ(item->download_progress_bytes, 0);
- updated_guids.clear();
-
- adapter->UpdateProgress(offline_id, 15);
+ EXPECT_GT(item->download_progress_bytes, 0LL);
+ // Updated 2 times - with progress and to 'completed'.
+ EXPECT_EQ(2UL, updated_guids.size());
EXPECT_EQ(kTestGuid1, updated_guids[0]);
- EXPECT_EQ(item->download_progress_bytes, 15);
+ EXPECT_EQ(kTestGuid1, updated_guids[1]);
}
} // 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