summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc41
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc35
4 files changed, 62 insertions, 20 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index b4795dae21..d273ce8905 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -167,8 +167,7 @@ class AddCommandRequestTest
}
void CheckOnTimeOutCommandDeletion(
- const hmi_apis::FunctionID::eType incoming_cmd,
- const hmi_apis::FunctionID::eType cmd_to_delete) {
+ const hmi_apis::FunctionID::eType incoming_cmd) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& msg_params = (*msg_)[strings::msg_params];
@@ -209,9 +208,15 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
+
SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
@@ -598,13 +603,11 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
}
TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_VR_DeleteCommand) {
- CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::VR_AddCommand,
- hmi_apis::FunctionID::VR_DeleteCommand);
+ CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::VR_AddCommand);
}
TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_UI_DeleteCommand) {
- CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::UI_AddCommand,
- hmi_apis::FunctionID::UI_DeleteCommand);
+ CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::UI_AddCommand);
}
TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
@@ -744,7 +747,7 @@ TEST_F(AddCommandRequestTest,
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_HmiResponseCodeIsGenericError_VR_HmiResponseCodeIsUnsupportedResourse_ExpectCommandRemoved) {
+ OnEvent_UI_HmiResponseCodeIsGenericError_VR_HmiResponseCodeIsUnsupportedResource_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -788,7 +791,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_VR_HmiResponseCodeIsGenericError_UI_HmiResponseCodeIsUnsupportedResourse_ExpectCommandRemoved) {
+ OnEvent_VR_HmiResponseCodeIsGenericError_UI_HmiResponseCodeIsUnsupportedResource_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -833,7 +836,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResourse_UI_NotAvailableInterfaceState_ExpectCommandRemoved) {
+ OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResource_UI_NotAvailableInterfaceState_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -883,7 +886,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResourse_VR_NotAvailableInterfaceState_ExpectCommandRemoved) {
+ OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResource_VR_NotAvailableInterfaceState_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -1006,7 +1009,7 @@ TEST_F(
}
TEST_F(AddCommandRequestTest,
- OnEvent_UI_EventWithNotSuccesResponseCode_ExpectVRCommandDelete) {
+ OnEvent_UI_EventWithNotSuccessResponseCode_ExpectVRCommandDelete) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -1048,7 +1051,7 @@ TEST_F(AddCommandRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
+ EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
request_ptr->on_event(event_ui);
request_ptr->on_event(event_vr);
}
@@ -1091,7 +1094,7 @@ TEST_F(AddCommandRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
+ EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
MessageSharedPtr msg_vr = CreateMessage(SmartType_Map);
(*msg_vr)[strings::params][hmi_response::code] =
@@ -1157,6 +1160,15 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
+ .WillOnce(Return(true));
+
SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
@@ -1166,6 +1178,7 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
+
std::shared_ptr<RequestFromMobileImpl> base_class_request =
static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr);
base_class_request->OnTimeOut();
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 951a206dff..8939ff9633 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
@@ -252,7 +252,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::success].asBool(),
- false);
+ true);
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::result_code].asInt(),
static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index bd4c5c1ec6..aded581faf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -205,10 +205,6 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
.WillOnce(Return(choice_set_id));
EXPECT_CALL(*app_, is_perform_interaction_active()).WillOnce(Return(false));
EXPECT_CALL(*app_, performinteraction_choice_set_map()).Times(0);
-
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
- .WillOnce(Return(invalid_choice_set_id));
-
EXPECT_CALL(*app_, app_id()).Times(0);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index f1bb7b64ca..7031363fe0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -81,7 +81,11 @@ class ResetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
ResetGlobalPropertiesRequestTest()
- : msg_(CreateMessage()), mock_app_(CreateMockApp()) {}
+ : msg_(CreateMessage()), mock_app_(CreateMockApp()) {
+ mock_help_prompt_manager_ =
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>(
+ new application_manager_test::MockHelpPromptManager());
+ }
void SetUp() OVERRIDE {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -99,6 +103,8 @@ class ResetGlobalPropertiesRequestTest
MessageSharedPtr msg_;
MockAppPtr mock_app_;
ResetGlobalPropertiesRequestPtr command_;
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>
+ mock_help_prompt_manager_;
};
class ResetGlobalPropertiesResponseTest
@@ -142,6 +148,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
.WillByDefault(Return(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map)));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
command_->Run();
@@ -169,6 +178,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -208,6 +220,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -253,6 +268,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
MessageSharedPtr ui_msg = CreateMessage();
(*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
@@ -295,6 +313,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, CreateRCResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -349,6 +370,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
.Times(0);
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -400,6 +424,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -467,6 +494,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
@@ -535,6 +565,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));