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

Unified Diff: components/password_manager/core/browser/affiliated_match_helper.cc

Issue 2657013002: Introduce ThreadTaskRunnerHandle::OverrideForTesting and TestMockTimeTaskRunner::ScopedContext. (Closed)
Patch Set: fix RecentTabHelperTest crash? Created 3 years, 10 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/affiliated_match_helper.cc
diff --git a/components/password_manager/core/browser/affiliated_match_helper.cc b/components/password_manager/core/browser/affiliated_match_helper.cc
index 191edb36d95dacbd352c680f4aebee33653adb87..b88033ad5b9aa00dafd4033f106d56692622eb24 100644
--- a/components/password_manager/core/browser/affiliated_match_helper.cc
+++ b/components/password_manager/core/browser/affiliated_match_helper.cc
@@ -33,13 +33,12 @@ bool IsAndroidApplicationCredential(const autofill::PasswordForm& form,
} // namespace
// static
-const int64_t AffiliatedMatchHelper::kInitializationDelayOnStartupInSeconds;
+constexpr base::TimeDelta AffiliatedMatchHelper::kInitializationDelayOnStartup;
AffiliatedMatchHelper::AffiliatedMatchHelper(
PasswordStore* password_store,
std::unique_ptr<AffiliationService> affiliation_service)
: password_store_(password_store),
- task_runner_for_waiting_(base::ThreadTaskRunnerHandle::Get()),
affiliation_service_(std::move(affiliation_service)),
weak_ptr_factory_(this) {}
@@ -51,10 +50,11 @@ AffiliatedMatchHelper::~AffiliatedMatchHelper() {
void AffiliatedMatchHelper::Initialize() {
DCHECK(password_store_);
DCHECK(affiliation_service_);
- task_runner_for_waiting_->PostDelayedTask(
- FROM_HERE, base::Bind(&AffiliatedMatchHelper::DoDeferredInitialization,
- weak_ptr_factory_.GetWeakPtr()),
- base::TimeDelta::FromSeconds(kInitializationDelayOnStartupInSeconds));
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&AffiliatedMatchHelper::DoDeferredInitialization,
+ weak_ptr_factory_.GetWeakPtr()),
+ kInitializationDelayOnStartup);
}
void AffiliatedMatchHelper::GetAffiliatedAndroidRealms(
@@ -144,11 +144,6 @@ bool AffiliatedMatchHelper::IsValidWebCredential(
facet_uri.IsValidWebFacetURI();
}
-void AffiliatedMatchHelper::SetTaskRunnerUsedForWaitingForTesting(
- const scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- task_runner_for_waiting_ = task_runner;
-}
-
void AffiliatedMatchHelper::DoDeferredInitialization() {
// Must start observing for changes at the same time as when the snapshot is
// taken to avoid inconsistencies due to any changes taking place in-between.

Powered by Google App Engine
This is Rietveld 408576698