Commit 2daa348c authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

Set completion time for offline item correctly

Change-Id: I6d6fa7aed8164314611e547ad4f96891db259933
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852175Reviewed-by: default avatarMin Qin <qinmin@chromium.org>
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704754}
parent fabd552a
......@@ -103,6 +103,7 @@ OfflineItem OfflineItemUtils::CreateOfflineItem(const std::string& name_space,
item.total_size_bytes = download_item->GetTotalBytes();
item.externally_removed = download_item->GetFileExternallyRemoved();
item.creation_time = download_item->GetStartTime();
item.completion_time = download_item->GetEndTime();
item.last_accessed_time = download_item->GetLastAccessTime();
item.is_openable = download_item->CanOpenDownload();
item.file_path = download_item->GetTargetFilePath();
......
......@@ -122,6 +122,7 @@ TEST_F(OfflineItemUtilsTest, BasicConversions) {
base::FilePath file_name(FILE_PATH_LITERAL("image.png"));
std::string mime_type = "image/png";
base::Time creation_time = base::Time::Now();
base::Time completion_time = base::Time::Now();
base::Time last_access_time = base::Time::Now();
download::DownloadInterruptReason interrupt_reason =
download::DOWNLOAD_INTERRUPT_REASON_NONE;
......@@ -149,6 +150,7 @@ TEST_F(OfflineItemUtilsTest, BasicConversions) {
ON_CALL(*download, AllowMetered()).WillByDefault(Return(allow_metered));
ON_CALL(*download, GetReceivedBytes()).WillByDefault(Return(received_bytes));
ON_CALL(*download, GetTotalBytes()).WillByDefault(Return(total_bytes));
ON_CALL(*download, GetEndTime()).WillByDefault(Return(completion_time));
ON_CALL(*download, TimeRemaining(_))
.WillByDefault(testing::DoAll(
......@@ -173,6 +175,7 @@ TEST_F(OfflineItemUtilsTest, BasicConversions) {
EXPECT_EQ(total_bytes, offline_item.total_size_bytes);
EXPECT_EQ(externally_removed, offline_item.externally_removed);
EXPECT_EQ(creation_time, offline_item.creation_time);
EXPECT_EQ(completion_time, offline_item.completion_time);
EXPECT_EQ(last_access_time, offline_item.last_accessed_time);
EXPECT_EQ(is_openable, offline_item.is_openable);
EXPECT_EQ(file_path, offline_item.file_path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment