diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc index e6afdb66ffc..e7616dd17f1 100644 --- a/src/components/application_manager/test/mobile_message_handler_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_test.cc @@ -128,7 +128,7 @@ class MobileMessageHandlerTest : public testing::Test { // Act size_t payload_size = data.size(); - const auto message = std::shared_ptr(HandleIncomingMessage( + const auto message = std::unique_ptr(HandleIncomingMessage( protocol_version, json_plus_binary_data, payload_size)); // Checks @@ -148,7 +148,7 @@ class MobileMessageHandlerTest : public testing::Test { // Arrange size_t payload_size = data.size(); size_t full_data_size = data.size() + PROTOCOL_HEADER_V2_SIZE; - const auto message = std::shared_ptr( + const auto message = std::unique_ptr( HandleIncomingMessage(protocol_version, data, payload_size)); // Checks @@ -197,7 +197,7 @@ class MobileMessageHandlerTest : public testing::Test { MobileMessage message_to_send = CreateMessageForSending( protocol_version, function_id, correlation_id, connection_key, data); // Act - std::shared_ptr result_message( + const std::unique_ptr result_message( MobileMessageHandler::HandleOutgoingMessageProtocol(message_to_send)); std::vector full_data = joiner >( @@ -218,9 +218,8 @@ class MobileMessageHandlerTest : public testing::Test { void TestHandlingOutgoingMessageProtocolWithBinaryData( const uint32_t protocol_version) { // Arrange - application_manager::BinaryData* bin_dat = - new application_manager::BinaryData; - bin_dat->push_back('\a'); + application_manager::BinaryData bin_dat; + bin_dat.push_back('\a'); const uint32_t function_id = 247u; const uint32_t correlation_id = 92u; @@ -231,16 +230,14 @@ class MobileMessageHandlerTest : public testing::Test { correlation_id, connection_key, data, - bin_dat); + &bin_dat); // Act - std::shared_ptr result_message( + const std::unique_ptr result_message( MobileMessageHandler::HandleOutgoingMessageProtocol(message_to_send)); std::vector full_data = joiner >( binary_header, binary_header + PROTOCOL_HEADER_V2_SIZE, data); size_t full_size = - sizeof(uint8_t) * full_data.size() + bin_dat->size() * sizeof(uint8_t); - - delete bin_dat; + sizeof(uint8_t) * full_data.size() + bin_dat.size() * sizeof(uint8_t); // Checks EXPECT_EQ(protocol_version, result_message->protocol_version()); diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc index 104854c282b..53a1e86268e 100644 --- a/src/components/application_manager/test/mobile_message_handler_v1_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc @@ -75,7 +75,7 @@ TEST(MobileMessageHandlerTestV1Test, data_json.length(), false); - std::shared_ptr ptr( + const std::unique_ptr ptr( MobileMessageHandler::HandleIncomingMessageProtocol(message)); ASSERT_TRUE(ptr.get()); @@ -98,7 +98,7 @@ TEST(MobileMessageHandlerTestV1Test, full_data.length(), false); - const auto ptr = std::shared_ptr( + const auto ptr = std::unique_ptr( MobileMessageHandler::HandleIncomingMessageProtocol(message)); ASSERT_TRUE(ptr.get()); @@ -121,7 +121,7 @@ TEST(MobileMessageHandlerTestV1Test, message->set_json_message(data_json); message->set_connection_key(connection_key_p1); - std::shared_ptr ptr( + const std::unique_ptr ptr( MobileMessageHandler::HandleOutgoingMessageProtocol(message)); ASSERT_TRUE(ptr.get()); diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc index 63add647aaa..df2fa62ee21 100644 --- a/src/components/application_manager/test/resumption/resumption_data_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_test.cc @@ -57,44 +57,58 @@ ResumptionDataTest::~ResumptionDataTest() { delete submenu.second; } + test_submenu_map.clear(); + for (auto& command : test_commands_map) { delete command.second; } + test_commands_map.clear(); + for (auto& choiceset : test_choiceset_map) { delete choiceset.second; } + test_choiceset_map.clear(); + if (help_prompt_) { delete help_prompt_; + help_prompt_ = nullptr; } if (timeout_prompt_) { delete timeout_prompt_; + timeout_prompt_ = nullptr; } if (vr_help_) { delete vr_help_; + vr_help_ = nullptr; } if (vr_help_title_) { delete vr_help_title_; + vr_help_title_ = nullptr; } if (vr_synonyms_) { delete vr_synonyms_; + vr_synonyms_ = nullptr; } if (keyboard_props_) { delete keyboard_props_; + keyboard_props_ = nullptr; } if (menu_title_) { delete menu_title_; + menu_title_ = nullptr; } if (menu_icon_) { delete menu_icon_; + menu_icon_ = nullptr; } }