diff options
author | Jacob Keeler <jacob.keeler@livioradio.com> | 2018-07-16 14:36:35 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-16 14:36:35 -0700 |
commit | 4dde9552b3d9ab5fa29502810be48bdf0f793cd7 (patch) | |
tree | 4870b3b1721cd9595a7118f789c610fa1b44f83e /src/components/application_manager/rpc_plugins/sdl_rpc_plugin | |
parent | 5cff788119f1e62344b94aebb7ca23cf63dc39f8 (diff) | |
parent | 2f05a630fe5f35bc46f3003d9fc35d3451c130c4 (diff) | |
download | sdl_core-4dde9552b3d9ab5fa29502810be48bdf0f793cd7.tar.gz |
Merge pull request #2199 from smartdevicelink/feature/handling_VR_help_requests
Feature/handling vr help requests
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin')
11 files changed, 164 insertions, 248 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h index 7a8abaaad6..674de4731a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h @@ -83,20 +83,12 @@ class SetGlobalPropertiesRequest bool Init() FINAL; private: - // Verify correctness VrHelptitle value - static bool ValidateVRHelpTitle( - const smart_objects::SmartObject* const vr_help_so_ptr); - // prepare UI sending data (VrHelps, Menus, Keyboard) to SmartObject static void PrepareUIRequestVRHelpData( const app_mngr::ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, smart_objects::SmartObject& out_params); - static bool PrepareUIRequestDefaultVRHelpData( - const app_mngr::ApplicationSharedPtr app, - smart_objects::SmartObject& out_params); - static void PrepareUIRequestMenuAndKeyboardData( const app_mngr::ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, 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 d1cb9763d9..1da9fc497f 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 @@ -320,9 +320,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { return; } + const uint32_t cmd_id = + (*message_)[strings::msg_params][strings::cmd_id].asUInt(); smart_objects::SmartObject msg_param(smart_objects::SmartType_Map); - msg_param[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; + msg_param[strings::cmd_id] = cmd_id; msg_param[strings::app_id] = application->app_id(); switch (event.id()) { @@ -458,8 +459,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command; SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params); - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + application->RemoveCommand(cmd_id); result = false; LOG4CXX_DEBUG(logger_, "Result " << result); } @@ -474,8 +474,7 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params); - application->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + application->RemoveCommand(cmd_id); result = false; LOG4CXX_DEBUG(logger_, "Result " << result); } @@ -501,7 +500,10 @@ void AddCommandRequest::on_event(const event_engine::Event& event) { result = false; } - if (!result) { + if (result) { + application->help_prompt_manager().OnVrCommandAdded( + cmd_id, (*message_)[strings::msg_params], false); + } else { RemoveCommand(); } @@ -595,13 +597,13 @@ void AddCommandRequest::RemoveCommand() { return; } + const uint32_t cmd_id = + (*message_)[strings::msg_params][strings::cmd_id].asUInt(); smart_objects::SmartObject msg_params(smart_objects::SmartType_Map); - msg_params[strings::cmd_id] = - (*message_)[strings::msg_params][strings::cmd_id]; + msg_params[strings::cmd_id] = cmd_id; msg_params[strings::app_id] = app->app_id(); - app->RemoveCommand( - (*message_)[strings::msg_params][strings::cmd_id].asUInt()); + app->RemoveCommand(cmd_id); if (BothSend() && !(is_vr_received_ || is_ui_received_)) { // in case we have send bth UI and VR and no one respond diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc index bbe787a123..38069c341e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_command_request.cc @@ -198,7 +198,7 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { } smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; - const int32_t cmd_id = msg_params[strings::cmd_id].asInt(); + const uint32_t cmd_id = msg_params[strings::cmd_id].asUInt(); smart_objects::SmartObject* command = application->FindCommand(cmd_id); @@ -213,7 +213,8 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) { std::string info; const bool result = PrepareResponseParameters(result_code, info); if (result) { - application->RemoveCommand(msg_params[strings::cmd_id].asInt()); + application->RemoveCommand(cmd_id); + application->help_prompt_manager().OnVrCommandDeleted(cmd_id, false); } SendResponse( result, result_code, info.empty() ? NULL : info.c_str(), &msg_params); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc index 38113afcc2..9a01163702 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_sub_menu_request.cc @@ -134,9 +134,11 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands( (*it->second)[strings::menu_params][hmi_request::parent_id].asInt()) { smart_objects::SmartObject msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map); + const uint32_t cmd_id = (*it->second)[strings::cmd_id].asUInt(); msg_params[strings::app_id] = app->app_id(); - msg_params[strings::cmd_id] = (*it->second)[strings::cmd_id].asInt(); - app->RemoveCommand((*it->second)[strings::cmd_id].asInt()); + msg_params[strings::cmd_id] = cmd_id; + app->RemoveCommand(cmd_id); + app->help_prompt_manager().OnVrCommandDeleted(cmd_id, false); it = commands.begin(); // Can not relay on // iterators after erase was called diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc index a495423bce..9422bec478 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc @@ -78,17 +78,8 @@ void OnHMIStatusNotification::Run() { mobile_apis::HMILevel::eType hmi_level = static_cast<mobile_apis::HMILevel::eType>( (*message_)[strings::msg_params][strings::hmi_level].asInt()); - if ((mobile_apis::HMILevel::HMI_BACKGROUND == hmi_level) || - (mobile_apis::HMILevel::HMI_NONE == hmi_level)) { - if (!(app->tts_properties_in_none())) { - app->set_tts_properties_in_none(true); - LOG4CXX_INFO(logger_, - "OnHMIStatusNotification::Send TTS GlobalProperties" - " with empty array to HMI"); - MessageHelper::SendTTSGlobalProperties(app, false, application_manager_); - } - } else if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || - (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { + if ((mobile_apis::HMILevel::HMI_FULL == hmi_level) || + (mobile_apis::HMILevel::HMI_LIMITED == hmi_level)) { if (!(app->tts_properties_in_full())) { app->set_tts_properties_in_full(true); LOG4CXX_INFO(logger_, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index 90ec06025e..92c72d7f66 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -162,6 +162,9 @@ void SetGlobalPropertiesRequest::Run() { params[strings::app_id] = app->app_id(); SendUIRequest(params, true); + + auto& help_prompt_manager = app->help_prompt_manager(); + help_prompt_manager.OnSetGlobalPropertiesReceived(params, false); } else { LOG4CXX_DEBUG(logger_, "VRHelp params does not present"); DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present); @@ -169,15 +172,6 @@ void SetGlobalPropertiesRequest::Run() { smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType_Map); - if (ValidateVRHelpTitle(app->vr_help_title())) { - LOG4CXX_DEBUG(logger_, "App already contains VRHelp data"); - } else { - if (!PrepareUIRequestDefaultVRHelpData(app, params)) { - LOG4CXX_ERROR(logger_, "default VRHElp data could not be generated"); - SendResponse(false, mobile_apis::Result::INVALID_DATA); - return; - } - } PrepareUIRequestMenuAndKeyboardData(app, msg_params, params); // Preparing data @@ -247,6 +241,9 @@ void SetGlobalPropertiesRequest::Run() { params[strings::app_id] = app->app_id(); SendTTSRequest(params, true); + + auto& help_prompt_manager = app->help_prompt_manager(); + help_prompt_manager.OnSetGlobalPropertiesReceived(params, false); } } @@ -276,6 +273,9 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { using namespace helpers; const smart_objects::SmartObject& message = event.smart_object(); + ApplicationSharedPtr application = + application_manager_.application(connection_key()); + switch (event.id()) { case hmi_apis::FunctionID::UI_SetGlobalProperties: { LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event"); @@ -284,6 +284,10 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_response_info_); + if (application.valid()) { + auto& help_prompt_manager = application->help_prompt_manager(); + help_prompt_manager.OnSetGlobalPropertiesReceived(message, true); + } break; } case hmi_apis::FunctionID::TTS_SetGlobalProperties: { @@ -293,6 +297,10 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, tts_response_info_); + if (application.valid()) { + auto& help_prompt_manager = application->help_prompt_manager(); + help_prompt_manager.OnSetGlobalPropertiesReceived(message, true); + } break; } default: { @@ -309,10 +317,6 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { std::string response_info; const bool result = PrepareResponseParameters(result_code, response_info); - // TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse - ApplicationSharedPtr application = - application_manager_.application(connection_key()); - SendResponse(result, result_code, response_info.empty() ? NULL : response_info.c_str(), @@ -356,17 +360,6 @@ bool SetGlobalPropertiesRequest::PrepareResponseParameters( return result; } -bool SetGlobalPropertiesRequest::ValidateVRHelpTitle( - const smart_objects::SmartObject* const vr_help_so_ptr) { - LOG4CXX_AUTO_TRACE(logger_); - if (vr_help_so_ptr) { - const std::string& vr_help = vr_help_so_ptr->asString(); - LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"'); - return !vr_help.empty(); - } - return false; -} - void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, @@ -381,41 +374,6 @@ void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData( out_params[strings::vr_help] = (*app->vr_help()); } -bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData( - const ApplicationSharedPtr app, smart_objects::SmartObject& out_params) { - LOG4CXX_AUTO_TRACE(logger_); - DCHECK_OR_RETURN(app, false); - - LOG4CXX_DEBUG(logger_, "Generate default VRHelp data"); - const DataAccessor<CommandsMap> accessor = app->commands_map(); - const CommandsMap& cmdMap = accessor.GetData(); - - int32_t index = 0; - smart_objects::SmartObject vr_help_items; - for (CommandsMap::const_iterator command_it = cmdMap.begin(); - cmdMap.end() != command_it; - ++command_it) { - const smart_objects::SmartObject& command = *command_it->second; - if (!command.keyExists(strings::vr_commands)) { - LOG4CXX_ERROR(logger_, "VR synonyms are empty"); - return false; - } - // use only first - vr_help_items[index][strings::position] = (index + 1); - vr_help_items[index++][strings::text] = - (*command_it->second)[strings::vr_commands][0]; - } - - app->set_vr_help_title(smart_objects::SmartObject(app->name())); - - out_params[strings::vr_help_title] = (*app->vr_help_title()); - if (vr_help_items.length() > 0) { - app->set_vr_help(vr_help_items); - out_params[strings::vr_help] = (*app->vr_help()); - } - return true; -} - void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData( const ApplicationSharedPtr app, const smart_objects::SmartObject& msg_params, 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 0067be3f1b..9f60053eb3 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 @@ -49,6 +49,7 @@ #include "application_manager/mock_message_helper.h" #include "application_manager/event_engine/event.h" #include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_help_prompt_manager.h" namespace test { namespace components { @@ -57,6 +58,7 @@ namespace mobile_commands_test { namespace add_command_request { namespace am = application_manager; +namespace am_test = application_manager_test; using am::commands::CommandImpl; using am::ApplicationManager; using am::commands::MessageSharedPtr; @@ -104,6 +106,8 @@ class AddCommandRequestTest : msg_(CreateMessage()) , default_app_name_("test_default_app_name_") , lock_ptr_(std::make_shared<sync_primitives::Lock>()) + , mock_help_prompt_manager_( + std::make_shared<am_test::MockHelpPromptManager>()) , mock_app_(CreateMockApp()) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(mock_app_)); @@ -226,6 +230,7 @@ class AddCommandRequestTest SmartObjectSPtr so_ptr_; const utils::custom_string::CustomString default_app_name_; std::shared_ptr<sync_primitives::Lock> lock_ptr_; + std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_; MockAppPtr mock_app_; }; @@ -524,6 +529,12 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) .WillOnce(Return(true)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false)); + utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -549,6 +560,12 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) .WillOnce(Return(true)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false)); + utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -665,6 +682,11 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::WARNINGS), _)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false)); + utils::SharedPtr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc index ac8803c2ca..e3a4e0f381 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc @@ -44,6 +44,7 @@ #include "application_manager/mock_application.h" #include "application_manager/mock_message_helper.h" #include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_help_prompt_manager.h" #include "application_manager/event_engine/event.h" namespace test { @@ -56,6 +57,7 @@ using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; namespace am = ::application_manager; +namespace am_test = application_manager_test; using sdl_rpc_plugin::commands::DeleteCommandRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; @@ -74,7 +76,10 @@ const uint32_t kConnectionKey = 2u; class DeleteCommandRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: - DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {} + DeleteCommandRequestTest() + : mock_help_prompt_manager_( + std::make_shared<am_test::MockHelpPromptManager>()) + , mock_app_(CreateMockApp()) {} MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; @@ -132,6 +137,7 @@ class DeleteCommandRequestTest } NiceMock<MockHmiInterfaces> hmi_interfaces_; + std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_; MockAppPtr mock_app_; }; @@ -188,6 +194,11 @@ TEST_F(DeleteCommandRequestTest, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&vr_command_result), Return(true))); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnVrCommandDeleted(kCommandId, false)); + command->on_event(event_vr); ResultCommandExpectations(vr_command_result, "VR is not supported by system"); @@ -241,6 +252,11 @@ TEST_F(DeleteCommandRequestTest, EXPECT_CALL(*app, UpdateHash()); + EXPECT_CALL(*app, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnVrCommandDeleted(kCommandId, false)); + MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event_ui))); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc index 7a187c46d1..5dad433d6d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc @@ -43,6 +43,7 @@ #include "application_manager/mock_message_helper.h" #include "application_manager/event_engine/event.h" #include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_help_prompt_manager.h" namespace test { namespace components { @@ -55,6 +56,7 @@ using ::testing::Return; using ::testing::ReturnRef; using ::testing::InSequence; namespace am = ::application_manager; +namespace am_test = application_manager_test; using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockHmiInterfaces; @@ -99,6 +101,8 @@ class DeleteSubMenuRequestTest , accessor_(commands_map_, commands_lock_) , message_(CreateMessage()) , command_(CreateCommand<DeleteSubMenuRequest>(message_)) + , mock_help_prompt_manager_( + std::make_shared<am_test::MockHelpPromptManager>()) , app_(CreateMockApp()) {} am::CommandsMap commands_map_; @@ -107,6 +111,7 @@ class DeleteSubMenuRequestTest MessageSharedPtr message_; DeleteSubMenuRequestPtr command_; + std::shared_ptr<am_test::MockHelpPromptManager> mock_help_prompt_manager_; MockAppPtr app_; }; @@ -276,6 +281,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_)); EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey)); EXPECT_CALL(*app_, RemoveCommand(_)).WillOnce(DeleteCommand(&commands_map_)); + EXPECT_CALL(*app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_)); + EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandDeleted(kCmdId, false)); EXPECT_CALL( mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand))) @@ -287,6 +295,7 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) { ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), am::commands::Command::SOURCE_SDL)); EXPECT_CALL(*app_, UpdateHash()); + DeleteSubMenuRequestPtr command = CreateCommand<DeleteSubMenuRequest>(message_); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc index 034fff73d7..afb1574cbf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc @@ -118,45 +118,6 @@ TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) { VerifySendNotificationData(msg); } -TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) { - MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND); - SetSendNotificationExpectations(msg); - - SharedPtr<OnHMIStatusNotification> command = - CreateCommand<OnHMIStatusNotification>(msg); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); - - EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false)); - EXPECT_CALL(*mock_app, set_tts_properties_in_none(true)); - EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _)); - - command->Run(); - - VerifySendNotificationData(msg); -} - -TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndTrueProperties_SUCCESS) { - MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND); - - SharedPtr<OnHMIStatusNotification> command = - CreateCommand<OnHMIStatusNotification>(msg); - - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app)); - - EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(true)); - - SetSendNotificationExpectations(msg); - - command->Run(); - - VerifySendNotificationData(msg); -} - TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc index 5d31f48970..f39ccf7be3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc @@ -39,6 +39,7 @@ #include "gtest/gtest.h" #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application.h" +#include "application_manager/mock_help_prompt_manager.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_message_helper.h" #include "application_manager/event_engine/event.h" @@ -76,7 +77,11 @@ class SetGlobalPropertiesRequestTest public: SetGlobalPropertiesRequestTest() : lock_ptr_(std::make_shared<sync_primitives::Lock>()) - , mock_app_(CreateMockApp()) {} + , mock_app_(CreateMockApp()) { + mock_help_prompt_manager_ = + std::shared_ptr<application_manager_test::MockHelpPromptManager>( + new application_manager_test::MockHelpPromptManager()); + } MessageSharedPtr CreateFullParamsUISO() { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); @@ -140,6 +145,11 @@ class SetGlobalPropertiesRequestTest EXPECT_CALL(*mock_app_, set_keyboard_props(_)).Times(0); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); + command->Run(); } @@ -162,14 +172,17 @@ class SetGlobalPropertiesRequestTest .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title("title"); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title)); EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt)); EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt)); EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt)); EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&timeout_prompt)); EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); + command->Run(); } @@ -252,6 +265,8 @@ class SetGlobalPropertiesRequestTest } std::shared_ptr<sync_primitives::Lock> lock_ptr_; MockAppPtr mock_app_; + std::shared_ptr<application_manager_test::MockHelpPromptManager> + mock_help_prompt_manager_; }; TEST_F(SetGlobalPropertiesRequestTest, @@ -293,6 +308,12 @@ TEST_F(SetGlobalPropertiesRequestTest, ON_CALL(mock_message_helper_, VerifyImage(_, _, _)) .WillByDefault(Return(mobile_apis::Result::SUCCESS)); + + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)).Times(2); + EXPECT_CALL( mock_message_helper_, VerifyTtsFiles( @@ -312,6 +333,9 @@ TEST_F(SetGlobalPropertiesRequestTest, event_vr.set_smart_object(*msg_vr); command->Run(); + + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); command->on_event(event_vr); MessageSharedPtr ui_command_result; @@ -319,6 +343,8 @@ TEST_F(SetGlobalPropertiesRequestTest, mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); command->on_event(event); @@ -339,6 +365,12 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) { MockAppPtr mock_app(CreateMockApp()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + + EXPECT_CALL(*mock_app, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); + EXPECT_CALL( mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) @@ -367,6 +399,9 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get())); + MessageSharedPtr response_to_mobile; EXPECT_CALL( mock_rpc_service_, @@ -374,6 +409,9 @@ TEST_F(SetGlobalPropertiesRequestTest, .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); command->Run(); + + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)).Times(2); command->on_event(event_ui); command->on_event(event_tts); @@ -441,6 +479,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); + SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); @@ -586,8 +629,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) { .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title("Menu_Title"); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title)); EXPECT_CALL(*mock_app_, set_menu_title(menu_title)); EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0); EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties)); @@ -607,37 +648,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) { command->Run(); } -TEST_F(SetGlobalPropertiesRequestTest, Run_VRCouldNotGenerate_INVALID_DATA) { - MessageSharedPtr msg = CreateMsgParams(); - SmartObject keyboard_properties(smart_objects::SmartType_Map); - (*msg)[am::strings::msg_params][am::hmi_request::keyboard_properties] = - keyboard_properties; - SmartObject menu_title("Menu_Title"); - (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title; - - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); - EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject* vr_help_title = NULL; - CommandsMap commands_map; - SmartObject empty_msg(smart_objects::SmartType_Map); - commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &empty_msg)); - DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_); - EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor)); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(vr_help_title)); - EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0); - - SharedPtr<SetGlobalPropertiesRequest> command( - CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL( - mock_rpc_service_, - ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), - am::commands::Command::SOURCE_SDL)); - - command->Run(); -} - TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) { MessageSharedPtr msg = CreateMsgParams(); SmartObject keyboard_properties(smart_objects::SmartType_Map); @@ -648,17 +658,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) { .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title(smart_objects::SmartType_Null); - EXPECT_CALL(*mock_app_, vr_help_title()) - .WillOnce(Return(&vr_help_title)) - .WillOnce(Return(&vr_help_title)); - - CommandsMap commands_map; - DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_); - EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor)); - const CustomString name("name"); - EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name)); - EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name))); EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0); EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0); EXPECT_CALL(*mock_app_, set_keyboard_props(_)); @@ -688,23 +687,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) { .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title(smart_objects::SmartType_Null); - EXPECT_CALL(*mock_app_, vr_help_title()) - .Times(2) - .WillRepeatedly(Return(&vr_help_title)); - - CommandsMap commands_map; - SmartObject command_text(smart_objects::SmartType_Map); - commands_map[0] = &command_text; - (*commands_map[0])[am::strings::vr_commands] = SmartObject("one"); - DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_); - EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor)); - EXPECT_CALL(*mock_app_, set_vr_help(_)); - const CustomString name("name"); - EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name)); - EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name))); - SmartObject vr_help_array(smart_objects::SmartType_Array); - EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array)); EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0); EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0); EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties)); @@ -723,50 +705,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) { command->Run(); } -TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) { - MessageSharedPtr msg = CreateMsgParams(); - SmartObject keyboard_properties(smart_objects::SmartType_Map); - (*msg)[am::strings::msg_params][am::hmi_request::keyboard_properties] = - keyboard_properties; - - EXPECT_CALL(app_mngr_, application(kConnectionKey)) - .WillOnce(Return(mock_app_)); - EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); - EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title(smart_objects::SmartType_Null); - EXPECT_CALL(*mock_app_, vr_help_title()) - .Times(2) - .WillRepeatedly(Return(&vr_help_title)); - - CommandsMap commands_map; - DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_); - EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor)); - SmartObject vr_help_array(smart_objects::SmartType_Array); - vr_help_array[0] = SmartObject(smart_objects::SmartType_Map); - vr_help_array[0][am::strings::text] = kText; - vr_help_array[0][am::strings::position] = kPosition; - SmartObject vr_synonyms(smart_objects::SmartType_Array); - vr_synonyms[0] = vr_help_array; - const CustomString name("name"); - EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name)); - EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name))); - EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0); - EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0); - EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties)); - EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId)); - EXPECT_CALL( - mock_hmi_interfaces_, - GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties)) - .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI)); - ON_CALL(mock_hmi_interfaces_, - GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( - CreateCommand<SetGlobalPropertiesRequest>(msg)); - - command->Run(); -} - TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); SmartObject help_prompt(smart_objects::SmartType_Array); @@ -784,8 +722,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) { EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title("title"); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title)); EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt)); EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt)); EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt)); @@ -800,6 +736,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); + SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); @@ -818,8 +759,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) { EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(help_prompt, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title("title"); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title)); EXPECT_CALL(*mock_app_, set_help_prompt(help_prompt)); EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(&help_prompt)); EXPECT_CALL(*mock_app_, set_timeout_prompt(_)).Times(0); @@ -832,6 +771,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) { ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); @@ -850,8 +793,6 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) { EXPECT_CALL(mock_message_helper_, VerifyTtsFiles(timeout_prompt, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); - SmartObject vr_help_title("title"); - EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title)); EXPECT_CALL(*mock_app_, set_help_prompt(_)).Times(0); EXPECT_CALL(*mock_app_, help_prompt()).Times(0); EXPECT_CALL(*mock_app_, set_timeout_prompt(timeout_prompt)); @@ -864,6 +805,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) { ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, false)); SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); @@ -1055,6 +1000,11 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) { Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); + command->on_event(event); } @@ -1082,6 +1032,9 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); + EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, @@ -1114,6 +1067,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) { Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); EXPECT_CALL(mock_rpc_service_, @@ -1159,7 +1114,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0); + EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); Event event(hmi_apis::FunctionID::TTS_Stopped); @@ -1190,6 +1145,8 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, am::commands::Command::SOURCE_SDL)) .WillOnce(Return(true)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -1221,6 +1178,9 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + EXPECT_CALL(*mock_app_, help_prompt_manager()) + .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); + MessageSharedPtr ui_command_result; EXPECT_CALL( mock_rpc_service_, @@ -1229,6 +1189,8 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); + EXPECT_CALL(*mock_help_prompt_manager_, + OnSetGlobalPropertiesReceived(_, true)); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); |