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

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, 4 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/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 f81e73680ee5ba76eff1f865ef64db78b69beed6..626c545506e17e14da5c4975eb8ecdd6a47de410 100644
--- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
+++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc
@@ -12,6 +12,7 @@
#include "base/stl_util.h"
#include "base/stringprintf.h"
#include "chrome/browser/download/download_file_icon_extractor.h"
+#include "chrome/browser/download/download_persistent_store_info.h"
#include "chrome/browser/download/download_service.h"
#include "chrome/browser/download/download_service_factory.h"
#include "chrome/browser/download/download_test_file_chooser_observer.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"
@@ -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);

Powered by Google App Engine
This is Rietveld 408576698