Fix handling of `--without-osx-keychain`

Refs: #3338
Change-Id: Ib9f7ff94d7436d618c5e9055f59b71f1e41893d5
diff --git a/tests/unit/security/key-chain.t.cpp b/tests/unit/security/key-chain.t.cpp
index ef1646b..98a0721 100644
--- a/tests/unit/security/key-chain.t.cpp
+++ b/tests/unit/security/key-chain.t.cpp
@@ -99,7 +99,7 @@
   KeyChain keyChain;
   BOOST_CHECK_EQUAL(keyChain.getPib().getPibLocator(), "pib-memory:");
 
-#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS)
+#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) && defined(NDN_CXX_WITH_OSX_KEYCHAIN)
   BOOST_CHECK_EQUAL(keyChain.getPib().getTpmLocator(), "tpm-osxkeychain:");
   BOOST_CHECK_EQUAL(keyChain.getTpm().getTpmLocator(), "tpm-osxkeychain:");
 #else
diff --git a/tests/unit/security/tpm/back-end.t.cpp b/tests/unit/security/tpm/back-end.t.cpp
index e6f78e7..78f09e3 100644
--- a/tests/unit/security/tpm/back-end.t.cpp
+++ b/tests/unit/security/tpm/back-end.t.cpp
@@ -53,9 +53,9 @@
 using tpm::Tpm;
 
 using TestBackEnds = boost::mpl::vector<
-#ifdef NDN_CXX_HAVE_OSX_FRAMEWORKS
+#if defined(NDN_CXX_HAVE_OSX_FRAMEWORKS) && defined(NDN_CXX_WITH_OSX_KEYCHAIN)
   BackEndWrapperOsx,
-#endif // NDN_CXX_HAVE_OSX_FRAMEWORKS
+#endif
   BackEndWrapperMem,
   BackEndWrapperFile>;