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

Unified Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 10665049: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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 | « chrome/browser/download/save_page_browsertest.cc ('k') | chrome/browser/history/download_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dd38572ca07b62e8ef8e983c5b414065ab343d7d..db95208ff55693a8a94792874e97af530a6db099 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/web_contents.h"
#include "content/public/common/page_transition_types.h"
@@ -44,8 +44,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"
@@ -57,7 +57,6 @@ using content::BrowserContext;
using content::BrowserThread;
using content::DownloadItem;
using content::DownloadManager;
-using content::DownloadPersistentStoreInfo;
namespace events = extensions::event_names;
@@ -355,24 +354,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(FilePath(), 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(FilePath(), 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);
« no previous file with comments | « chrome/browser/download/save_page_browsertest.cc ('k') | chrome/browser/history/download_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698