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

Unified Diff: components/password_manager/core/browser/password_store_default_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/password_manager/core/browser/password_store_default_unittest.cc
diff --git a/components/password_manager/core/browser/password_store_default_unittest.cc b/components/password_manager/core/browser/password_store_default_unittest.cc
index f8239e5ceba581915b1d98ee6492bb5538786395..93e1793a3a65395db8674199d09c73d6c3f39abd 100644
--- a/components/password_manager/core/browser/password_store_default_unittest.cc
+++ b/components/password_manager/core/browser/password_store_default_unittest.cc
@@ -15,6 +15,7 @@
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/test/scoped_task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
#include "components/password_manager/core/browser/login_database.h"
@@ -97,21 +98,25 @@ class PasswordStoreDefaultTestDelegate {
base::FilePath test_login_db_file_path() const;
- base::MessageLoopForUI message_loop_;
+ base::test::ScopedTaskEnvironment scoped_task_environment_;
base::ScopedTempDir temp_dir_;
scoped_refptr<PasswordStoreDefault> store_;
DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefaultTestDelegate);
};
-PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate() {
+PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate()
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI) {
SetupTempDir();
store_ = CreateInitializedStore(
base::MakeUnique<LoginDatabase>(test_login_db_file_path()));
}
PasswordStoreDefaultTestDelegate::PasswordStoreDefaultTestDelegate(
- std::unique_ptr<LoginDatabase> database) {
+ std::unique_ptr<LoginDatabase> database)
+ : scoped_task_environment_(
+ base::test::ScopedTaskEnvironment::MainThreadType::UI) {
SetupTempDir();
store_ = CreateInitializedStore(std::move(database));
}

Powered by Google App Engine
This is Rietveld 408576698