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

Unified Diff: chrome/browser/net/file_downloader_unittest.cc

Issue 2835303002: [reland] Use TaskScheduler instead of blocking pool in file_downloader.cc. (Closed)
Patch Set: self-review Created 3 years, 8 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/net/file_downloader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/file_downloader_unittest.cc
diff --git a/chrome/browser/net/file_downloader_unittest.cc b/chrome/browser/net/file_downloader_unittest.cc
index c34763ac738c7a44dee7313c8d48305a6c777f4c..79fa18a449c93e0a4aa1eb86817e579c93f23d99 100644
--- a/chrome/browser/net/file_downloader_unittest.cc
+++ b/chrome/browser/net/file_downloader_unittest.cc
@@ -7,11 +7,9 @@
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/threading/sequenced_worker_pool.h"
+#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
-#include "content/public/browser/browser_thread.h"
+#include "content/public/test/test_utils.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_request_test_util.h"
@@ -68,20 +66,14 @@ class FileDownloaderTest : public testing::Test {
TRAFFIC_ANNOTATION_FOR_TESTS);
EXPECT_CALL(*this, OnDownloadFinished(expected_result));
// Wait for the FileExists check to happen if necessary.
- if (!overwrite)
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- // Wait for the actual download to happen.
- base::RunLoop().RunUntilIdle();
- // Wait for the FileMove to happen.
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- base::RunLoop().RunUntilIdle();
+ content::RunAllBlockingPoolTasksUntilIdle();
}
private:
base::ScopedTempDir dir_;
base::FilePath path_;
- base::MessageLoop message_loop_;
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
scoped_refptr<net::TestURLRequestContextGetter> request_context_;
net::FakeURLFetcherFactory url_fetcher_factory_;
};
« no previous file with comments | « chrome/browser/net/file_downloader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698