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

Side by Side Diff: content/browser/download/download_manager_impl.cc

Issue 11050003: Shift EnsureNoPendingDownloads() implementation into tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated comments. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/download_manager_impl.h" 5 #include "content/browser/download/download_manager_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 content::DownloadId download_id, 190 content::DownloadId download_id,
191 const std::string& mime_type, 191 const std::string& mime_type,
192 const net::BoundNetLog& bound_net_log) OVERRIDE { 192 const net::BoundNetLog& bound_net_log) OVERRIDE {
193 return new DownloadItemImpl(delegate, path, url, download_id, 193 return new DownloadItemImpl(delegate, path, url, download_id,
194 mime_type, bound_net_log); 194 mime_type, bound_net_log);
195 } 195 }
196 }; 196 };
197 197
198 } // namespace 198 } // namespace
199 199
200 namespace content {
201
202 bool DownloadManager::EnsureNoPendingDownloadsForTesting() {
203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
204 bool result = true;
205 BrowserThread::PostTask(
206 BrowserThread::IO, FROM_HERE,
207 base::Bind(&EnsureNoPendingDownloadJobsOnIO, &result));
208 MessageLoop::current()->Run();
209 return result;
210 }
211
212 } // namespace content
213
214 DownloadManagerImpl::DownloadManagerImpl( 200 DownloadManagerImpl::DownloadManagerImpl(
215 DownloadFileManager* file_manager, 201 DownloadFileManager* file_manager,
216 scoped_ptr<content::DownloadItemFactory> factory, 202 scoped_ptr<content::DownloadItemFactory> factory,
217 net::NetLog* net_log) 203 net::NetLog* net_log)
218 : factory_(factory.Pass()), 204 : factory_(factory.Pass()),
219 history_size_(0), 205 history_size_(0),
220 shutdown_needed_(false), 206 shutdown_needed_(false),
221 browser_context_(NULL), 207 browser_context_(NULL),
222 file_manager_(file_manager), 208 file_manager_(file_manager),
223 delegate_(NULL), 209 delegate_(NULL),
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 void DownloadManagerImpl::DownloadRenamedToFinalName( 1021 void DownloadManagerImpl::DownloadRenamedToFinalName(
1036 DownloadItemImpl* download) { 1022 DownloadItemImpl* download) {
1037 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1023 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1038 // If the rename failed, we receive an OnDownloadInterrupted() call before we 1024 // If the rename failed, we receive an OnDownloadInterrupted() call before we
1039 // receive the DownloadRenamedToFinalName() call. 1025 // receive the DownloadRenamedToFinalName() call.
1040 if (delegate_) { 1026 if (delegate_) {
1041 delegate_->UpdatePathForItemInPersistentStore( 1027 delegate_->UpdatePathForItemInPersistentStore(
1042 download, download->GetFullPath()); 1028 download, download->GetFullPath());
1043 } 1029 }
1044 } 1030 }
OLDNEW
« no previous file with comments | « content/browser/download/download_browsertest.cc ('k') | content/public/browser/download_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698