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

Issue 2592173002: Fix ios_chrome_unittests to crash on DCHECK failure. (Closed)

Created:
4 years ago by sdefresne
Modified:
4 years ago
CC:
chromium-reviews, pkl (ping after 24h if needed), asvitkine+watch_chromium.org, sdefresne+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix ios_chrome_unittests to crash on DCHECK failure. In CollectionViewModelTest.InvalidIndexPath, the global assert logger was overridden to ignore assertion but never restored to the default value, causing all subsequent DCHECK failures to be ignored. This CL fixes this incorrect behaviour by restoring the global assert logger at the end of the test execution and by fixing all the tests that were silently broken. List of individual test fixes: - introduce an helper class to wait for the PersonalDataManager async tasks to complete and use it in autofill tests interacting with the PersonalDataManager (without the wait, the SQL database is closed while some operations are pending and they fails with NOTREACHED() when they finally get scheduled) - remove individual registration of a SingleThreadTaskRunner with the metrics system as there is no way to unregister the task runner once it is set and instead register one globally in IOSChromeUnitTestSuite - add a function to reset the global hidden startup attemp count as the CrashLoopDetectionUtilTest.FullCycle test expect the hidden value to be uninitialised which is not the case (as some test do initialise it as a side-effect of creating the AppState) - register a local state with the TestingApplicationContext as production code exercised by PrivacyCollectionViewControllerTest.TestModel test expect to register preference listener on the local state BUG=650811 Committed: https://crrev.com/37302ec073c605e19030b0d58a0bd0b6a30d0434 Cr-Commit-Position: refs/heads/master@{#440413}

Patch Set 1 #

Patch Set 2 : Rebase on https://codereview.chromium.org/2591823003/ as it fix some DCHECKs. #

Total comments: 2

Patch Set 3 : Rebase #

Total comments: 8

Patch Set 4 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+165 lines, -33 lines) Patch
M ios/chrome/browser/crash_loop_detection_util.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M ios/chrome/browser/crash_loop_detection_util.mm View 2 chunks +6 lines, -1 line 0 comments Download
M ios/chrome/browser/crash_loop_detection_util_unittest.mm View 1 chunk +2 lines, -0 lines 0 comments Download
M ios/chrome/browser/metrics/first_user_action_recorder.cc View 1 chunk +0 lines, -2 lines 0 comments Download
M ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm View 2 chunks +1 line, -4 lines 0 comments Download
M ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm View 2 chunks +2 lines, -1 line 0 comments Download
M ios/chrome/browser/ui/ntp/notification_promo_whats_new_unittest.mm View 4 chunks +20 lines, -8 lines 0 comments Download
M ios/chrome/browser/ui/settings/BUILD.gn View 1 chunk +3 lines, -0 lines 0 comments Download
M ios/chrome/browser/ui/settings/autofill_collection_view_controller_unittest.mm View 1 2 3 6 chunks +33 lines, -16 lines 0 comments Download
M ios/chrome/browser/ui/settings/autofill_profile_edit_collection_view_controller_unittest.mm View 1 2 3 3 chunks +3 lines, -0 lines 0 comments Download
A ios/chrome/browser/ui/settings/personal_data_manager_data_changed_observer.h View 1 2 3 1 chunk +45 lines, -0 lines 0 comments Download
A ios/chrome/browser/ui/settings/personal_data_manager_data_changed_observer.cc View 1 2 3 1 chunk +33 lines, -0 lines 0 comments Download
M ios/chrome/browser/ui/settings/privacy_collection_view_controller_unittest.mm View 2 chunks +2 lines, -0 lines 0 comments Download
M ios/chrome/test/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M ios/chrome/test/ios_chrome_unit_test_suite.h View 2 chunks +3 lines, -0 lines 0 comments Download
M ios/chrome/test/ios_chrome_unit_test_suite.mm View 3 chunks +8 lines, -1 line 0 comments Download

Messages

Total messages: 32 (22 generated)
sdefresne
Please take a look and send to CQ if LGTY.
4 years ago (2016-12-21 18:36:49 UTC) #3
sdefresne
I know that this CL is large, but it only touches test code (except for ...
4 years ago (2016-12-21 18:38:35 UTC) #5
justincohen
ios/chrome/browser/crash* LGTM https://codereview.chromium.org/2592173002/diff/20001/ios/chrome/browser/crash_loop_detection_util.h File ios/chrome/browser/crash_loop_detection_util.h (right): https://codereview.chromium.org/2592173002/diff/20001/ios/chrome/browser/crash_loop_detection_util.h#newcode28 ios/chrome/browser/crash_loop_detection_util.h:28: // Resests the hidden state of failed ...
4 years ago (2016-12-21 20:03:08 UTC) #11
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/2592173002/40001
4 years ago (2016-12-22 12:53:55 UTC) #18
sdefresne
https://codereview.chromium.org/2592173002/diff/20001/ios/chrome/browser/crash_loop_detection_util.h File ios/chrome/browser/crash_loop_detection_util.h (right): https://codereview.chromium.org/2592173002/diff/20001/ios/chrome/browser/crash_loop_detection_util.h#newcode28 ios/chrome/browser/crash_loop_detection_util.h:28: // Resests the hidden state of failed startup attempt ...
4 years ago (2016-12-22 12:54:22 UTC) #19
noyau (Ping after 24h)
lgtm https://codereview.chromium.org/2592173002/diff/40001/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm File ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm (right): https://codereview.chromium.org/2592173002/diff/40001/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm#newcode305 ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm:305: logging::SetLogAssertHandler(&LogSink); Suggestions: This would probably be better is ...
4 years ago (2016-12-22 13:17:23 UTC) #21
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/2592173002/60001
4 years ago (2016-12-22 13:28:09 UTC) #26
sdefresne
https://codereview.chromium.org/2592173002/diff/40001/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm File ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm (right): https://codereview.chromium.org/2592173002/diff/40001/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm#newcode305 ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm:305: logging::SetLogAssertHandler(&LogSink); On 2016/12/22 13:17:22, noyau wrote: > Suggestions: This ...
4 years ago (2016-12-22 13:28:12 UTC) #27
commit-bot: I haz the power
Committed patchset #4 (id:60001)
4 years ago (2016-12-22 14:28:37 UTC) #30
commit-bot: I haz the power
4 years ago (2016-12-22 14:31:13 UTC) #32
Message was sent while issue was closed.
Patchset 4 (id:??) landed as
https://crrev.com/37302ec073c605e19030b0d58a0bd0b6a30d0434
Cr-Commit-Position: refs/heads/master@{#440413}

Powered by Google App Engine
This is Rietveld 408576698