summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin <iCollin@users.noreply.github.com>2021-01-25 09:29:26 -0500
committerGitHub <noreply@github.com>2021-01-25 09:29:26 -0500
commit76505bb328ab5ad7afcbeb5875706a86bf98d1c5 (patch)
treedcc5a15318cb8f746cbf5144ec0b3e72a64433b9
parent0aab5dbdcb0931fa85bd1e2230b5bfdc178ae4e3 (diff)
downloadsdl_core-76505bb328ab5ad7afcbeb5875706a86bf98d1c5.tar.gz
fix unit tests with with -DENABLE_SECURITY=OFF (#3615)
* include endian conversions in protocol handler tests even when security is off * exclude transport manager tests expecting call to ws_server_ca_cert_path when security is off * require ENABLE_SECURITY for ProcessFailedCertDecrypt * add return with assert for release mode
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h2
-rw-r--r--src/components/include/security_manager/security_manager.h2
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h2
-rw-r--r--src/components/include/test/security_manager/mock_security_manager.h2
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h2
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc2
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc2
-rw-r--r--src/components/security_manager/include/security_manager/security_manager_impl.h2
-rw-r--r--src/components/security_manager/src/security_manager_impl.cc2
-rw-r--r--src/components/transport_manager/test/websocket_server_listener_test.cc2
-rw-r--r--src/components/utils/src/logger/log4cxxlogger.cc1
11 files changed, 13 insertions, 8 deletions
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index c7ee670972..b9cc2e9700 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -146,7 +146,7 @@ class ProtocolHandler {
virtual void ProcessFailedPTU() = 0;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify security manager that
* certificate decryption failed in the external flow
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 358c4e5268..305ade2b47 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -170,7 +170,7 @@ class SecurityManager : public protocol_handler::ProtocolObserver,
virtual void ProcessFailedPTU() = 0;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify listeners that
* certificate decryption failed in the external flow
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index 94a9efd9e5..da71d9bc90 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -71,7 +71,7 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
MOCK_METHOD0(NotifyOnGetSystemTimeFailed, void());
MOCK_CONST_METHOD1(IsRPCServiceSecure, bool(const uint32_t connection_key));
MOCK_METHOD0(ProcessFailedPTU, void());
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
MOCK_METHOD0(ProcessFailedCertDecrypt, void());
#endif
};
diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h
index e44d6207c1..d6ef7d1bbd 100644
--- a/src/components/include/test/security_manager/mock_security_manager.h
+++ b/src/components/include/test/security_manager/mock_security_manager.h
@@ -75,7 +75,7 @@ class MockSecurityManager : public ::security_manager::SecurityManager {
MOCK_METHOD1(PostponeHandshake, void(const uint32_t));
MOCK_CONST_METHOD0(IsSystemTimeProviderReady, bool());
MOCK_METHOD0(ResetPendingSystemTimeRequests, void());
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
MOCK_METHOD0(ProcessFailedCertDecrypt, void());
#endif
};
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
index c79dbfcac3..e54608bb9e 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h
@@ -214,7 +214,7 @@ class ProtocolHandlerImpl
void ProcessFailedPTU() OVERRIDE;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify security manager that
* certificate decryption failed in the external flow
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index df499cd593..f3bb3d1e91 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -1169,7 +1169,7 @@ void ProtocolHandlerImpl::ProcessFailedPTU() {
#endif // ENABLE_SECURITY
}
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
void ProtocolHandlerImpl::ProcessFailedCertDecrypt() {
SDL_LOG_AUTO_TRACE();
security_manager_->ProcessFailedCertDecrypt();
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index b28dee2657..7f70b0cd81 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -47,6 +47,8 @@
#ifdef ENABLE_SECURITY
#include "security_manager/mock_security_manager.h"
#include "security_manager/mock_ssl_context.h"
+#else
+#include "utils/byte_order.h"
#endif // ENABLE_SECURITY
#include "transport_manager/mock_transport_manager.h"
#include "utils/mock_system_time_handler.h"
diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h
index 6e5fb08c20..7cbb19708e 100644
--- a/src/components/security_manager/include/security_manager/security_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/security_manager_impl.h
@@ -216,7 +216,7 @@ class SecurityManagerImpl : public SecurityManager,
void ProcessFailedPTU() OVERRIDE;
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
/**
* @brief ProcessFailedCertDecrypt is called to notify listeners that
* certificate decryption failed in the external flow
diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc
index 1bf10c4f7c..914d30003a 100644
--- a/src/components/security_manager/src/security_manager_impl.cc
+++ b/src/components/security_manager/src/security_manager_impl.cc
@@ -425,7 +425,7 @@ void SecurityManagerImpl::ProcessFailedPTU() {
}
}
-#ifdef EXTERNAL_PROPRIETARY_MODE
+#if defined(EXTERNAL_PROPRIETARY_MODE) && defined(ENABLE_SECURITY)
void SecurityManagerImpl::ProcessFailedCertDecrypt() {
SDL_LOG_AUTO_TRACE();
{
diff --git a/src/components/transport_manager/test/websocket_server_listener_test.cc b/src/components/transport_manager/test/websocket_server_listener_test.cc
index 7991c6f1cb..6e1af1ee1b 100644
--- a/src/components/transport_manager/test/websocket_server_listener_test.cc
+++ b/src/components/transport_manager/test/websocket_server_listener_test.cc
@@ -128,6 +128,7 @@ TEST_F(WebSocketListenerTest, StartListening_ClientConnect_SUCCESS) {
ws_client->Stop();
}
+#ifdef ENABLE_SECURITY
TEST_F(WebSocketListenerTest, StartListening_ClientConnectSecure_SUCCESS) {
const auto ws_listener = std::make_shared<WebSocketListener>(
&mock_ta_controller_, mock_tm_settings_, kNumThreads);
@@ -254,6 +255,7 @@ TEST_F(WebSocketListenerTest, StartListening_AcceptorIsOpen_SUCCESS) {
EXPECT_EQ(TransportAdapter::Error::OK, ws_listener->StartListening());
ws_client->Stop();
}
+#endif
} // namespace transport_manager_test
} // namespace components
diff --git a/src/components/utils/src/logger/log4cxxlogger.cc b/src/components/utils/src/logger/log4cxxlogger.cc
index 7d43892073..1e87d8cc53 100644
--- a/src/components/utils/src/logger/log4cxxlogger.cc
+++ b/src/components/utils/src/logger/log4cxxlogger.cc
@@ -90,6 +90,7 @@ log4cxx::LevelPtr getLogLevel(LogLevel log_level) {
return log4cxx::Level::getFatal();
default:
assert(false);
+ return log4cxx::Level::getTrace();
}
}