summaryrefslogtreecommitdiff
path: root/src/components/security_manager/test/security_manager_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/security_manager/test/security_manager_test.cc')
-rw-r--r--src/components/security_manager/test/security_manager_test.cc49
1 files changed, 30 insertions, 19 deletions
diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc
index 21af54f67b..7906ae7006 100644
--- a/src/components/security_manager/test/security_manager_test.cc
+++ b/src/components/security_manager/test/security_manager_test.cc
@@ -122,7 +122,7 @@ class SecurityManagerTest : public ::testing::Test {
uint32_t dataSize,
const ServiceType serviceType) {
const RawMessagePtr rawMessagePtr(std::make_shared<RawMessage>(
- kKey, kProtocolVersion, data, dataSize, serviceType));
+ kKey, kProtocolVersion, data, dataSize, false, serviceType));
security_manager_->OnMessageReceived(rawMessagePtr);
}
/*
@@ -292,6 +292,7 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
EXPECT_CALL(mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_NOT_SUPPORTED),
+ false,
kIsFinal))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
@@ -307,8 +308,8 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
*/
TEST_F(SecurityManagerTest, OnMobileMessageSent) {
const uint8_t* data_param = NULL;
- const RawMessagePtr rawMessagePtr(
- std::make_shared<RawMessage>(kKey, kProtocolVersion, data_param, 0));
+ const RawMessagePtr rawMessagePtr(std::make_shared<RawMessage>(
+ kKey, kProtocolVersion, data_param, 0, false));
security_manager_->OnMobileMessageSent(rawMessagePtr);
}
/*
@@ -338,6 +339,7 @@ TEST_F(SecurityManagerTest, GetEmptyQuery) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ false,
kIsFinal));
// Call with NULL data
call_OnMessageReceived(NULL, 0, kSecureServiceType);
@@ -359,6 +361,7 @@ TEST_F(SecurityManagerTest, GetWrongJSONSize) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ false,
kIsFinal));
SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
SecurityQuery::INVALID_QUERY_ID);
@@ -388,6 +391,7 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_ID),
+ false,
kIsFinal))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
@@ -427,10 +431,11 @@ TEST_F(SecurityManagerTest, CreateSSLContext_ErrorCreateSSL) {
EXPECT_CALL(mock_session_observer,
ProtocolVersionUsed(connection_id, session_id, _))
.WillOnce(Return(true));
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
// Emulate SessionObserver and CryptoManager result
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
@@ -461,6 +466,7 @@ TEST_F(SecurityManagerTest, CreateSSLContext_SetSSLContextError) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_UNKNOWN_INTERNAL_ERROR),
+ false,
kIsFinal));
// Emulate SessionObserver and CryptoManager result
@@ -512,10 +518,11 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) {
ProtocolVersionUsed(connection_id, session_id, _))
.WillOnce(Return(true));
// Expect InternalError with ERROR_INTERNAL
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
// Expect notifying listeners (unsuccess)
EXPECT_CALL(*mock_sm_listener,
OnHandshakeDone(kKey, SSLContext::Handshake_Result_Fail))
@@ -550,10 +557,11 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) {
EXPECT_CALL(mock_session_observer, GetSSLContext(kKey, kControl))
.WillOnce(ReturnNull());
// Expect InternalError with ERROR_ID
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(
- InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), kIsFinal));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL),
+ false,
+ kIsFinal));
security_manager_->StartHandshake(kKey);
mock_sm_listener.release();
@@ -579,6 +587,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_WrongDataSize) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ false,
kIsFinal))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
@@ -611,6 +620,7 @@ TEST_F(SecurityManagerTest,
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_SERVICE_NOT_PROTECTED),
+ false,
kIsFinal))
.WillOnce(NotifyTestAsyncWaiter(&waiter));
times++;
@@ -665,6 +675,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) {
mock_protocol_handler,
SendMessageToMobileApp(
InternalErrorWithErrId(SecurityManager::ERROR_SSL_INVALID_DATA),
+ false,
kIsFinal))
.Times(handshake_emulates)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
@@ -743,9 +754,9 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) {
// Get size of raw message after
const size_t raw_message_size = 15;
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp(RawMessageEqSize(raw_message_size), kIsFinal))
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ RawMessageEqSize(raw_message_size), false, kIsFinal))
.Times(handshake_emulates)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += handshake_emulates;
@@ -872,7 +883,7 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_HandshakeFinished) {
.WillRepeatedly(DoAll(NotifyTestAsyncWaiter(&waiter), Return(true)));
times += 2; // matches to the number above
- EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, kIsFinal))
+ EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, false, kIsFinal))
.Times(2)
.WillRepeatedly(NotifyTestAsyncWaiter(&waiter));
times += 2; // matches to the number above