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

Issue 2950353002: [Payments] Avoid a crash caused by AddressValidatorTest. (Closed)

Created:
3 years, 6 months ago by Parastoo
Modified:
3 years, 5 months ago
Reviewers:
Mathieu, sebsg
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Problem: AddressValidatorTest.SubKeysNotLoaded would crash, because AddressValidator would not handle the synchronous cases. The DCHECK in ThreadTaskRunnerHandle::Get() causes the crash, and it should. Solution: Since the process of loading rules should always be asynchronous, there should be no check in the RulesLoaded, the later DCHECK would serve the purpose. Therefore, change the unit-test country code from "ZZ" to "OZ", because the data for ZZ can't be parsed, and the success = 0, and since the tests are synchronous, there would be a crash. For "OZ", there is no data, therefore success = 1, but there would be no rules loaded for that, which serves the purpose. ASSERT_EQ(success, status == AddressValidator::SUCCESS) is changed, because for the case of AddressValidator::RULES_UNAVAILABLE, success == true, but status != AddressValidator::SUCCESS. Also, since the AddressValidatorTest loads rules synchronously, success should always be true, or there will be a crash. Add an extra check in this unittest, to make sure that the rules are not loaded. Rename SubKeysNotLoaded to SubKeysNotExists, to be clear that no data exists for this country code. BUG=735036 Review-Url: https://codereview.chromium.org/2950353002 Cr-Commit-Position: refs/heads/master@{#483488} Committed: https://chromium.googlesource.com/chromium/src/+/1ccce34079720f94e410b5409e601b9d30ebe09b

Patch Set 1 : No retry for synchronous. #

Patch Set 2 : Rename. Re-example. #

Total comments: 4

Patch Set 3 : Change the damn line 78. #

Patch Set 4 : Crash if you have to. (Undo Patch Set 1.) #

Total comments: 1

Patch Set 5 : Remove a comment. #

Total comments: 4

Patch Set 6 : Nit. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+13 lines, -4 lines) Patch
M third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc View 1 2 3 4 5 5 chunks +13 lines, -4 lines 0 comments Download

Messages

Total messages: 90 (72 generated)
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2950353002/1
3 years, 6 months ago (2017-06-22 16:46:59 UTC) #6
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started once the ...
3 years, 6 months ago (2017-06-22 16:47:01 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2950353002/2
3 years, 6 months ago (2017-06-22 17:42:41 UTC) #11
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started once the ...
3 years, 6 months ago (2017-06-22 17:42:42 UTC) #13
Hirondelle
mathp@chromium.org: Please review changes in
3 years, 6 months ago (2017-06-22 17:43:34 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2950353002/30001
3 years, 6 months ago (2017-06-23 15:51:38 UTC) #27
commit-bot: I haz the power
No L-G-T-M from a valid reviewer yet. CQ run can only be started once the ...
3 years, 6 months ago (2017-06-23 15:51:40 UTC) #29
Mathieu
+Seb because he's been looking at synchronous
3 years, 6 months ago (2017-06-23 15:54:11 UTC) #31
sebsg
https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc File third_party/libaddressinput/chromium/chrome_address_validator.cc (right): https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc#newcode167 third_party/libaddressinput/chromium/chrome_address_validator.cc:167: if (base::ThreadTaskRunnerHandle::IsSet()) { I don't think we should modify ...
3 years, 6 months ago (2017-06-23 17:26:04 UTC) #32
Hirondelle
https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc File third_party/libaddressinput/chromium/chrome_address_validator.cc (right): https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc#newcode167 third_party/libaddressinput/chromium/chrome_address_validator.cc:167: if (base::ThreadTaskRunnerHandle::IsSet()) { On 2017/06/23 17:26:04, sebsg wrote: > ...
3 years, 6 months ago (2017-06-23 20:30:11 UTC) #34
sebsg
https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc File third_party/libaddressinput/chromium/chrome_address_validator.cc (right): https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc#newcode167 third_party/libaddressinput/chromium/chrome_address_validator.cc:167: if (base::ThreadTaskRunnerHandle::IsSet()) { On 2017/06/23 20:30:11, Hirondelle wrote: > ...
3 years, 6 months ago (2017-06-23 21:59:32 UTC) #35
Parastoo
3 years, 5 months ago (2017-06-27 18:14:01 UTC) #46
Parastoo
https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc File third_party/libaddressinput/chromium/chrome_address_validator.cc (right): https://codereview.chromium.org/2950353002/diff/30001/third_party/libaddressinput/chromium/chrome_address_validator.cc#newcode167 third_party/libaddressinput/chromium/chrome_address_validator.cc:167: if (base::ThreadTaskRunnerHandle::IsSet()) { On 2017/06/23 21:59:32, sebsg wrote: > ...
3 years, 5 months ago (2017-06-27 18:14:31 UTC) #47
sebsg
lgtm % small comment. Good job! https://codereview.chromium.org/2950353002/diff/120001/third_party/libaddressinput/chromium/chrome_address_validator.cc File third_party/libaddressinput/chromium/chrome_address_validator.cc (right): https://codereview.chromium.org/2950353002/diff/120001/third_party/libaddressinput/chromium/chrome_address_validator.cc#newcode166 third_party/libaddressinput/chromium/chrome_address_validator.cc:166: // No need ...
3 years, 5 months ago (2017-06-29 18:45:41 UTC) #64
Mathieu
lgtm with nits https://codereview.chromium.org/2950353002/diff/160001/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc File third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc (right): https://codereview.chromium.org/2950353002/diff/160001/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc#newcode82 third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc:82: ASSERT_EQ(success, status == expected_status_); I think ...
3 years, 5 months ago (2017-06-29 19:11:25 UTC) #70
Parastoo
https://codereview.chromium.org/2950353002/diff/160001/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc File third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc (right): https://codereview.chromium.org/2950353002/diff/160001/third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc#newcode82 third_party/libaddressinput/chromium/chrome_address_validator_unittest.cc:82: ASSERT_EQ(success, status == expected_status_); On 2017/06/29 19:11:25, Mathieu wrote: ...
3 years, 5 months ago (2017-06-29 21:13:24 UTC) #84
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2950353002/220001
3 years, 5 months ago (2017-06-29 21:14:13 UTC) #87
commit-bot: I haz the power
3 years, 5 months ago (2017-06-29 21:19:17 UTC) #90
Message was sent while issue was closed.
Committed patchset #6 (id:220001) as
https://chromium.googlesource.com/chromium/src/+/1ccce34079720f94e410b5409e60...

Powered by Google App Engine
This is Rietveld 408576698