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

Unified Diff: content/browser/download/mock_download_file.cc

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Revert ScopedCOMInitializer invocations. Created 3 years, 5 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/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() {

Powered by Google App Engine
This is Rietveld 408576698