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

Unified Diff: content/public/test/test_file_error_injector.cc

Issue 17315009: [Downloads] Add more browsertests for resumption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Serialize alls to TestFileErrorInjector accounting methods. Created 7 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
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/test_file_error_injector.cc
diff --git a/content/public/test/test_file_error_injector.cc b/content/public/test/test_file_error_injector.cc
index c2a6fc3b7ee306fed1a8bf17f502c87b200fd6a4..1d91ea6db59c6ff9128b45395f526a4e887694de 100644
--- a/content/public/test/test_file_error_injector.cc
+++ b/content/public/test/test_file_error_injector.cc
@@ -123,10 +123,20 @@ DownloadFileWithErrors::DownloadFileWithErrors(
source_url_(url),
error_info_(error_info),
destruction_callback_(dtor_callback) {
- ctor_callback.Run(source_url_);
+ // DownloadFiles are created on the UI thread and are destroyed on the FILE
+ // thread. Schedule the ConstructionCallback on the FILE thread so that if a
+ // DownloadItem schedules a DownloadFile to be destroyed and creates another
+ // one (as happens during download resumption), then the DestructionCallback
+ // for the old DownloadFile is run before the ConstructionCallback for the
+ // next DownloadFile.
+ BrowserThread::PostTask(
+ BrowserThread::FILE,
+ FROM_HERE,
+ base::Bind(ctor_callback, source_url_));
}
DownloadFileWithErrors::~DownloadFileWithErrors() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
destruction_callback_.Run(source_url_);
}
« no previous file with comments | « chrome/browser/download/download_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698