| Index: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
|
| diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
|
| index aee109d01d66141190dda8bca307f956f1e6c4c0..cb882b68a9af19174a505778645ea62ef8fb6e5f 100644
|
| --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
|
| +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
|
| @@ -19,6 +19,7 @@
|
| #include "chrome/browser/extensions/event_names.h"
|
| #include "chrome/browser/extensions/extension_apitest.h"
|
| #include "chrome/browser/extensions/extension_function_test_utils.h"
|
| +#include "chrome/browser/history/download_persistent_store_info.h"
|
| #include "chrome/browser/net/url_request_mock_util.h"
|
| #include "chrome/browser/prefs/pref_service.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| @@ -33,7 +34,6 @@
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/download_item.h"
|
| #include "content/public/browser/download_manager.h"
|
| -#include "content/public/browser/download_persistent_store_info.h"
|
| #include "content/public/browser/notification_service.h"
|
| #include "content/public/browser/storage_partition.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -45,8 +45,8 @@
|
| #include "net/url_request/url_request.h"
|
| #include "net/url_request/url_request_context.h"
|
| #include "net/url_request/url_request_job.h"
|
| -#include "net/url_request/url_request_job_factory_impl.h"
|
| #include "net/url_request/url_request_job_factory.h"
|
| +#include "net/url_request/url_request_job_factory_impl.h"
|
| #include "webkit/blob/blob_data.h"
|
| #include "webkit/blob/blob_storage_controller.h"
|
| #include "webkit/blob/blob_url_request_job.h"
|
| @@ -58,7 +58,6 @@ using content::BrowserContext;
|
| using content::BrowserThread;
|
| using content::DownloadItem;
|
| using content::DownloadManager;
|
| -using content::DownloadPersistentStoreInfo;
|
|
|
| namespace events = extensions::event_names;
|
|
|
| @@ -356,24 +355,19 @@ class DownloadExtensionTest : public ExtensionApiTest {
|
| DownloadManager::DownloadVector* items) {
|
| DownloadIdComparator download_id_comparator;
|
| base::Time current = base::Time::Now();
|
| - std::vector<DownloadPersistentStoreInfo> entries;
|
| - entries.reserve(count);
|
| + items->clear();
|
| + GetOnRecordManager()->GetAllDownloads(items);
|
| + CHECK_EQ(0, static_cast<int>(items->size()));
|
| for (size_t i = 0; i < count; ++i) {
|
| - DownloadPersistentStoreInfo entry(
|
| + DownloadItem* item = GetOnRecordManager()->CreateDownloadItem(
|
| downloads_directory().Append(history_info[i].filename),
|
| GURL(), GURL(), // URL, referrer
|
| current, current, // start_time, end_time
|
| 1, 1, // received_bytes, total_bytes
|
| history_info[i].state, // state
|
| - i + 1, // db_handle
|
| false); // opened
|
| - entries.push_back(entry);
|
| + items->push_back(item);
|
| }
|
| - GetOnRecordManager()->OnPersistentStoreQueryComplete(&entries);
|
| - GetOnRecordManager()->GetAllDownloads(items);
|
| - EXPECT_EQ(count, items->size());
|
| - if (count != items->size())
|
| - return false;
|
|
|
| // Order by ID so that they are in the order that we created them.
|
| std::sort(items->begin(), items->end(), download_id_comparator);
|
| @@ -896,6 +890,7 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
|
| DownloadExtensionTest_FileIcon_Active) {
|
| DownloadItem* download_item = CreateSlowTestDownload();
|
| ASSERT_TRUE(download_item);
|
| + EXPECT_FALSE(download_item->GetTargetFilePath().empty());
|
| std::string args32(base::StringPrintf("[%d, {\"size\": 32}]",
|
| download_item->GetId()));
|
| std::string result_string;
|
| @@ -932,12 +927,14 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest,
|
|
|
| // Now create another download.
|
| download_item = CreateSlowTestDownload();
|
| - args32 = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId());
|
| ASSERT_TRUE(download_item);
|
| + EXPECT_FALSE(download_item->GetTargetFilePath().empty());
|
| + args32 = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId());
|
|
|
| // Cancel the download. As long as the download has a target path, we should
|
| // be able to query the file icon.
|
| download_item->Cancel(true);
|
| + EXPECT_FALSE(download_item->GetTargetFilePath().empty());
|
| // Let cleanup complete on the FILE thread.
|
| content::RunAllPendingInMessageLoop(BrowserThread::FILE);
|
| // Check the path passed to the icon extractor post-cancellation.
|
|
|