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

Unified Diff: third_party/libaddressinput/chromium/chrome_address_validator.cc

Issue 2950353002: [Payments] Avoid a crash caused by AddressValidatorTest. (Closed)
Patch Set: Rename. Re-example. 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
« no previous file with comments | « no previous file | third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libaddressinput/chromium/chrome_address_validator.cc
diff --git a/third_party/libaddressinput/chromium/chrome_address_validator.cc b/third_party/libaddressinput/chromium/chrome_address_validator.cc
index f76bcbd15fda6b170d7941f5f63842d5ea49afff..70d614a2b13469995edaaf036fd029450809eb40 100644
--- a/third_party/libaddressinput/chromium/chrome_address_validator.cc
+++ b/third_party/libaddressinput/chromium/chrome_address_validator.cc
@@ -163,10 +163,14 @@ void AddressValidator::RulesLoaded(bool success,
if (success || attempts_number_[region_code] + 1 >= kMaxAttemptsNumber)
return;
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
- FROM_HERE, base::Bind(&AddressValidator::RetryLoadRules,
- weak_factory_.GetWeakPtr(), region_code),
- GetBaseRetryPeriod() * pow(2, attempts_number_[region_code]++));
+ // No need to retry if it's synchronous (which means that it's a test.)
+ if (base::ThreadTaskRunnerHandle::IsSet()) {
sebsg 2017/06/23 17:26:04 I don't think we should modify the production code
Hirondelle 2017/06/23 20:30:11 Anyway, if it's synchronous, the next line would c
sebsg 2017/06/23 21:59:32 What I suggest is changing the expected status for
Parastoo 2017/06/27 18:14:31 Done.
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&AddressValidator::RetryLoadRules,
+ weak_factory_.GetWeakPtr(), region_code),
+ GetBaseRetryPeriod() * pow(2, attempts_number_[region_code]++));
+ }
}
void AddressValidator::RetryLoadRules(const std::string& region_code) {
« no previous file with comments | « no previous file | third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698