diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins')
11 files changed, 134 insertions, 64 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc index 75ccd46e4d..875455f545 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc @@ -371,23 +371,24 @@ bool RCCapabilitiesManagerImpl::CheckButtonName( SDL_LOG_AUTO_TRACE(); auto rc_capabilities = hmi_capabilities_.rc_capability(); if (!rc_capabilities) { - SDL_LOG_ERROR("No remote controll capabilities available"); + SDL_LOG_ERROR("No remote control capabilities available"); return false; } - if (enums_value::kRadio == module_type) { - if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) { - SDL_LOG_WARN("Trying to acceess climate button with module type radio"); - return false; - } - } + auto module_type_mismatch = [&button_name, &module_type]( + const std::string& type, + const std::vector<std::string>&& buttons) { + return (helpers::in_range(buttons, button_name) && type != module_type); + }; - if (enums_value::kClimate == module_type) { - if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) { - SDL_LOG_WARN("Trying to acceess radio button with module type climate"); - return false; - } + if (module_type_mismatch(enums_value::kRadio, RCHelpers::buttons_radio()) || + module_type_mismatch(enums_value::kClimate, + RCHelpers::buttons_climate())) { + SDL_LOG_WARN("Trying to access incompatible button: " + << button_name << " with module type: " << module_type); + return false; } + return true; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h index 82967b717b..edbeaf1b9e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h @@ -97,8 +97,10 @@ class CreateInteractionChoiceSetRequest * @brief Calls after all responses from HMI were received. * Terminates request and sends successful response to mobile * if all responses were SUCCESS or calls DeleteChoices in other case. + * @param vr_result the result code from hmi. */ - void OnAllHMIResponsesReceived(); + void OnAllHMIResponsesReceived( + const hmi_apis::Common_Result::eType vr_result); /** * @brief The VRCommand struct @@ -201,8 +203,9 @@ class CreateInteractionChoiceSetRequest * @brief CountReceivedVRResponses counts received HMI responses. Updated * request timeout if not all responses received * Send response to mobile if all responses received. + * @param vr_result the result code from hmi. */ - void CountReceivedVRResponses(); + void CountReceivedVRResponses(const hmi_apis::Common_Result::eType vr_result); DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest); }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index ddd2c9db35..eaad84dafd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -444,12 +444,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { result_code = ui_result_ == hmi_apis::Common_Result::REJECTED ? mobile_apis::Result::REJECTED : mobile_apis::Result::GENERIC_ERROR; - - msg_params[strings::grammar_id] = application->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - application->RemoveCommand(cmd_id); result = false; SDL_LOG_DEBUG("Result " << result); } @@ -461,10 +455,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { result_code = vr_result_ == hmi_apis::Common_Result::REJECTED ? mobile_apis::Result::REJECTED : mobile_apis::Result::GENERIC_ERROR; - - SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - - application->RemoveCommand(cmd_id); result = false; SDL_LOG_DEBUG("Result " << result); } @@ -588,12 +578,28 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() { void AddCommandRequest::RemoveCommand() { SDL_LOG_AUTO_TRACE(); + using namespace helpers; + ApplicationSharedPtr app = application_manager_.application(connection_key()); if (app.use_count() == 0) { SDL_LOG_ERROR("No application associated with session key"); return; } + const bool is_ui_result_ok_or_missing = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + ui_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); + + const bool is_vr_result_ok_or_missing = + Compare<hmi_apis::Common_Result::eType, EQ, ONE>( + vr_result_, + hmi_apis::Common_Result::INVALID_ENUM, + hmi_apis::Common_Result::SUCCESS, + hmi_apis::Common_Result::WARNINGS); + const uint32_t cmd_id = (*message_)[strings::msg_params][strings::cmd_id].asUInt(); smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); @@ -602,21 +608,15 @@ void AddCommandRequest::RemoveCommand() { app->RemoveCommand(cmd_id); - if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) && - IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) { - // in case we have send bth UI and VR and no one respond - // we have nothing to remove from HMI so no DeleteCommand expected - return; - } - - if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) { + if (ui_is_sent_ && is_ui_result_ok_or_missing) { SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); } - if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { - msg_params[strings::grammar_id] = app->get_grammar_id(); - msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; - SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); + if (vr_is_sent_ && is_vr_result_ok_or_missing) { + smart_objects::SmartObject vr_msg_params = msg_params; + vr_msg_params[strings::grammar_id] = app->get_grammar_id(); + vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; + SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &vr_msg_params); } } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc index 70f462c05d..f221742523 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc @@ -368,7 +368,8 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse( return true; } -void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { +void CreateInteractionChoiceSetRequest::CountReceivedVRResponses( + const hmi_apis::Common_Result::eType vr_result) { ++received_chs_count_; SDL_LOG_DEBUG("Got VR.AddCommand response, there are " << expected_chs_count_ - received_chs_count_ @@ -378,7 +379,7 @@ void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() { connection_key(), correlation_id(), default_timeout()); SDL_LOG_DEBUG("Timeout for request was updated"); } else { - OnAllHMIResponsesReceived(); + OnAllHMIResponsesReceived(vr_result); } } @@ -392,7 +393,15 @@ void CreateInteractionChoiceSetRequest::on_event( const Common_Result::eType result = static_cast<Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); const bool is_no_error = Compare<Common_Result::eType, EQ, ONE>( - result, Common_Result::SUCCESS, Common_Result::WARNINGS); + result, + Common_Result::SUCCESS, + Common_Result::WARNINGS, + Common_Result::WRONG_LANGUAGE, + Common_Result::RETRY, + Common_Result::SAVED, + Common_Result::TRUNCATED_DATA, + Common_Result::UNSUPPORTED_RESOURCE); + uint32_t corr_id = static_cast<uint32_t>( message[strings::params][strings::correlation_id].asUInt()); if (event.id() == hmi_apis::FunctionID::VR_AddCommand) { @@ -407,7 +416,7 @@ void CreateInteractionChoiceSetRequest::on_event( ProcessHmiError(result); } } - CountReceivedVRResponses(); + CountReceivedVRResponses(result); } } @@ -464,7 +473,8 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() { sent_commands_map_.clear(); } -void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { +void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived( + const hmi_apis::Common_Result::eType vr_result) { SDL_LOG_AUTO_TRACE(); ApplicationSharedPtr application = @@ -478,7 +488,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() { if (!error_from_hmi_ && should_send_warnings_) { SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo); } else if (!error_from_hmi_) { - SendResponse(true, mobile_apis::Result::SUCCESS); + SendResponse(true, MessageHelper::HMIToMobileResult(vr_result)); } else { DeleteChoices(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc index dccf2e9fdd..9caf7e4c7a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc @@ -89,7 +89,13 @@ void DeleteInteractionChoiceSetRequest::Run() { SendResponse(false, mobile_apis::Result::IN_USE); return; } - SendVrDeleteCommand(app); + if (choice_set.keyExists(strings::grammar_id) && + choice_set[strings::grammar_id].asInt() != -1) { + SendVrDeleteCommand(app); + } else { + response_result_codes_.push_back(hmi_apis::Common_Result::SUCCESS); + SendDeleteInteractionChoiceSetResponse(); + } } bool DeleteInteractionChoiceSetRequest::Init() { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index af0a5a6539..0537043cd4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -225,8 +225,13 @@ size_t OnSystemRequestNotification::ParsePTString( size_t result_length = length; result.reserve(length * 2); for (size_t i = 0; i < length; ++i) { - if (pt_string[i] == '\"' || pt_string[i] == '\\') { + if (pt_string[i] == '\"') { result += '\\'; + } else if (pt_string[i] == '\\') { + result += '\\'; + --result_length; // contentLength is adjusted for the additional escape + // character added before special characters (like the + // newline string) } else if (pt_string[i] == '\n') { --result_length; // contentLength is adjusted when this character is // not copied to result. diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc index 92c5d19a05..a9abb5dc6d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc @@ -123,6 +123,9 @@ void ResetGlobalPropertiesRequest::Run() { SendHMIRequest( hmi_apis::FunctionID::RC_SetGlobalProperties, msg_params.get(), true); } + auto& help_prompt_manager = app->help_prompt_manager(); + help_prompt_manager.OnResetGlobalPropertiesReceived( + (*message_)[strings::msg_params]); } void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { 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)); |