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

Unified Diff: components/precache/core/precache_database_unittest.cc

Issue 2846723005: Use ScopedTaskEnvironment instead of MessageLoopForUI in components tests. (Closed)
Patch Set: fix-test-errors 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
Index: components/precache/core/precache_database_unittest.cc
diff --git a/components/precache/core/precache_database_unittest.cc b/components/precache/core/precache_database_unittest.cc
index 233c2d0ce66aaa3c64af397d1752051aea94a51e..4fca60e72e33709be092668ee3ccf198c1d91369 100644
--- a/components/precache/core/precache_database_unittest.cc
+++ b/components/precache/core/precache_database_unittest.cc
@@ -17,6 +17,7 @@
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram_base.h"
#include "base/test/histogram_tester.h"
+#include "base/test/scoped_task_environment.h"
#include "base/time/time.h"
#include "components/history/core/browser/history_constants.h"
#include "net/http/http_response_headers.h"
@@ -89,7 +90,9 @@ namespace precache {
class PrecacheDatabaseTest : public testing::Test {
public:
- PrecacheDatabaseTest() {}
+ PrecacheDatabaseTest()
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI) {}
~PrecacheDatabaseTest() override {}
protected:
@@ -147,9 +150,7 @@ class PrecacheDatabaseTest : public testing::Test {
// Must be declared first so that it is destroyed last.
base::ScopedTempDir scoped_temp_dir_;
- // Having this MessageLoop member variable causes base::MessageLoop::current()
- // to be set properly.
- base::MessageLoopForUI loop_;
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<PrecacheDatabase> precache_database_;
base::HistogramTester histograms_;

Powered by Google App Engine
This is Rietveld 408576698