summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSho Amano <samano@xevo.com>2020-06-07 03:16:45 +0900
committerGitHub <noreply@github.com>2020-06-06 14:16:45 -0400
commit0ea35cc1194237479675acb5b148b055854d365b (patch)
treef9e27232350ccbf2cf5a04156e2c55581100503e
parentc9f0ee4784c308ffc0d8184df764a7a0aa1ab1bc (diff)
downloadsdl_core-0ea35cc1194237479675acb5b148b055854d365b.tar.gz
fix: memory leaks in data_resumption_test (#2273)
This issue only affects unit testing. Co-authored-by: Collin <iCollin@users.noreply.github.com>
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h11
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc27
2 files changed, 37 insertions, 1 deletions
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index dd6529d872..e38b428877 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -63,7 +63,15 @@ using namespace mobile_apis;
class ResumptionDataTest : public ::testing::Test {
protected:
ResumptionDataTest()
- : kCountOfCommands_(5u)
+ : help_prompt_(NULL)
+ , timeout_prompt_(NULL)
+ , vr_help_(NULL)
+ , vr_help_title_(NULL)
+ , vr_synonyms_(NULL)
+ , keyboard_props_(NULL)
+ , menu_title_(NULL)
+ , menu_icon_(NULL)
+ , kCountOfCommands_(5u)
, kCountOfChoice_(2u)
, kCountOfChoiceSets_(4u)
, kCountOfSubmenues_(3u)
@@ -77,6 +85,7 @@ class ResumptionDataTest : public ::testing::Test {
, ivilock_ptr_(std::make_shared<sync_primitives::Lock>())
, window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {
}
+ virtual ~ResumptionDataTest();
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
// Set data for resumption
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 e362064a78..12a38e1bc4 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -52,6 +52,33 @@ using ::testing::Return;
using ::testing::ReturnPointee;
using ::testing::ReturnRef;
+ResumptionDataTest::~ResumptionDataTest() {
+ delete help_prompt_;
+ delete timeout_prompt_;
+ delete vr_help_;
+ delete vr_help_title_;
+ delete vr_synonyms_;
+ delete keyboard_props_;
+ delete menu_title_;
+ delete menu_icon_;
+
+ for (am::CommandsMap::iterator it = test_commands_map.begin();
+ test_commands_map.end() != it;
+ ++it) {
+ delete it->second;
+ }
+ for (am::SubMenuMap::iterator it = test_submenu_map.begin();
+ test_submenu_map.end() != it;
+ ++it) {
+ delete it->second;
+ }
+ for (am::ChoiceSetMap::iterator it = test_choiceset_map.begin();
+ test_choiceset_map.end() != it;
+ ++it) {
+ delete it->second;
+ }
+}
+
void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
EXPECT_EQ(policy_app_id_, resume_app_list[am::strings::app_id].asString());
EXPECT_EQ(grammar_id_, resume_app_list[am::strings::grammar_id].asUInt());