summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConlain Kelly <conlain.k@gmail.com>2018-08-01 13:49:21 -0400
committerConlain Kelly <conlain.k@gmail.com>2018-08-01 13:49:21 -0400
commitb2c29fb656e52925eb6fd0c07b808feec395577d (patch)
treec2dd500b0dd569cb2dfcfd0fd27cf1f107e1aa1f
parent1597c8d598835e87b6fd11647b3c010d07b53341 (diff)
downloadsdl_core-b2c29fb656e52925eb6fd0c07b808feec395577d.tar.gz
Cleanup comments, add a test for mixed vr commands
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc39
4 files changed, 45 insertions, 9 deletions
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 21d596fa03..73f49e3477 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -636,18 +636,16 @@ class MessageHelper {
ApplicationManager& app_mngr);
/**
- * @brief Stores whether a choice set has correct VRCommands
- * MIXED means some choices have VRCommands and others don't
+ * @brief Stores whether each choice in a set has the vrCommands parameter
+ * MIXED means some choices have vrCommands and others don't
* ALL means all do, NONE means none do
*/
enum ChoiceSetVRCommandsStatus { MIXED, ALL, NONE };
/**
* @brief Check whether each choice in the set has the vrCommands parameter
- * vrCommands is an all-or-none deal
* @param choice set to check
- * @return a ChoiceSetVRCommandsStatus representing the state of the choice
- * set
+ * @return a ChoiceSetVRCommandsStatus with the state of the choice set
*/
static ChoiceSetVRCommandsStatus CheckChoiceSetVRCommands(
const smart_objects::SmartObject& choice_set);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
index 4ae6c90a62..2d4cbc9afc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/perform_interaction_request.h
@@ -215,10 +215,7 @@ class PerformInteractionRequest
/**
* @brief Checks each choice in each set for having a VRcommands parameter
* @param app contains pointer to application.
- * @param choice_set_id_list_length contains amount
- * of choice set ids.
- * @param choice_set_id_list array of choice set ids
- * @return returns false request has choice sets with no vrCommands
+ * @return returns false if request has choice sets with no vrCommands
*/
bool CheckChoiceSetListVRCommands(app_mngr::ApplicationSharedPtr app);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index 48760b99e4..af6f0639c6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -163,6 +163,7 @@ void PerformInteractionRequest::Run() {
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
+
if (msg_params.keyExists(strings::vr_help)) {
if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
@@ -973,6 +974,7 @@ bool PerformInteractionRequest::CheckChoiceSetListVRCommands(
LOG4CXX_ERROR(
logger_,
"Couldn't find choiceset_id = " << choice_set_id_list[i].asInt());
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
return false;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 73f4470b38..5bf97898b5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -514,12 +514,51 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_WithoutVrCommands_SUCCESS) {
smart_objects::SmartObject* choice_set_id = NULL;
EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
+
+ // No VR commands
+ EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
command_->Run();
}
+TEST_F(CreateInteractionChoiceSetRequestTest, Run_WithMixedVrCommands_UNSUCCESS) {
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::image][am::strings::value] = kImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::choice_id] = kChoiceId1;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::secondary_image][am::strings::value] = kSecondImage;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][0]
+ [am::strings::vr_commands][0] = kVrCommands1;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::choice_id] = kChoiceId2;
+ (*message_)[am::strings::msg_params][am::strings::choice_set][1]
+ [am::strings::menu_name] = kMenuName;
+ (*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
+ kChoiceSetId;
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
+
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
+ .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
+
+ EXPECT_CALL(mock_message_helper_, CheckChoiceSetVRCommands(_))
+ .WillOnce(Return(am::MessageHelper::ChoiceSetVRCommandsStatus::MIXED));
+
+ smart_objects::SmartObject* choice_set_id = NULL;
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
+ .WillOnce(Return(choice_set_id));
+
+ EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
+
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)).Times(0);;
+
+ command_->Run();
+}
+
TEST_F(CreateInteractionChoiceSetRequestTest,
OnEvent_InvalidEventId_UNSUCCESS) {
Event event(hmi_apis::FunctionID::INVALID_ENUM);