summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Keeler <jacob.keeler@livioradio.com>2017-02-09 14:44:22 -0500
committerGitHub <noreply@github.com>2017-02-09 14:44:22 -0500
commit1a1a89666729cb41bf9278e2fcd6a499d391f1ab (patch)
tree07878301ab88d949569f0955e2abc304ab8a91bf
parent235e73832d916b320d914c3aeb80bcb29b8b1ffd (diff)
parent5a8a0ac6f3f165cc4fc16a105a7406fc72022659 (diff)
downloadsdl_core-1a1a89666729cb41bf9278e2fcd6a499d391f1ab.tar.gz
Merge pull request #1272 from smartdevicelink/revert-1260-fix/FixAddSubMenuIconInvalidCase
Revert "Send INVALID_DATA in case SubMenuIcon is invalid" Revert "Add sub menu icon parameter"
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h14
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h1
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h1
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc43
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc12
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc36
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc27
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc1
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc263
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h4
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc18
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc43
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc23
-rw-r--r--src/components/interfaces/HMI_API.xml12
-rw-r--r--src/components/interfaces/MOBILE_API.xml10
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc3
16 files changed, 38 insertions, 473 deletions
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
index 806ca701c3..10e2628035 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/add_sub_menu_request.h
@@ -79,20 +79,6 @@ class AddSubMenuRequest : public CommandRequestImpl {
*/
bool CheckSubMenuName();
- /*
- * @brief Check if submenu icon is valid
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool CheckSubMenuIcon();
-
- /*
- * @brief Check if submenu icon is existed in storage folder
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool CheckMenuIconExistedInStorage();
-
DISALLOW_COPY_AND_ASSIGN(AddSubMenuRequest);
};
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
index eb427b6db8..d61baff7d2 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -63,7 +63,6 @@ extern const std::string kDeleteApplicationFilesArray;
extern const std::string kDeleteSubMenu;
extern const std::string kDeleteApplicationSubMenuArray;
extern const std::string kDeleteApplicationSubscribtionsArray;
-extern const std::string kDeleteImageFromSubMenu;
extern const std::string kDeleteImageFromCommands;
extern const std::string kDeleteVrCommands;
extern const std::string kDeleteCommands;
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 8c4085b6d6..c19b12fff6 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -103,7 +103,6 @@ extern const char* cmd_id;
extern const char* menu_params;
extern const char* menu_title;
extern const char* menu_icon;
-extern const char* sub_menu_icon;
extern const char* keyboard_properties;
extern const char* vr_commands;
extern const char* position;
diff --git a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
index 715f7a64e9..6838d1af7d 100644
--- a/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc
@@ -36,7 +36,6 @@
#include "application_manager/message_helper.h"
#include "application_manager/application.h"
#include "utils/helpers.h"
-#include "utils/file_system.h"
namespace application_manager {
@@ -95,16 +94,6 @@ void AddSubMenuRequest::Run() {
(*message_)[strings::msg_params][strings::menu_name];
msg_params[strings::app_id] = app->app_id();
- if (((*message_)[strings::msg_params].keyExists(strings::sub_menu_icon))) {
- if (!CheckSubMenuIcon()) {
- LOG4CXX_ERROR(logger_, "Sub-menu icon is not valid.");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
- msg_params[strings::sub_menu_icon] =
- (*message_)[strings::msg_params][strings::sub_menu_icon];
- }
-
SendHMIRequest(hmi_apis::FunctionID::UI_AddSubMenu, &msg_params, true);
}
@@ -134,9 +123,6 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
application->AddSubMenu(
(*message_)[strings::msg_params][strings::menu_id].asInt(),
(*message_)[strings::msg_params]);
- if (!CheckMenuIconExistedInStorage()) {
- response_info = "Reference image(s) not found";
- }
}
SendResponse(result,
MessageHelper::HMIToMobileResult(result_code),
@@ -166,35 +152,6 @@ bool AddSubMenuRequest::CheckSubMenuName() {
return true;
}
-bool AddSubMenuRequest::CheckSubMenuIcon() {
- const std::string str =
- (*message_)[strings::msg_params][strings::sub_menu_icon][strings::value]
- .asString();
- if (!CheckSyntax(str) || std::string::npos != str.find(" ")) {
- LOG4CXX_ERROR(logger_, "Invalid menu icon syntax check failed.");
- return false;
- }
-
- return true;
-}
-
-bool AddSubMenuRequest::CheckMenuIconExistedInStorage() {
- if (!(*message_)[strings::msg_params].keyExists(strings::sub_menu_icon)) {
- return true;
- }
- std::string full_file_path =
- application_manager_.get_settings().app_storage_folder() + "/";
-
- full_file_path +=
- (*message_)[strings::msg_params][strings::sub_menu_icon][strings::value]
- .asString();
-
- if (!file_system::FileExists(full_file_path)) {
- return false;
- }
- return true;
-}
-
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 375fc4b6d9..bdae1459a8 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -1319,18 +1319,12 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- const smart_objects::SmartObject& message_body = *i->second;
+
msg_params[strings::menu_id] = i->first;
msg_params[strings::menu_params][strings::position] =
- message_body[strings::position];
- if ((message_body.keyExists(strings::sub_menu_icon)) &&
- (!message_body[strings::sub_menu_icon][strings::value].empty())) {
- msg_params[strings::sub_menu_icon] = message_body[strings::sub_menu_icon];
- msg_params[strings::sub_menu_icon][strings::value] =
- message_body[strings::sub_menu_icon][strings::value].asString();
- }
+ (*i->second)[strings::position];
msg_params[strings::menu_params][strings::menu_name] =
- message_body[strings::menu_name];
+ (*i->second)[strings::menu_name];
msg_params[strings::app_id] = app->app_id();
(*ui_sub_menu)[strings::msg_params] = msg_params;
requsets.push_back(ui_sub_menu);
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index c5890fcbc7..08de6d8190 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -833,27 +833,15 @@ bool ResumptionDataDB::SelectSubmenuData(
/* Position of data in "select_sub_menu" :
field "menuID" from table "subMenu" = 0
field "menuName" from table "subMenu" = 1
- field "position" from table "subMenu" = 2
- field "value" from table "image" = 3
- field "imageType" from table "image" = 4*/
+ field "position" from table "subMenu" = 2*/
uint32_t i = 0;
while (select_sub_menu.Next()) {
SmartObject array_item(SmartType_Map);
- SmartObject submenu_icon(SmartType_Map);
array_item[strings::menu_id] = select_sub_menu.GetInteger(0);
array_item[strings::menu_name] = select_sub_menu.GetString(1);
if (!(select_sub_menu.IsNull(2))) {
array_item[strings::position] = select_sub_menu.GetInteger(2);
}
- if (!(select_sub_menu.IsNull(3))) {
- submenu_icon[strings::value] = select_sub_menu.GetString(3);
- }
- if (!(select_sub_menu.IsNull(4))) {
- submenu_icon[strings::image_type] = select_sub_menu.GetInteger(4);
- }
- if (!submenu_icon.empty()) {
- array_item[strings::sub_menu_icon] = submenu_icon;
- }
saved_app[strings::application_submenus][i++] = array_item;
}
LOG4CXX_INFO(logger_, "Sub menu data was restored successfully");
@@ -1494,12 +1482,6 @@ bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id,
const std::string& device_id) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!ExecQueryToDeleteData(
- policy_app_id, device_id, kDeleteImageFromSubMenu)) {
- LOG4CXX_WARN(logger_, "Incorrect delete image from SubMenu.");
- return false;
- }
-
if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteSubMenu)) {
LOG4CXX_WARN(logger_, "Incorrect delete from subMenu.");
return false;
@@ -2055,26 +2037,12 @@ bool ResumptionDataDB::InsertSubMenuData(
/* Positions of binding data for "query_insert_submenu":
field "menuID" from table "submenu" = 0
field "menuName" from table "submenu" = 1
- field "position" from table "submenu" = 2
- field "idimage" from table "submenu" = 3*/
-
- int64_t image_primary_key = 0;
+ field "position" from table "submenu" = 2*/
for (size_t i = 0; i < length_submenu_array; ++i) {
query_insert_submenu.Bind(0, (submenus[i][strings::menu_id]).asInt());
query_insert_submenu.Bind(1, (submenus[i][strings::menu_name]).asString());
CustomBind(strings::position, submenus[i], query_insert_submenu, 2);
- if (submenus[i].keyExists(strings::sub_menu_icon)) {
- if (!ExecInsertImage(image_primary_key,
- submenus[i][strings::sub_menu_icon])) {
- LOG4CXX_WARN(logger_, "Problem with insert submenu icon to DB");
- return false;
- }
- query_insert_submenu.Bind(3, image_primary_key);
- } else {
- query_insert_submenu.Bind(3);
- }
-
if (!query_insert_submenu.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect insertion of submenu data");
return false;
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
index ac9090601d..5f318e6955 100644
--- a/src/components/application_manager/src/resumption/resumption_sql_queries.cc
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -63,14 +63,8 @@ const std::string kCreateSchema =
" `idsubMenu` INTEGER PRIMARY KEY NOT NULL, "
" `menuID` INTEGER, "
" `menuName` TEXT, "
- " `position` INTEGER, "
- " `idimage` INTEGER, "
- " CONSTRAINT `fk_image` "
- " FOREIGN KEY(`idimage`) "
- " REFERENCES `image`(`idimage`) "
+ " `position` INTEGER "
" ); "
- "CREATE INDEX IF NOT EXISTS "
- "`subMenu.fk_image_idx` ON `subMenu`(`idimage`); "
"CREATE TABLE IF NOT EXISTS `TTSChunk`( "
" `idTTSChunk` INTEGER PRIMARY KEY NOT NULL, "
" `type` INTEGER, "
@@ -499,16 +493,6 @@ const std::string kDeleteImageFromCommands =
"FROM `application` "
"WHERE `appID` = ? AND `deviceID` = ?)))";
-const std::string kDeleteImageFromSubMenu =
- "DELETE FROM `image` "
- "WHERE `idimage` IN (SELECT `idimage` "
- "FROM `subMenu` "
- "WHERE `idsubMenu` IN (SELECT `idsubMenu` "
- "FROM `applicationSubMenuArray` "
- "WHERE `idApplication` = (SELECT `idApplication` "
- "FROM `application` "
- "WHERE `appID` = ? AND `deviceID` = ?)))";
-
const std::string kDeleteVrCommands =
"DELETE FROM `vrCommandsArray` "
"WHERE `idcommand` IN (SELECT `idcommand` "
@@ -700,9 +684,9 @@ const std::string kInsertToApplicationFilesArray =
const std::string kInsertToSubMenu =
"INSERT INTO `subMenu` "
- "(`menuID`, `menuName`, `position`, `idimage`) "
+ "(`menuID`, `menuName`, `position`) "
"VALUES "
- "(?, ?, ?, ?);";
+ "(?, ?, ?);";
const std::string kInsertToApplicationSubMenuArray =
"INSERT INTO `applicationSubMenuArray` "
@@ -837,9 +821,8 @@ const std::string kSelectCountSubMenu =
"WHERE `appID` = ? AND `deviceID` = ?);";
const std::string kSelectSubMenu =
- "SELECT `menuID`, `menuName`, `position`, `value`, `imageType`"
- "FROM `subMenu` LEFT OUTER JOIN `image` ON "
- "`subMenu`.`idimage` = `image`.`idimage` "
+ "SELECT `menuID`, `menuName`, `position` "
+ "FROM `subMenu` "
"WHERE `idsubMenu` IN (SELECT `idsubMenu` "
"FROM `applicationSubMenuArray` "
"WHERE `idApplication` = (SELECT `idApplication` "
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 783f497212..279e967eda 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -70,7 +70,6 @@ const char* cmd_id = "cmdID";
const char* menu_params = "menuParams";
const char* menu_title = "menuTitle";
const char* menu_icon = "menuIcon";
-const char* sub_menu_icon = "subMenuIcon";
const char* keyboard_properties = "keyboardProperties";
const char* vr_commands = "vrCommands";
const char* position = "position";
diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
index 7349fbb533..95bcede5fa 100644
--- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
@@ -59,47 +59,18 @@ using am::MockMessageHelper;
using ::testing::_;
using ::testing::Mock;
using ::testing::Return;
-using ::testing::ReturnNull;
typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
namespace {
const uint32_t kConnectionKey = 2u;
-const int32_t kMenuId = 5;
} // namespace
class AddSubMenuRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
- protected:
+ public:
AddSubMenuRequestTest()
: mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- void SetUp() OVERRIDE {
- app = CreateMockApp();
- command_msg_ = CreateMessage(smart_objects::SmartType_Map);
-
- (*command_msg_)[am::strings::msg_params][am::strings::menu_id] = kMenuId;
- (*command_msg_)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
-
- ON_CALL(app_mngr_, hmi_interfaces())
- .WillByDefault(ReturnRef(hmi_interfaces_));
-
- ON_CALL(hmi_interfaces_,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
-
- ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
- .WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockAppPtr app;
- MessageSharedPtr command_msg_;
-
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
};
@@ -159,237 +130,7 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
-}
-
-TEST_F(AddSubMenuRequestTest, OnEvent_SUCCESS) {
- MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
- (*event_msg)[am::strings::params][am::hmi_response::code] =
- mobile_apis::Result::SUCCESS;
- (*event_msg)[am::strings::msg_params] = 0;
-
- Event event(hmi_apis::FunctionID::UI_AddSubMenu);
- event.set_smart_object(*event_msg);
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
-
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
- MessageSharedPtr result_msg(
- CatchMobileCommandResult(CallOnEvent(*command, event)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::SUCCESS, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest,
- OnEvent_SubMenuWithIcon_NotExistsInFolder_ExpectInfo) {
- // Message will be sent on hmi with icon that not exists in folder
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value] = "icon.png";
-
- MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
- (*event_msg)[am::strings::params][am::hmi_response::code] =
- mobile_apis::Result::WARNINGS;
- (*event_msg)[am::strings::msg_params] = 0;
-
- Event event(hmi_apis::FunctionID::UI_AddSubMenu);
- event.set_smart_object(*event_msg);
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
-
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
-
- EXPECT_CALL(app_mngr_, get_settings())
- .WillOnce(ReturnRef(app_mngr_settings_));
-
- const std::string file_storage = "test_storage";
- EXPECT_CALL(app_mngr_settings_, app_storage_folder())
- .WillOnce(ReturnRef(file_storage));
-
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::WARNINGS))
- .WillOnce(Return(mobile_apis::Result::WARNINGS));
-
- MessageSharedPtr result_msg(
- CatchMobileCommandResult(CallOnEvent(*command, event)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
-
- EXPECT_EQ(mobile_apis::Result::WARNINGS, received_result);
- const std::string received_info =
- (*result_msg)[am::strings::msg_params][am::strings::info].asString();
- const std::string expected_info = "Reference image(s) not found";
- EXPECT_EQ(expected_info, received_info);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
- EXPECT_CALL(app_mngr_, application(_))
- .WillOnce(Return(ApplicationSharedPtr()));
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>());
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_InvalidSubMenuId_UNSUCCESS) {
- MessageSharedPtr dummy_sub_menu(CreateMessage(smart_objects::SmartType_Null));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId))
- .WillOnce(Return(dummy_sub_menu.get()));
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::INVALID_ID, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_DuplicatedSubMenuName_UNSUCCESS) {
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
-
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
- EXPECT_CALL(*app, IsSubMenuNameAlreadyExist(_)).WillOnce(Return(true));
-
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::DUPLICATE_NAME, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_NotValidSubMenuName_UNSUCCESS) {
- // Not valid sub
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] = "\t\n";
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::INVALID_DATA, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] =
- "valid_sub_menu_name";
- (*command_msg_)[am::strings::msg_params][am::strings::position] =
- "test_position";
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
- const hmi_apis::FunctionID::eType received_result =
- static_cast<hmi_apis::FunctionID::eType>(
- (*result_msg)[am::strings::params][am::strings::function_id].asInt());
- EXPECT_EQ(hmi_apis::FunctionID::UI_AddSubMenu, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_MenuIconCorrectName_SUCCESS) {
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] =
- "valid_sub_menu_name";
- (*command_msg_)[am::strings::msg_params][am::strings::position] =
- "test_position";
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value] = "icon.png";
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::type] = "DYNAMIC";
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
- const hmi_apis::FunctionID::eType received_result =
- static_cast<hmi_apis::FunctionID::eType>(
- (*result_msg)[am::strings::params][am::strings::function_id].asInt());
- EXPECT_EQ(hmi_apis::FunctionID::UI_AddSubMenu, received_result);
-
- EXPECT_EQ("icon.png",
- (*result_msg)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value].asString());
-}
-
-TEST_F(AddSubMenuRequestTest, Run_MenuIconNewLineChar_SendINVALID_DATA) {
- // Not valid sub_menu_icon
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] =
- "valid_sub_menu_name";
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value] = "ico\nn.png";
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::INVALID_DATA, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_MenuIconTabChar_SendINVALID_DATA) {
- // Not valid sub_menu_icon
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] =
- "valid_sub_menu_name";
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value] = "ico\tn.png";
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::INVALID_DATA, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, Run_MenuIconWhiteSpace_SendINVALID_DATA) {
- (*command_msg_)[am::strings::msg_params][am::strings::menu_name] =
- "valid_sub_menu_name";
- (*command_msg_)[am::strings::msg_params][am::strings::sub_menu_icon]
- [am::strings::value] = "ico n.png";
-
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>(command_msg_));
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
- EXPECT_CALL(*app, FindSubMenu(kMenuId)).WillOnce(ReturnNull());
-
- MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
- const mobile_apis::Result::eType received_result =
- static_cast<mobile_apis::Result::eType>(
- (*result_msg)[am::strings::msg_params][am::strings::result_code]
- .asInt());
- EXPECT_EQ(mobile_apis::Result::INVALID_DATA, received_result);
-}
-
-TEST_F(AddSubMenuRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
- Event event(hmi_apis::FunctionID::INVALID_ENUM);
- AddSubMenuPtr command(CreateCommand<AddSubMenuRequest>());
-
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
-
- command->on_event(event);
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace add_sub_menu_request
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 3a67f8321a..436c8c165e 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
@@ -68,8 +68,7 @@ class ResumptionDataTest : public ::testing::Test {
, kCountOfSubmenues_(3u)
, kCountOfFiles_(8u)
, kCountOfVrhelptitle_(2u)
- , kMacAddress_("12345")
- , kSubmenuStartId_(10u) {}
+ , kMacAddress_("12345") {}
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
// Set data for resumption
@@ -131,7 +130,6 @@ class ResumptionDataTest : public ::testing::Test {
const size_t kCountOfFiles_;
const size_t kCountOfVrhelptitle_;
const std::string kMacAddress_;
- const size_t kSubmenuStartId_;
am::CommandsMap test_commands_map;
am::SubMenuMap test_submenu_map;
diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
index 294f0b60d6..aa4db59eac 100644
--- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
@@ -346,7 +346,7 @@ void ResumptionDataDBTest::CheckCharacters(int64_t global_properties_key) {
}
void ResumptionDataDBTest::CheckSubmenuData() {
- ::utils::dbms::SQLQuery select_submenu(test_db());
+ utils::dbms::SQLQuery select_submenu(test_db());
EXPECT_TRUE(select_submenu.Prepare(kSelectCountSubMenu));
BindId(select_submenu);
@@ -357,23 +357,13 @@ void ResumptionDataDBTest::CheckSubmenuData() {
BindId(select_submenu);
int i = 10;
while (select_submenu.Next()) {
- const uint32_t test_id =
- (*test_submenu_map[i])[am::strings::menu_id].asUInt();
- const std::string name =
+ uint32_t test_id = (*test_submenu_map[i])[am::strings::menu_id].asUInt();
+ std::string name =
(*test_submenu_map[i])[am::strings::menu_name].asString();
-
- const int position = (*test_submenu_map[i])[am::strings::position].asInt();
- const std::string image_value =
- (*test_submenu_map[i])[am::strings::sub_menu_icon][am::strings::value]
- .asString();
- const int image_type =
- (*test_submenu_map[i])[am::strings::sub_menu_icon]
- [am::strings::image_type].asInt();
+ int position = (*test_submenu_map[i])[am::strings::position].asInt();
EXPECT_EQ(test_id, select_submenu.GetUInteger(0));
EXPECT_EQ(name, select_submenu.GetString(1));
EXPECT_EQ(position, select_submenu.GetInteger(2));
- EXPECT_EQ(image_value, select_submenu.GetString(3));
- EXPECT_EQ(image_type, select_submenu.GetInteger(4));
i++;
}
}
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 80ab694bd2..79397f5175 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -122,29 +122,13 @@ void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
void ResumptionDataTest::CheckSubmenues(sm::SmartObject& res_list) {
for (uint32_t i = 0; i < kCountOfSubmenues_; ++i) {
uint32_t test_id =
- (*test_submenu_map[i + kSubmenuStartId_])[am::strings::menu_id]
- .asUInt();
+ (*test_submenu_map[i + 10])[am::strings::menu_id].asUInt();
std::string name =
- (*test_submenu_map[i + kSubmenuStartId_])[am::strings::menu_name]
- .asString();
- int position =
- (*test_submenu_map[i + kSubmenuStartId_])[am::strings::position]
- .asInt();
- std::string icon_name =
- (*test_submenu_map[i + kSubmenuStartId_])
- [am::strings::sub_menu_icon][am::strings::value].asString();
- int icon_type =
- (*test_submenu_map[i + kSubmenuStartId_])
- [am::strings::sub_menu_icon][am::strings::image_type].asInt();
+ (*test_submenu_map[i + 10])[am::strings::menu_name].asString();
+ int position = (*test_submenu_map[i + 10])[am::strings::position].asInt();
EXPECT_EQ(position, res_list[i][am::strings::position].asInt());
EXPECT_EQ(test_id, res_list[i][am::strings::menu_id].asUInt());
EXPECT_EQ(name, res_list[i][am::strings::menu_name].asString());
- EXPECT_EQ(
- icon_name,
- res_list[i][am::strings::sub_menu_icon][am::strings::value].asString());
- EXPECT_EQ(icon_type,
- res_list[i][am::strings::sub_menu_icon][am::strings::image_type]
- .asInt());
}
}
@@ -472,22 +456,17 @@ void ResumptionDataTest::SetCommands() {
}
void ResumptionDataTest::SetSubmenues() {
- sm::SmartObject so_submenu;
- for (size_t i = kSubmenuStartId_; i < kCountOfSubmenues_ + kSubmenuStartId_;
- ++i) {
+ sm::SmartObject sm_comm;
+ for (uint32_t i = 10; i < kCountOfSubmenues_ + 10; ++i) {
char numb[12];
- snprintf(numb, 12, "%lu", i);
- std::string numb_id(numb);
- so_submenu[am::strings::menu_id] = i;
- so_submenu[am::strings::position] = i;
- so_submenu[am::strings::menu_name] = "SubMenu" + numb_id;
- so_submenu[am::strings::sub_menu_icon][am::strings::value] =
- "submenuicon" + numb_id;
- so_submenu[am::strings::sub_menu_icon][am::strings::type] =
- ImageType::STATIC;
- test_submenu_map[i] = new sm::SmartObject(so_submenu);
+ std::snprintf(numb, 12, "%d", i);
+ sm_comm[am::strings::menu_id] = i;
+ sm_comm[am::strings::position] = i;
+ sm_comm[am::strings::menu_name] = "SubMenu" + std::string(numb);
+ test_submenu_map[i] = new sm::SmartObject(sm_comm);
}
}
+
void ResumptionDataTest::SetChoiceSet() {
sm::SmartObject choice_vector;
sm::SmartObject choice;
diff --git a/src/components/application_manager/test/resumption_sql_queries_test.cc b/src/components/application_manager/test/resumption_sql_queries_test.cc
index adc9c4e87d..08fa0a3eb5 100644
--- a/src/components/application_manager/test/resumption_sql_queries_test.cc
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -111,7 +111,6 @@ class ResumptionSqlQueriesTest : public ::testing::Test {
static const int ign_off_count2;
static const int timeStamp;
static const int timeStamp2;
- static const int image_key;
static void SetUpTestCase() {
db_ = new SQLDatabase();
@@ -230,8 +229,7 @@ class ResumptionSqlQueriesTest : public ::testing::Test {
SQLQuery& FillSubMenuTable(SQLQuery& query,
const int menuID,
const string& menuName,
- const int position,
- const int64_t image_id);
+ const int position);
SQLQuery& FillApplicationSubMenuArrayTable(SQLQuery& query,
const int app_key,
@@ -353,7 +351,6 @@ const int ResumptionSqlQueriesTest::ign_off_count = 3;
const int ResumptionSqlQueriesTest::ign_off_count2 = 4;
const int ResumptionSqlQueriesTest::timeStamp = 2015;
const int ResumptionSqlQueriesTest::timeStamp2 = 2016;
-const int ResumptionSqlQueriesTest::image_key = 4;
void ResumptionSqlQueriesTest::CheckDeleteQuery(const string& count_query,
const string& query_to_check,
@@ -712,13 +709,11 @@ SQLQuery& ResumptionSqlQueriesTest::FillFileTable(SQLQuery& query,
SQLQuery& ResumptionSqlQueriesTest::FillSubMenuTable(SQLQuery& query,
const int menuID,
const string& menuName,
- const int position,
- const int64_t image_id) {
+ const int position) {
EXPECT_TRUE(query.Prepare(kInsertToSubMenu));
query.Bind(0, menuID);
query.Bind(1, menuName);
query.Bind(2, position);
- query.Bind(3, image_id);
EXPECT_TRUE(query.Exec());
return query;
}
@@ -1346,8 +1341,7 @@ TEST_F(ResumptionSqlQueriesTest, kDeleteSubMenu_ExpectDataDeleted) {
device_id,
key).LastInsertId();
int64_t submenu_key =
- FillSubMenuTable(temp_query, 1, "tst_menuName", 2, image_key)
- .LastInsertId();
+ FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
FillApplicationSubMenuArrayTable(temp_query, key, submenu_key);
// Check
@@ -1379,8 +1373,7 @@ TEST_F(ResumptionSqlQueriesTest,
key).LastInsertId();
int64_t submenu_key =
- FillSubMenuTable(temp_query, 1, "tst_menuName", 2, image_key)
- .LastInsertId();
+ FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
FillApplicationSubMenuArrayTable(temp_query, key, submenu_key);
// Check
@@ -2114,7 +2107,7 @@ TEST_F(ResumptionSqlQueriesTest,
TEST_F(ResumptionSqlQueriesTest, kInsertToSubMenu_ExpectDataInserted) {
// Arrange
SQLQuery temp_query(db());
- FillSubMenuTable(temp_query, 1, "tst_menu", 3, image_key);
+ FillSubMenuTable(temp_query, 1, "tst_menu", 3);
// Checks
const std::string select_count_subMenu = "SELECT COUNT(*) FROM subMenu;";
CheckSelectQuery(select_count_subMenu, 1, 0);
@@ -2548,9 +2541,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectCountSubMenu_ExpectDataCorrect) {
app_id1,
device_id,
9).LastInsertId();
- int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
int64_t submenu_key =
- FillSubMenuTable(temp_query, 1, "menu_name", 1, key1).LastInsertId();
+ FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
FillApplicationSubMenuArrayTable(temp_query, app_key, submenu_key);
ValToPosPair p1(0, app_id1);
ValToPosPair p2(1, device_id);
@@ -2573,9 +2565,8 @@ TEST_F(ResumptionSqlQueriesTest, kSelectSubMenu_ExpectDataCorrect) {
app_id1,
device_id,
9).LastInsertId();
- int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
int64_t submenu_key =
- FillSubMenuTable(temp_query, 1, "menu_name", 1, key1).LastInsertId();
+ FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
FillApplicationSubMenuArrayTable(temp_query, app_key, submenu_key);
ValToPosPair p1(0, app_id1);
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 0757160947..2182496760 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -34,7 +34,7 @@
<interfaces name="SmartDeviceLink HMI API">
-<interface name="Common" version="1.5" date="2016-10-27">
+<interface name="Common" version="1.4" date="2016-05-11">
<enum name="Result">
<element name="SUCCESS" value="0"/>
@@ -539,9 +539,6 @@
<element name="locationImage">
<description>The optional image of a destination / location</description>
</element>
- <element name="subMenuIcon">
- <description>The image field for AddSubMenu </description>
- </element>
</enum>
<enum name="TextAlignment">
@@ -2739,7 +2736,7 @@
</function>
</interface>
-<interface name="UI" version="1.0" date="2016-10-27">
+<interface name="UI" version="1.0" date="2013-04-16">
<function name="Alert" messagetype="request">
<description>Request from SDL to show an alert message on the display.</description>
<param name="alertStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="3">
@@ -2845,11 +2842,6 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of application that requested this RPC.</description>
</param>
- <param name="subMenuIcon" type="Common.Image" mandatory="false">
- <description>
- If omited on supported displays, no (or the default if applicable) icon shall be displayed.
- </description>
- </param>
</function>
<function name="AddSubMenu" messagetype="response">
</function>
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index f8c12dcdda..3bf347b605 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -747,10 +747,6 @@
<description>The optional image of a destination / location</description>
</element>
- <element name="subMenuIcon">
- <description>The image field for AddSubMenu </description>
- </element>
-
</enum>
<enum name="CharacterSet">
@@ -2831,12 +2827,6 @@
<param name="menuName" maxlength="500" type="String">
<description>Text to show in the menu for this sub menu.</description>
</param>
-
- <param name="subMenuIcon" type="Image" mandatory="false">
- <description>
- If omited on supported displays, no (or the default if applicable) icon shall be displayed.
- </description>
- </param>
</function>
<function name="AddSubMenu" functionID="AddSubMenuID" messagetype="response">
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index 8c3fbe5178..3a4e9d6acb 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -314,8 +314,7 @@ void PolicyManagerImpl::StartPTExchange() {
if (RequestPTUpdate() && !timer_retry_sequence_.is_running()) {
// Start retry sequency
const int timeout_sec = NextRetryTimeout();
- LOG4CXX_DEBUG(logger_,
- "Start retry sequence timeout = " << timeout_sec);
+ LOG4CXX_DEBUG(logger_, "Start retry sequence timeout = " << timeout_sec);
timer_retry_sequence_.Start(timeout_sec, timer::kPeriodic);
}
}