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

Unified Diff: content/browser/download/download_manager_impl.h

Issue 10344024: Rewrite download manager unit to be actual unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporate PS7 comment. Created 8 years, 6 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: content/browser/download/download_manager_impl.h
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index 44a952892a70603089cd11d8f5479b98ef15b5f7..701941c97693c52e3fe70150a05302bf5bb8354f 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -1,7 +1,6 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
#ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
#define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_MANAGER_IMPL_H_
@@ -17,15 +16,24 @@
#include "base/message_loop_helpers.h"
#include "base/observer_list.h"
#include "base/synchronization/lock.h"
+#include "content/browser/download/download_item_factory.h"
#include "content/browser/download/download_item_impl.h"
#include "content/common/content_export.h"
#include "content/public/browser/download_manager.h"
+class DownloadFileManager;
+
class CONTENT_EXPORT DownloadManagerImpl
: public content::DownloadManager,
public DownloadItemImpl::Delegate {
public:
- explicit DownloadManagerImpl(net::NetLog* net_log);
+ // Caller guarantees that |file_manager| and |net_log| will remain valid
+ // for the lifetime of DownloadManagerImpl (until Shutdown() is called).
+ DownloadManagerImpl(DownloadFileManager* file_manager,
+ scoped_ptr<content::DownloadItemFactory> factory,
+ net::NetLog* net_log);
+
+ static DownloadManagerImpl* Create(net::NetLog* net_log);
// content::DownloadManager functions.
virtual void SetDelegate(content::DownloadManagerDelegate* delegate) OVERRIDE;
@@ -109,9 +117,6 @@ class CONTENT_EXPORT DownloadManagerImpl
virtual void AssertStateConsistent(
content::DownloadItem* download) const OVERRIDE;
- // For unit tests only.
- void SetFileManagerForTesting(DownloadFileManager* file_manager);
-
private:
typedef std::set<content::DownloadItem*> DownloadSet;
typedef base::hash_map<int64, content::DownloadItem*> DownloadMap;
@@ -179,6 +184,9 @@ class CONTENT_EXPORT DownloadManagerImpl
// Called when Save Page As entry is committed to the persistent store.
void OnSavePageItemAddedToPersistentStore(int32 download_id, int64 db_handle);
+ // Factory for creation of downloads items.
+ scoped_ptr<content::DownloadItemFactory> factory_;
+
// |downloads_| is the owning set for all downloads known to the
// DownloadManager. This includes downloads started by the user in
// this session, downloads initialized from the history system, and

Powered by Google App Engine
This is Rietveld 408576698