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

Issue 401623006: Extract ScopedTestNSSDB from nss_util. (Closed)

Created:
6 years, 5 months ago by pneubeck (no reviews)
Modified:
6 years, 4 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, stevenjb+watch_chromium.org, oshima+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

Extract ScopedTestNSSDB from nss_util. Before ScopedTestNSSDB affected several slot getters from nss_util.h . This change reduces ScopedTestNSSDB to solely setup a temporary test DB and not influencing the global state in nss_util anymore. As a replacement for some of its old behavior, a new ScopedTestSystemNSSKeySlot is added, which allows to override the slot returned by GetSystemNSSKeySlot(). With this change it's now possible to write tests that need both a user and system NSS DB by using ScopedTestSystemNSSKeySlot. As a side-effect, GetPersistentNSSKeySlot() is now compiled on !OS_CHROMEOS only. BUG=210525 (For include changes:) R=rsleevi@chromium.org TBR=nkostylev@chromium.org, stevenjb@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=285881

Patch Set 1 : #

Patch Set 2 : git cl format #

Total comments: 15

Patch Set 3 : Moved test classes to new crypto_test_support target. #

Patch Set 4 : Added a DCHECK to SetTestSystemKeySlot. #

Total comments: 17

Patch Set 5 : More documentation. #

Patch Set 6 : Updated build target. #

Patch Set 7 : Updated BUILD.gn files. #

Patch Set 8 : Fixed function call that was missed during renaming. #

Total comments: 6

Patch Set 9 : Fixed nits. #

Patch Set 10 : Fix chromeos_unittests #

Patch Set 11 : Fix BUILD.gn, minor cleanups. #

Patch Set 12 : Rebase required gyp change. #

Patch Set 13 : Again BUILD.gn changes. #

Patch Set 14 : Missing dep in crypto/BUILD.gn . #

Patch Set 15 : Rebased. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+424 lines, -208 lines) Patch
M chrome/browser/chromeos/login/auth/parallel_authenticator_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/net/cert_verify_proc_chromeos_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/policy/policy_cert_verifier_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -1 line 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +8 lines, -1 line 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M chrome/chrome_tests_unit.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M chrome/common/net/x509_certificate_model_unittest.cc View 1 2 3 chunks +11 lines, -13 lines 0 comments Download
M chromeos/cert_loader_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chromeos/chromeos.gyp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M chromeos/network/client_cert_resolver_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chromeos/network/network_cert_migrator_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chromeos/network/network_connection_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M chromeos/network/onc/onc_certificate_importer_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M crypto/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +34 lines, -0 lines 0 comments Download
M crypto/crypto.gyp View 1 2 3 4 5 6 7 8 3 chunks +44 lines, -0 lines 0 comments Download
M crypto/nss_util.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +0 lines, -42 lines 0 comments Download
M crypto/nss_util.cc View 1 2 3 4 5 6 7 8 9 10 19 chunks +46 lines, -126 lines 2 comments Download
M crypto/nss_util_internal.h View 1 2 3 4 3 chunks +25 lines, -4 lines 0 comments Download
M crypto/rsa_private_key_nss_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
A crypto/scoped_test_nss_chromeos_user.h View 1 2 3 4 5 6 7 8 1 chunk +43 lines, -0 lines 0 comments Download
A crypto/scoped_test_nss_chromeos_user.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +37 lines, -0 lines 0 comments Download
A crypto/scoped_test_nss_db.h View 1 2 1 chunk +35 lines, -0 lines 0 comments Download
A crypto/scoped_test_nss_db.cc View 1 2 1 chunk +48 lines, -0 lines 0 comments Download
A crypto/scoped_test_system_nss_key_slot.h View 1 2 3 4 5 6 7 8 1 chunk +39 lines, -0 lines 0 comments Download
A crypto/scoped_test_system_nss_key_slot.cc View 1 2 3 4 5 6 7 1 chunk +28 lines, -0 lines 0 comments Download
M net/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M net/base/keygen_handler_unittest.cc View 2 chunks +3 lines, -4 lines 0 comments Download
M net/cert/nss_cert_database_chromeos_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M net/cert/nss_cert_database_unittest.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -7 lines 0 comments Download
M net/cert/nss_profile_filter_chromeos_unittest.cc View 1 2 1 chunk +1 line, -1 line 0 comments Download
M net/net.gyp View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M net/ssl/client_cert_store_chromeos_unittest.cc View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 39 (0 generated)
pneubeck (no reviews)
Finally, after over a week / seven CLs...
6 years, 5 months ago (2014-07-21 15:16:37 UTC) #1
Ryan Sleevi
https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h File crypto/nss_util.h (right): https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h#newcode156 crypto/nss_util.h:156: class CRYPTO_EXPORT_PRIVATE ScopedTestSystemNSSKeySlot { 1) Document more what this ...
6 years, 5 months ago (2014-07-22 01:25:32 UTC) #2
pneubeck (no reviews)
https://codereview.chromium.org/401623006/diff/80001/crypto/scoped_test_nss_db.h File crypto/scoped_test_nss_db.h (right): https://codereview.chromium.org/401623006/diff/80001/crypto/scoped_test_nss_db.h#newcode21 crypto/scoped_test_nss_db.h:21: // opened user DB is not automatically closed. On ...
6 years, 5 months ago (2014-07-22 06:23:27 UTC) #3
pneubeck (no reviews)
https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h File crypto/nss_util.h (right): https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h#newcode156 crypto/nss_util.h:156: class CRYPTO_EXPORT_PRIVATE ScopedTestSystemNSSKeySlot { On 2014/07/22 01:25:32, Ryan Sleevi ...
6 years, 5 months ago (2014-07-22 08:34:30 UTC) #4
Ryan Sleevi
https://codereview.chromium.org/401623006/diff/80001/crypto/scoped_test_nss_db.h File crypto/scoped_test_nss_db.h (right): https://codereview.chromium.org/401623006/diff/80001/crypto/scoped_test_nss_db.h#newcode21 crypto/scoped_test_nss_db.h:21: // opened user DB is not automatically closed. On ...
6 years, 5 months ago (2014-07-22 08:35:09 UTC) #5
pneubeck (no reviews)
https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h File crypto/nss_util.h (right): https://codereview.chromium.org/401623006/diff/80001/crypto/nss_util.h#newcode156 crypto/nss_util.h:156: class CRYPTO_EXPORT_PRIVATE ScopedTestSystemNSSKeySlot { One other reason why I ...
6 years, 5 months ago (2014-07-22 14:11:06 UTC) #6
pneubeck (no reviews)
This is still missing the update to the BUILD.gn files, which I will do soon.
6 years, 5 months ago (2014-07-22 17:10:25 UTC) #7
Ryan Sleevi
I think this is looking pretty good! The NSSCertDatabase changes I think are fine, but ...
6 years, 5 months ago (2014-07-23 02:15:29 UTC) #8
pneubeck (no reviews)
chrome_browser.gypi and chrome_tests_unit.gypi seem not to have a .gn equivalent. https://codereview.chromium.org/401623006/diff/140001/chrome/chrome_tests_unit.gypi File chrome/chrome_tests_unit.gypi (right): https://codereview.chromium.org/401623006/diff/140001/chrome/chrome_tests_unit.gypi#newcode498 ...
6 years, 5 months ago (2014-07-23 14:34:17 UTC) #9
Ryan Sleevi
LGTM % nits https://codereview.chromium.org/401623006/diff/220001/crypto/nss_util_internal.h File crypto/nss_util_internal.h (right): https://codereview.chromium.org/401623006/diff/220001/crypto/nss_util_internal.h#newcode60 crypto/nss_util_internal.h:60: // is NULL, the test system ...
6 years, 5 months ago (2014-07-24 23:14:02 UTC) #10
pneubeck (no reviews)
Thanks for reviewing! https://codereview.chromium.org/401623006/diff/220001/crypto/nss_util_internal.h File crypto/nss_util_internal.h (right): https://codereview.chromium.org/401623006/diff/220001/crypto/nss_util_internal.h#newcode60 crypto/nss_util_internal.h:60: // is NULL, the test system ...
6 years, 5 months ago (2014-07-25 08:35:14 UTC) #11
pneubeck (no reviews)
@Nikita, needs owner lgtm for include changes in tests.
6 years, 5 months ago (2014-07-25 08:35:51 UTC) #12
pneubeck (no reviews)
@Nikita, only necessary to look at chrome/browser/chromeos
6 years, 5 months ago (2014-07-25 08:36:56 UTC) #13
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-25 11:56:41 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/240001
6 years, 5 months ago (2014-07-25 11:57:24 UTC) #15
pneubeck (no reviews)
+Steven for chromeos/ include/build target changes
6 years, 5 months ago (2014-07-25 15:12:27 UTC) #16
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-25 15:12:46 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/260001
6 years, 5 months ago (2014-07-25 15:13:43 UTC) #18
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_aosp on tryserver.chromium ...
6 years, 5 months ago (2014-07-25 15:26:40 UTC) #19
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-25 15:28:28 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: ios_dbg_simulator on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/ios_dbg_simulator/builds/173855) ios_rel_device_ninja on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/ios_rel_device_ninja/builds/30445) mac_chromium_compile_dbg ...
6 years, 5 months ago (2014-07-25 15:28:29 UTC) #21
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-26 13:11:48 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/260001
6 years, 5 months ago (2014-07-26 13:13:54 UTC) #23
pneubeck (no reviews)
The CQ bit was unchecked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-26 13:18:33 UTC) #24
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-26 13:30:37 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/280001
6 years, 5 months ago (2014-07-26 13:32:07 UTC) #26
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 5 months ago (2014-07-26 14:17:13 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/300001
6 years, 5 months ago (2014-07-26 14:19:07 UTC) #28
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: android_chromium_gn_compile_rel on tryserver.chromium.linux ...
6 years, 5 months ago (2014-07-26 18:23:25 UTC) #29
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-26 18:27:35 UTC) #30
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromium_gn_compile_rel/builds/160) chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/149) linux_chromium_gn_rel ...
6 years, 5 months ago (2014-07-26 18:27:36 UTC) #31
pneubeck (no reviews)
The CQ bit was checked by pneubeck@chromium.org
6 years, 4 months ago (2014-07-27 15:43:42 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/pneubeck@chromium.org/401623006/320001
6 years, 4 months ago (2014-07-27 15:44:25 UTC) #33
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: chromium_presubmit on tryserver.chromium.linux ...
6 years, 4 months ago (2014-07-27 18:41:39 UTC) #34
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 4 months ago (2014-07-27 18:44:13 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/206)
6 years, 4 months ago (2014-07-27 18:44:15 UTC) #36
pneubeck (no reviews)
Committed patchset #15 manually as r285881.
6 years, 4 months ago (2014-07-28 09:56:59 UTC) #37
mattm
https://codereview.chromium.org/401623006/diff/360001/crypto/nss_util.cc File crypto/nss_util.cc (right): https://codereview.chromium.org/401623006/diff/360001/crypto/nss_util.cc#newcode580 crypto/nss_util.cc:580: test_system_slot_ = slot.Pass(); since the value may have already ...
6 years, 4 months ago (2014-07-29 23:12:54 UTC) #38
pneubeck (no reviews)
6 years, 4 months ago (2014-07-30 07:51:27 UTC) #39
Message was sent while issue was closed.
https://codereview.chromium.org/401623006/diff/360001/crypto/nss_util.cc
File crypto/nss_util.cc (right):

https://codereview.chromium.org/401623006/diff/360001/crypto/nss_util.cc#newc...
crypto/nss_util.cc:580: test_system_slot_ = slot.Pass();
On 2014/07/29 23:12:54, mattm wrote:
> since the value may have already been referenced by tpm_slot_, just NULLing
> test_system_slot_ here seems like it would usually have no noticeable effect.
Yeah, I realized this finally too. (it wasn't used in this CL yet)
In the current pending CL this is addressed:
https://codereview.chromium.org/424523002/diff/180001/crypto/nss_util.cc

Powered by Google App Engine
This is Rietveld 408576698