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

Unified Diff: chrome/browser/safe_browsing/download_feedback_unittest.cc

Issue 2887843002: Replace BrowserThread::FILE in safe browsing with task scheduler. (Closed)
Patch Set: Switch SingleThread->SequencedTaskRunner per Gab's request. Created 3 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: chrome/browser/safe_browsing/download_feedback_unittest.cc
diff --git a/chrome/browser/safe_browsing/download_feedback_unittest.cc b/chrome/browser/safe_browsing/download_feedback_unittest.cc
index f18adfeb6b66f1eaf1741c03fe52aed88b2413a4..8bd291ff7706fc12ea0bb6a04e1903a906d10a7b 100644
--- a/chrome/browser/safe_browsing/download_feedback_unittest.cc
+++ b/chrome/browser/safe_browsing/download_feedback_unittest.cc
@@ -10,10 +10,12 @@
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/task_scheduler/post_task.h"
#include "chrome/browser/safe_browsing/two_phase_uploader.h"
#include "components/safe_browsing/csd.pb.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -104,8 +106,8 @@ std::unique_ptr<TwoPhaseUploader> FakeUploaderFactory::CreateTwoPhaseUploader(
class DownloadFeedbackTest : public testing::Test {
public:
DownloadFeedbackTest()
- : file_task_runner_(content::BrowserThread::GetTaskRunnerForThread(
- content::BrowserThread::FILE)),
+ : file_task_runner_(base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::BACKGROUND})),
io_task_runner_(content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::IO)),
url_request_context_getter_(
@@ -140,7 +142,7 @@ class DownloadFeedbackTest : public testing::Test {
base::FilePath upload_file_path_;
std::string upload_file_data_;
content::TestBrowserThreadBundle thread_bundle_;
- scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
+ scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
FakeUploaderFactory two_phase_uploader_factory_;
scoped_refptr<net::TestURLRequestContextGetter> url_request_context_getter_;
@@ -187,7 +189,7 @@ TEST_F(DownloadFeedbackTest, CompleteUpload) {
TwoPhaseUploader::STATE_SUCCESS, net::OK, 0, "");
EXPECT_TRUE(feedback_finish_called_);
feedback.reset();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_FALSE(base::PathExists(upload_file_path_));
}
@@ -219,7 +221,7 @@ TEST_F(DownloadFeedbackTest, CancelUpload) {
feedback.reset();
EXPECT_FALSE(feedback_finish_called_);
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
EXPECT_FALSE(base::PathExists(upload_file_path_));
}

Powered by Google App Engine
This is Rietveld 408576698