diff options
Diffstat (limited to 'src/components/application_manager/test/commands/mobile/set_global_properties_test.cc')
-rw-r--r-- | src/components/application_manager/test/commands/mobile/set_global_properties_test.cc | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc index 7143bdf71a..4496aa0f41 100644 --- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc @@ -118,6 +118,8 @@ class SetGlobalPropertiesRequestTest vr_help_array[0][am::strings::text] = kText; vr_help_array[0][am::strings::position] = kPosition; (*msg)[am::strings::msg_params][am::strings::vr_help] = vr_help_array; + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); } void OnEventUISetupHelper(MessageSharedPtr msg, @@ -152,6 +154,8 @@ class SetGlobalPropertiesRequestTest (*msg)[am::strings::msg_params][am::strings::timeout_prompt] = timeout_prompt; + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); @@ -242,10 +246,10 @@ class SetGlobalPropertiesRequestTest .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) - .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); + .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE)); } sync_primitives::Lock lock_; MockMessageHelper& mock_message_helper_; @@ -323,6 +327,9 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) { utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); + MockAppPtr mock_app(CreateMockApp()); + ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); + EXPECT_CALL( app_mngr_, ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) @@ -348,9 +355,6 @@ TEST_F(SetGlobalPropertiesRequestTest, utils::SharedPtr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); - ON_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE)); - EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -1032,8 +1036,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); - Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); @@ -1061,8 +1063,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); @@ -1091,15 +1093,14 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) { .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); OnEventUISetupHelper(msg, command); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); event.set_smart_object(*msg); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); EXPECT_CALL(app_mngr_, ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) .WillOnce(Return(true)); @@ -1126,9 +1127,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) { EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); - EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillRepeatedly(Return(MockAppPtr())); @@ -1146,7 +1144,6 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) { SharedPtr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)).Times(0); EXPECT_CALL(app_mngr_, application(kConnectionKey)).Times(0); EXPECT_CALL(*mock_app_, UpdateHash()).Times(0); @@ -1180,8 +1177,8 @@ TEST_F(SetGlobalPropertiesRequestTest, ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) .WillOnce(Return(true)); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(response_code)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); @@ -1192,7 +1189,7 @@ TEST_F(SetGlobalPropertiesRequestTest, TEST_F(SetGlobalPropertiesRequestTest, OnEvent_TTSAndWarningsResultCode_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - hmi_apis::Common_Result::eType response_code = + const hmi_apis::Common_Result::eType response_code = hmi_apis::Common_Result::WARNINGS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; ON_CALL( @@ -1210,17 +1207,27 @@ TEST_F(SetGlobalPropertiesRequestTest, EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - EXPECT_CALL(app_mngr_, - ManageMobileCommand(_, am::commands::Command::ORIGIN_SDL)) - .WillOnce(Return(true)); + MessageSharedPtr ui_command_result; + EXPECT_CALL( + app_mngr_, + ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL)) + .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true))); - EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_)) - .WillOnce(Return(mobile_apis::Result::SUCCESS)); + EXPECT_CALL(app_mngr_, application(kConnectionKey)) + .WillOnce(Return(mock_app_)); Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*msg); command->on_event(event); + + EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success] + .asBool(), + true); + EXPECT_EQ( + (*ui_command_result)[am::strings::msg_params][am::strings::result_code] + .asInt(), + static_cast<int32_t>(hmi_apis::Common_Result::WARNINGS)); } } // namespace set_global_properties_request |