| Index: components/history/core/browser/history_backend_db_unittest.cc
|
| diff --git a/components/history/core/browser/history_backend_db_unittest.cc b/components/history/core/browser/history_backend_db_unittest.cc
|
| index fd033d7f8a2f867938a5b93dfc0bea2c8b864961..8c77387604172cc7b9e008eab5b3809fe8a5ff04 100644
|
| --- a/components/history/core/browser/history_backend_db_unittest.cc
|
| +++ b/components/history/core/browser/history_backend_db_unittest.cc
|
| @@ -30,6 +30,7 @@
|
| #include "base/strings/string_util.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "base/test/scoped_feature_list.h"
|
| #include "base/time/time.h"
|
| #include "components/history/core/browser/download_constants.h"
|
| #include "components/history/core/browser/download_row.h"
|
| @@ -749,7 +750,7 @@ TEST_F(HistoryBackendDBTest, DownloadCreateAndQuery) {
|
| 100, 1000, DownloadState::INTERRUPTED, DownloadDangerType::NOT_DANGEROUS,
|
| kTestDownloadInterruptReasonCrash, "hash-value1", 1,
|
| "FE672168-26EF-4275-A149-FEC25F6A75F9", false, "extension-id",
|
| - "extension-name");
|
| + "extension-name", std::vector<DownloadJobInfo>());
|
| ASSERT_TRUE(db_->CreateDownload(download_A));
|
|
|
| url_chain.push_back(GURL("http://example.com/d"));
|
| @@ -767,7 +768,7 @@ TEST_F(HistoryBackendDBTest, DownloadCreateAndQuery) {
|
| 1001, 1001, DownloadState::COMPLETE, DownloadDangerType::DANGEROUS_FILE,
|
| kTestDownloadInterruptReasonNone, std::string(), 2,
|
| "b70f3869-7d75-4878-acb4-4caf7026d12b", false, "extension-id",
|
| - "extension-name");
|
| + "extension-name", std::vector<DownloadJobInfo>());
|
| ASSERT_TRUE(db_->CreateDownload(download_B));
|
|
|
| EXPECT_EQ(2u, db_->CountDownloads());
|
| @@ -806,7 +807,7 @@ TEST_F(HistoryBackendDBTest, DownloadCreateAndUpdate_VolatileFields) {
|
| "original/mime-type", start_time, end_time, "etag1", "last_modified_1",
|
| 100, 1000, DownloadState::INTERRUPTED, DownloadDangerType::NOT_DANGEROUS,
|
| 3, "some-hash-value", 1, "FE672168-26EF-4275-A149-FEC25F6A75F9", false,
|
| - "extension-id", "extension-name");
|
| + "extension-id", "extension-name", std::vector<DownloadJobInfo>());
|
| db_->CreateDownload(download);
|
|
|
| download.current_path =
|
| @@ -904,7 +905,8 @@ TEST_F(HistoryBackendDBTest, DownloadNukeRecordsMissingURLs) {
|
| "application/octet-stream", now, now, std::string(), std::string(), 0,
|
| 512, DownloadState::COMPLETE, DownloadDangerType::NOT_DANGEROUS,
|
| kTestDownloadInterruptReasonNone, std::string(), 1,
|
| - "05AF6C8E-E4E0-45D7-B5CE-BC99F7019918", 0, "by_ext_id", "by_ext_name");
|
| + "05AF6C8E-E4E0-45D7-B5CE-BC99F7019918", 0, "by_ext_id", "by_ext_name",
|
| + std::vector<DownloadJobInfo>());
|
|
|
| // Creating records without any urls should fail.
|
| EXPECT_FALSE(db_->CreateDownload(download));
|
| @@ -1004,6 +1006,50 @@ TEST_F(HistoryBackendDBTest, ConfirmDownloadInProgressCleanup) {
|
| }
|
| }
|
|
|
| +TEST_F(HistoryBackendDBTest, CreateAndUpdateParallelDownloadingJob) {
|
| + base::test::ScopedFeatureList scoped_feature_list;
|
| + scoped_feature_list.InitAndEnableFeature(kParallelDownloading);
|
| +
|
| + // Create the DB.
|
| + CreateBackendAndDatabase();
|
| +
|
| + std::vector<GURL> url_chain;
|
| + url_chain.push_back(GURL("http://example.com/a"));
|
| +
|
| + DownloadId id = 1;
|
| + std::vector<DownloadJobInfo> job_info;
|
| + int64_t received = 0;
|
| + job_info.push_back(DownloadJobInfo(
|
| + id, 0, 0, 1000, received, DownloadState::INTERRUPTED,
|
| + kTestDownloadInterruptReasonCrash));
|
| + base::Time start_time(base::Time::Now());
|
| + base::Time end_time(start_time + base::TimeDelta::FromHours(1));
|
| +
|
| + DownloadRow download(
|
| + base::FilePath(FILE_PATH_LITERAL("/path/1")),
|
| + base::FilePath(FILE_PATH_LITERAL("/path/2")), url_chain,
|
| + GURL("http://example.com/referrer"), GURL("http://example.com"),
|
| + GURL("http://example.com/tab-url"),
|
| + GURL("http://example.com/tab-referrer"), "GET", "mime/type",
|
| + "original/mime-type", start_time, end_time, "etag1", "last_modified_1",
|
| + received, 1000, DownloadState::INTERRUPTED,
|
| + DownloadDangerType::NOT_DANGEROUS, kTestDownloadInterruptReasonCrash,
|
| + "hash-value1", id, "FE672168-26EF-4275-A149-FEC25F6A75F9",
|
| + false, "extension-id", "extension-name", job_info);
|
| + ASSERT_TRUE(db_->CreateDownload(download));
|
| + std::vector<DownloadRow> results;
|
| + db_->QueryDownloads(&results);
|
| + ASSERT_EQ(1u, results.size());
|
| + EXPECT_EQ(download, results[0]);
|
| +
|
| + download.received_bytes += 10;
|
| + download.download_job_info[0].received_bytes = download.received_bytes;
|
| + ASSERT_TRUE(db_->UpdateDownload(download));
|
| + db_->QueryDownloads(&results);
|
| + ASSERT_EQ(1u, results.size());
|
| + EXPECT_EQ(download, results[0]);
|
| +}
|
| +
|
| TEST_F(HistoryBackendDBTest, MigratePresentations) {
|
| // Create the db we want. Use 22 since segments didn't change in that time
|
| // frame.
|
|
|