Index: content/browser/download/mock_download_file.cc |
diff --git a/content/browser/download/mock_download_file.cc b/content/browser/download/mock_download_file.cc |
index 58edddd8651de905c22516798471e69a9a5d03a8..3251e4e29097ada113842bdd707be46f5560d355 100644 |
--- a/content/browser/download/mock_download_file.cc |
+++ b/content/browser/download/mock_download_file.cc |
@@ -3,6 +3,9 @@ |
// found in the LICENSE file. |
#include "content/browser/download/mock_download_file.h" |
+ |
+#include "base/bind.h" |
+#include "content/public/browser/browser_thread.h" |
#include "testing/gmock/include/gmock/gmock.h" |
using ::testing::_; |
@@ -11,12 +14,17 @@ using ::testing::Return; |
namespace content { |
namespace { |
-void SuccessRun( |
+void SuccessRun(const DownloadFile::InitializeCallback& initialize_callback) { |
+ initialize_callback.Run(DOWNLOAD_INTERRUPT_REASON_NONE); |
+} |
+ |
+void PostSuccessRun( |
const DownloadFile::InitializeCallback& initialize_callback, |
const DownloadFile::CancelRequestCallback& cancel_request_callback, |
const DownloadItem::ReceivedSlices& received_slices, |
bool is_parallelizable) { |
- initialize_callback.Run(DOWNLOAD_INTERRUPT_REASON_NONE); |
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
+ base::Bind(&SuccessRun, initialize_callback)); |
} |
} // namespace |
@@ -25,7 +33,7 @@ MockDownloadFile::MockDownloadFile() { |
// This is here because |Initialize()| is normally called right after |
// construction. |
ON_CALL(*this, Initialize(_, _, _, _)) |
- .WillByDefault(::testing::Invoke(SuccessRun)); |
+ .WillByDefault(::testing::Invoke(PostSuccessRun)); |
} |
MockDownloadFile::~MockDownloadFile() { |