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

Unified Diff: chrome/browser/download/download_history_unittest.cc

Issue 1875033005: [Downloads/History] Add tab-url and tab-referrer-url to DownloadRow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guid-fix
Patch Set: Update expectations for DownloadUIController test. Created 4 years, 8 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
Index: chrome/browser/download/download_history_unittest.cc
diff --git a/chrome/browser/download/download_history_unittest.cc b/chrome/browser/download/download_history_unittest.cc
index 63961ccaf8626c91cdb9cad25ff11a2d8aee067d..7bc3da88de6bba876bcb2a3397cbad4ae06ce5ff 100644
--- a/chrome/browser/download/download_history_unittest.cc
+++ b/chrome/browser/download/download_history_unittest.cc
@@ -218,21 +218,11 @@ class DownloadHistoryTest : public testing::Test {
for (size_t index = 0; index < infos->size(); ++index) {
const history::DownloadRow& row = infos->at(index);
content::MockDownloadManager::CreateDownloadItemAdapter adapter(
- row.guid,
- history::ToContentDownloadId(row.id),
- row.current_path,
- row.target_path,
- row.url_chain,
- row.referrer_url,
- row.mime_type,
- row.original_mime_type,
- row.start_time,
- row.end_time,
- row.etag,
- row.last_modified,
- row.received_bytes,
- row.total_bytes,
- std::string(),
+ row.guid, history::ToContentDownloadId(row.id), row.current_path,
+ row.target_path, row.url_chain, row.referrer_url, row.tab_url,
+ row.tab_referrer_url, row.mime_type, row.original_mime_type,
+ row.start_time, row.end_time, row.etag, row.last_modified,
+ row.received_bytes, row.total_bytes, std::string(),
history::ToContentDownloadState(row.state),
history::ToContentDownloadDangerType(row.danger_type),
history::ToContentDownloadInterruptReason(row.interrupt_reason),
@@ -336,27 +326,17 @@ class DownloadHistoryTest : public testing::Test {
GURL referrer(referrer_string);
std::vector<GURL> url_chain;
url_chain.push_back(url);
- InitItem(base::GenerateGUID(),
- static_cast<uint32_t>(items_.size() + 1),
- base::FilePath(path),
- base::FilePath(path),
- url_chain,
- referrer,
- "application/octet-stream",
- "application/octet-stream",
+ InitItem(base::GenerateGUID(), static_cast<uint32_t>(items_.size() + 1),
+ base::FilePath(path), base::FilePath(path), url_chain, referrer,
+ GURL("http://example.com/tab-url"),
+ GURL("http://example.com/tab-referrer-url"),
+ "application/octet-stream", "application/octet-stream",
(base::Time::Now() - base::TimeDelta::FromMinutes(10)),
- (base::Time::Now() - base::TimeDelta::FromMinutes(1)),
- "Etag",
- "abc",
- 100,
- 100,
- content::DownloadItem::COMPLETE,
+ (base::Time::Now() - base::TimeDelta::FromMinutes(1)), "Etag",
+ "abc", 100, 100, content::DownloadItem::COMPLETE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
- content::DOWNLOAD_INTERRUPT_REASON_NONE,
- false,
- std::string(),
- std::string(),
- info);
+ content::DOWNLOAD_INTERRUPT_REASON_NONE, false, std::string(),
+ std::string(), info);
}
void InitItem(const std::string& guid,
@@ -365,6 +345,8 @@ class DownloadHistoryTest : public testing::Test {
const base::FilePath& target_path,
const std::vector<GURL>& url_chain,
const GURL& referrer,
+ const GURL& tab_url,
+ const GURL& tab_referrer_url,
const std::string& mime_type,
const std::string& original_mime_type,
const base::Time& start_time,
@@ -390,6 +372,8 @@ class DownloadHistoryTest : public testing::Test {
info->target_path = target_path;
info->url_chain = url_chain;
info->referrer_url = referrer;
+ info->tab_url = tab_url;
+ info->tab_referrer_url = tab_referrer_url;
info->mime_type = mime_type;
info->original_mime_type = original_mime_type;
info->start_time = start_time;
@@ -424,6 +408,10 @@ class DownloadHistoryTest : public testing::Test {
original_mime_type));
EXPECT_CALL(item(index), GetReferrerUrl())
.WillRepeatedly(ReturnRefOfCopy(referrer));
+ EXPECT_CALL(item(index), GetTabUrl())
+ .WillRepeatedly(ReturnRefOfCopy(tab_url));
+ EXPECT_CALL(item(index), GetTabReferrerUrl())
+ .WillRepeatedly(ReturnRefOfCopy(tab_referrer_url));
EXPECT_CALL(item(index), GetStartTime()).WillRepeatedly(Return(start_time));
EXPECT_CALL(item(index), GetEndTime()).WillRepeatedly(Return(end_time));
EXPECT_CALL(item(index), GetETag()).WillRepeatedly(ReturnRefOfCopy(etag));
« no previous file with comments | « chrome/browser/download/download_history.cc ('k') | chrome/browser/download/download_ui_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698