summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/commands/mobile
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/test/commands/mobile')
-rw-r--r--src/components/application_manager/test/commands/mobile/add_command_request_test.cc39
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc43
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc48
-rw-r--r--src/components/application_manager/test/commands/mobile/change_registration_test.cc99
-rw-r--r--src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc41
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_command_request_test.cc41
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc1
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc27
-rw-r--r--src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc24
-rw-r--r--src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc52
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc15
-rw-r--r--src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc17
-rw-r--r--src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc25
-rw-r--r--src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc88
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_interaction_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/read_did_request_test.cc7
-rw-r--r--src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc166
-rw-r--r--src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc214
-rw-r--r--src/components/application_manager/test/commands/mobile/scrollable_message_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/send_location_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/set_app_icon_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/set_display_layout_test.cc22
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc65
-rw-r--r--src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc22
-rw-r--r--src/components/application_manager/test/commands/mobile/show_test.cc67
-rw-r--r--src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/slider_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/speak_request_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/system_request_test.cc135
-rw-r--r--src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc31
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc10
41 files changed, 778 insertions, 785 deletions
diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
index dec0ffe7ad..471f0763de 100644
--- a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
@@ -61,11 +61,9 @@ using am::commands::CommandImpl;
using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
-using am::MockMessageHelper;
using ::testing::_;
using ::utils::SharedPtr;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::InSequence;
using am::commands::AddCommandRequest;
using NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr;
@@ -105,19 +103,13 @@ class AddCommandRequestTest
AddCommandRequestTest()
: msg_(CreateMessage())
, default_app_name_("test_default_app_name_")
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
InitGetters();
InitBasicMessage();
}
- ~AddCommandRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
protected:
void InitBasicMessage() {
(*msg_)[params][connection_key] = kConnectionKey;
@@ -209,7 +201,8 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(app_mngr_, ManageHMICommand(HMIResultCodeIs(cmd_to_delete)))
.WillOnce(Return(true));
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
@@ -226,7 +219,6 @@ class AddCommandRequestTest
MessageSharedPtr msg_;
SmartObjectSPtr so_ptr_;
const utils::custom_string::CustomString default_app_name_;
- am::MockMessageHelper& mock_message_helper_;
sync_primitives::Lock lock_;
MockAppPtr mock_app_;
};
@@ -516,9 +508,6 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
request_ptr->on_event(event);
}
@@ -530,9 +519,6 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(*mock_app_, AddCommand(kCmdId, (*msg_)[msg_params]));
am::CommandsMap commands_map;
@@ -619,9 +605,6 @@ TEST_F(AddCommandRequestTest,
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::REJECTED))
- .WillOnce(Return(mobile_apis::Result::REJECTED));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
@@ -695,9 +678,6 @@ TEST_F(
.WillOnce(Return(true));
}
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR))
- .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -742,9 +722,6 @@ TEST_F(
.WillOnce(Return(true));
}
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::GENERIC_ERROR))
- .WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
@@ -973,9 +950,6 @@ TEST_F(AddCommandRequestTest,
event_ui.set_smart_object(*msg_ui);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
event_vr.set_smart_object(*msg_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand)))
@@ -1015,9 +989,6 @@ TEST_F(AddCommandRequestTest,
utils::SharedPtr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
Event event_ui(hmi_apis::FunctionID::UI_AddCommand);
event_ui.set_smart_object(*msg_);
@@ -1042,7 +1013,8 @@ TEST_F(AddCommandRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(ApplicationSharedPtr()));
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0);
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
@@ -1091,7 +1063,8 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
- SmartObjectSPtr response;
+ SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map);
+ (*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
mock_message_helper_,
CreateNegativeResponse(_, _, _, mobile_apis::Result::GENERIC_ERROR))
diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
index 9617f91016..f5bb7888d8 100644
--- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
@@ -54,9 +54,7 @@ namespace am = ::application_manager;
using am::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
@@ -66,12 +64,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class AddSubMenuRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- AddSubMenuRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
const uint32_t menu_id = 10u;
@@ -97,10 +90,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_AddSubMenu);
event.set_smart_object(*ev_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -123,7 +112,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace add_sub_menu_request
diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
index ee0662e5c6..90c6409fa8 100644
--- a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
@@ -63,7 +63,6 @@ namespace am = ::application_manager;
using am::commands::AlertManeuverRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
typedef SharedPtr<AlertManeuverRequest> CommandPtr;
@@ -87,11 +86,6 @@ class AlertManeuverRequestTest
MockAppPtr mock_app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
@@ -145,7 +139,8 @@ TEST_F(AlertManeuverRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons][0]
+ [am::strings::text] = "text";
CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
@@ -158,8 +153,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
const mobile_apis::Result::eType kProcessingResult =
mobile_apis::Result::ABORTED;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(kProcessingResult));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
@@ -195,7 +189,8 @@ TEST_F(AlertManeuverRequestTest, Run_IsWhiteSpaceExist_UNSUCCESS) {
TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::msg_params][am::strings::soft_buttons] = 0;
+ (*msg)[am::strings::msg_params][am::strings::soft_buttons][0]
+ [am::strings::text] = "text";
CommandPtr command(CreateCommand<AlertManeuverRequest>(msg));
@@ -205,8 +200,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(policy_interface_));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
@@ -215,8 +209,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- SubscribeApplicationToSoftButton(_, _, _));
+ EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _));
MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
EXPECT_EQ(hmi_apis::FunctionID::Navigation_AlertManeuver,
@@ -237,30 +230,30 @@ TEST_F(AlertManeuverRequestTest, OnEvent_ReceivedUnknownEvent_UNSUCCESS) {
.asInt()));
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case1) {
+TEST_F(AlertManeuverRequestTest, OnEvent_SUCCESS) {
CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ mobile_apis::Result::SUCCESS,
am::HmiInterfaces::STATE_AVAILABLE,
true);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case2) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
+TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE) {
+ CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
- am::HmiInterfaces::STATE_NOT_AVAILABLE,
- true);
+ am::HmiInterfaces::STATE_AVAILABLE,
+ false);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case3) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+TEST_F(AlertManeuverRequestTest, OnEvent_WARNINGS) {
+ CheckExpectations(hmi_apis::Common_Result::WARNINGS,
+ mobile_apis::Result::WARNINGS,
am::HmiInterfaces::STATE_NOT_RESPONSE,
true);
}
-TEST_F(AlertManeuverRequestTest, OnEvent_UNSUPPORTED_RESOURCE_Case4) {
+TEST_F(AlertManeuverRequestTest, OnEvent_GENERIC_ERROR) {
CheckExpectations(hmi_apis::Common_Result::GENERIC_ERROR,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ mobile_apis::Result::GENERIC_ERROR,
am::HmiInterfaces::STATE_NOT_RESPONSE,
false);
}
diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
index f83a40843c..5d9e507511 100644
--- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
@@ -60,7 +60,6 @@ using ::utils::SharedPtr;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -79,10 +78,7 @@ const mobile_apis::FunctionID::eType kFunctionId =
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- AlertRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
- , msg_(CreateMessage()) {}
+ AlertRequestTest() : mock_app_(CreateMockApp()), msg_(CreateMessage()) {}
protected:
MessageSharedPtr CreateFullParamsUISO() {
@@ -116,10 +112,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
info);
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void PreConditions() {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
@@ -128,12 +120,12 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(
- Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
+ Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(
- Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
+ Return(am::HmiInterfaces::InterfaceState::STATE_AVAILABLE));
}
void Expectations() {
@@ -155,9 +147,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
void AddAlertTextsToMsg() {
(*msg_)[am::strings::msg_params][am::strings::alert_text1] = "alert_text1";
(*msg_)[am::strings::msg_params][am::strings::alert_text2] = "alert_text2";
@@ -192,7 +181,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -248,9 +236,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
(*msg)[am::strings::msg_params][am::strings::info] =
"UI is not supported by system";
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
-
MessageSharedPtr msg_tts = CreateMessage();
(*msg_tts)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
@@ -263,9 +248,6 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) {
event.set_smart_object(*msg);
MessageSharedPtr ui_command_result;
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillByDefault(Return(am::mobile_api::Result::UNSUPPORTED_RESOURCE));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
@@ -302,14 +284,6 @@ TEST_F(AlertRequestTest, Init_DurationNotExists_SUCCESS) {
EXPECT_TRUE(command->Init());
}
-TEST_F(AlertRequestTest, OnTimeOut_UNSUCCESS) {
- Expectations();
- (*msg_)[am::strings::msg_params][am::strings::soft_buttons] = 0;
- CommandPtr command(CreateCommand<AlertRequest>(msg_));
- command->onTimeOut();
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
-}
-
TEST_F(AlertRequestTest, OnTimeOut_SUCCESS) {
Expectations();
MessageSharedPtr result_msg(CreateMessage(smart_objects::SmartType_Null));
@@ -442,8 +416,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_UI_OnResetTimeout_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_OnResetTimeout);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -504,8 +476,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarnings_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -574,16 +544,12 @@ TEST_F(AlertRequestTest,
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
tts_stop_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(tts_stop_event);
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::WARNINGS);
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -711,8 +677,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
tts_stop_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(tts_stop_event);
(*msg_)[am::strings::params][am::hmi_response::code] =
@@ -722,8 +686,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSAbortedUiAlertNotSent_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
@@ -750,8 +712,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
Event ui_event(hmi_apis::FunctionID::UI_Alert);
ui_event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(ui_event);
Event tts_stop_event(hmi_apis::FunctionID::TTS_StopSpeaking);
@@ -762,8 +722,6 @@ TEST_F(AlertRequestTest, DISABLED_OnEvent_TTSWarningUiAlertWarning_SUCCESS) {
Event event(hmi_apis::FunctionID::TTS_Speak);
event.set_smart_object(*msg_);
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
command->on_event(event);
}
diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
index 2fd43a6353..3d7671015c 100644
--- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
@@ -66,7 +66,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -80,7 +79,6 @@ namespace strings = ::application_manager::strings;
namespace hmi_response = ::application_manager::hmi_response;
namespace {
-const int32_t kCommandId = 1;
const uint32_t kAppId = 1u;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
@@ -90,8 +88,7 @@ class ChangeRegistrationRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ChangeRegistrationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, supported_languages_(CreateMessage(smart_objects::SmartType_Array)) {}
MessageSharedPtr CreateMsgFromMobile() {
@@ -121,26 +118,26 @@ class ChangeRegistrationRequestTest
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration))
- .WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
+ .WillRepeatedly(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
@@ -148,14 +145,11 @@ class ChangeRegistrationRequestTest
const am::HmiInterfaces::InterfaceState state,
const bool success,
const hmi_apis::Common_Result::eType ui_hmi_response =
- hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
const hmi_apis::Common_Result::eType vr_hmi_response =
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) {
MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_response));
-
utils::SharedPtr<ChangeRegistrationRequest> command =
CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
MockAppPtr mock_app = CreateMockApp();
@@ -173,6 +167,8 @@ class ChangeRegistrationRequestTest
EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name));
PrepareExpectationBeforeRun();
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(state));
command->Run();
MessageSharedPtr ui_response = CreateMessage(smart_objects::SmartType_Map);
@@ -184,9 +180,6 @@ class ChangeRegistrationRequestTest
(*tts_response)[strings::params][hmi_response::code] = hmi_response;
(*tts_response)[strings::msg_params] = 0;
- EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
- .WillRepeatedly(Return(state));
-
am::event_engine::Event event_ui(
hmi_apis::FunctionID::UI_ChangeRegistration);
event_ui.set_smart_object(*ui_response);
@@ -251,10 +244,6 @@ class ChangeRegistrationRequestTest
.WillByDefault(ReturnRef(hmi_capabilities_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectationsHmiCapabilities(
smart_objects::SmartObjectSPtr supported_languages) {
EXPECT_CALL(hmi_capabilities_, ui_supported_languages())
@@ -282,7 +271,6 @@ class ChangeRegistrationRequestTest
MockHMICapabilities;
sync_primitives::Lock app_set_lock_;
MockHMICapabilities hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr supported_languages_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -379,11 +367,52 @@ TEST_F(ChangeRegistrationRequestTest,
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_true) {
- CheckExpectations(hmi_apis::Common_Result::SUCCESS,
- mobile_apis::Result::UNSUPPORTED_RESOURCE,
- am::HmiInterfaces::STATE_NOT_AVAILABLE,
- true);
+ OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_false) {
+ MessageSharedPtr msg_from_mobile = CreateMsgFromMobile();
+ utils::SharedPtr<ChangeRegistrationRequest> command =
+ CreateCommand<ChangeRegistrationRequest>(msg_from_mobile);
+ MockAppPtr mock_app = CreateMockApp();
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, app_id()).WillByDefault(Return(1));
+ am::ApplicationSet application_set;
+ const utils::custom_string::CustomString name("name");
+ MockAppPtr app = CreateMockApp();
+ app->set_name(name);
+ DataAccessor<am::ApplicationSet> accessor(application_set, app_set_lock_);
+ application_set.insert(app);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ EXPECT_CALL(*app, name()).WillOnce(ReturnRef(name));
+
+ ON_CALL(app_mngr_, hmi_capabilities())
+ .WillByDefault(ReturnRef(hmi_capabilities_));
+ (*supported_languages_)[0] =
+ static_cast<int32_t>(mobile_apis::Language::EN_US);
+ EXPECT_CALL(hmi_capabilities_, ui_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+ EXPECT_CALL(hmi_capabilities_, vr_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+ EXPECT_CALL(hmi_capabilities_, tts_supported_languages())
+ .WillOnce(Return(supported_languages_.get()));
+
+ EXPECT_CALL(app_mngr_, hmi_interfaces())
+ .WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
+
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
+ MessageSharedPtr response_to_mobile;
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
+ command->Run();
+
+ EXPECT_EQ(
+ (*response_to_mobile)[strings::msg_params][strings::success].asBool(),
+ false);
+ EXPECT_EQ(
+ (*response_to_mobile)[strings::msg_params][strings::result_code].asInt(),
+ static_cast<int32_t>(mobile_apis::Result::UNSUPPORTED_RESOURCE));
}
TEST_F(ChangeRegistrationRequestTest,
@@ -403,17 +432,17 @@ TEST_F(ChangeRegistrationRequestTest,
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_false) {
+ OnEvent_TTS_UNSUPPORTED_RESOURCE_SUCCESS_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
mobile_apis::Result::UNSUPPORTED_RESOURCE,
am::HmiInterfaces::STATE_AVAILABLE,
- false,
+ true,
hmi_apis::Common_Result::SUCCESS,
hmi_apis::Common_Result::SUCCESS);
}
TEST_F(ChangeRegistrationRequestTest,
- OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_false) {
+ OnEvent_TTS_SUCCESS_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::SUCCESS,
mobile_apis::Result::SUCCESS,
am::HmiInterfaces::STATE_AVAILABLE,
@@ -425,7 +454,7 @@ TEST_F(ChangeRegistrationRequestTest,
TEST_F(ChangeRegistrationRequestTest,
OnEvent_TTS_WRONG_LANGUAGE_STATE_AVAILABLE_Expect_true) {
CheckExpectations(hmi_apis::Common_Result::WRONG_LANGUAGE,
- mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WRONG_LANGUAGE,
am::HmiInterfaces::STATE_AVAILABLE,
true,
hmi_apis::Common_Result::SUCCESS,
@@ -435,7 +464,7 @@ TEST_F(ChangeRegistrationRequestTest,
TEST_F(ChangeRegistrationRequestTest,
OnEvent_TTS_INVALID_DATA_STATE_AVAILABLE_Expect_false) {
CheckExpectations(hmi_apis::Common_Result::INVALID_DATA,
- mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::INVALID_DATA,
am::HmiInterfaces::STATE_AVAILABLE,
false,
hmi_apis::Common_Result::SUCCESS,
@@ -473,14 +502,14 @@ TEST_F(ChangeRegistrationRequestTest,
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
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_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(
mock_hmi_interfaces_,
@@ -488,7 +517,7 @@ TEST_F(ChangeRegistrationRequestTest,
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
index a627740588..c3513d2acb 100644
--- a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -65,7 +65,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -112,15 +111,9 @@ class CreateInteractionChoiceSetRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
CreateInteractionChoiceSetRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , message_(CreateMessage())
+ : message_(CreateMessage())
, command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_))
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~CreateInteractionChoiceSetRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ , mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsVRSO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -162,7 +155,6 @@ class CreateInteractionChoiceSetRequestTest
[am::strings::interaction_choice_set_id] = kChoiceSetId;
}
- MockMessageHelper& message_helper_mock_;
MessageSharedPtr message_;
CreateInteractionChoiceSetRequestPtr command_;
MockAppPtr mock_app_;
@@ -230,9 +222,6 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr));
EXPECT_EQ(NULL, ptr);
- ON_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
-
am::CommandsMap commands_map;
ON_CALL(*mock_app_, commands_map())
.WillByDefault(
@@ -282,7 +271,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) {
[am::strings::secondary_image] = kSecondImage;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -298,7 +287,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
kChoiceSetId;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* invalid_choice_set_id =
@@ -333,7 +322,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -370,7 +359,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillRepeatedly(Return(choice_set_id));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
if ((*message_)[am::strings::msg_params][am::strings::choice_set][0]
@@ -439,7 +428,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -478,7 +467,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -524,7 +513,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -557,7 +546,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -591,7 +580,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -638,7 +627,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -678,7 +667,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -718,7 +707,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -791,7 +780,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
smart_objects::SmartObject* choice_set_id = NULL;
diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
index efa889a2c1..c92ec81a1f 100644
--- a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_command_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
@@ -61,6 +60,7 @@ using am::commands::DeleteCommandRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
+using am::MockHmiInterfaces;
typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr;
@@ -74,9 +74,7 @@ const uint32_t kConnectionKey = 2u;
class DeleteCommandRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- DeleteCommandRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -129,13 +127,11 @@ class DeleteCommandRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(app_mngr_, hmi_interfaces())
+ .WillByDefault(ReturnRef(hmi_interfaces_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockMessageHelper& mock_message_helper_;
+ NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockAppPtr mock_app_;
};
@@ -154,14 +150,14 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- ON_CALL(mock_hmi_interfaces_,
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(*mock_app_, FindCommand(kCommandId))
.WillByDefault(Return(test_msg.get()));
ON_CALL(*mock_app_, get_grammar_id()).WillByDefault(Return(kConnectionKey));
@@ -171,7 +167,7 @@ TEST_F(DeleteCommandRequestTest,
hmi_apis::Common_Result::SUCCESS;
Event event_ui(hmi_apis::FunctionID::UI_DeleteCommand);
event_ui.set_smart_object(*msg);
-
+ command->Init();
command->Run();
command->on_event(event_ui);
@@ -185,6 +181,8 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*mock_app_, RemoveCommand(kCommandId));
+ EXPECT_CALL(*mock_app_, UpdateHash());
+
MessageSharedPtr vr_command_result;
EXPECT_CALL(
app_mngr_,
@@ -212,14 +210,14 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(mock_hmi_interfaces_,
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_hmi_interfaces_,
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ ON_CALL(hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get()));
ON_CALL(*app, get_grammar_id()).WillByDefault(Return(kConnectionKey));
@@ -229,6 +227,7 @@ TEST_F(DeleteCommandRequestTest,
Event event_vr(hmi_apis::FunctionID::VR_DeleteCommand);
event_vr.set_smart_object(*msg);
+ command->Init();
command->Run();
command->on_event(event_vr);
@@ -242,6 +241,8 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*app, RemoveCommand(kCommandId));
+ EXPECT_CALL(*app, UpdateHash());
+
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event_ui)));
diff --git a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
index a6d9d8f50a..192cad12b0 100644
--- a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_interaction_choice_set {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::InSequence;
diff --git a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
index beff4c3584..cc21e5366e 100644
--- a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
@@ -51,7 +51,6 @@ namespace mobile_commands_test {
namespace delete_sub_menu_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -97,22 +96,14 @@ class DeleteSubMenuRequestTest
public:
DeleteSubMenuRequestTest()
: accessor_(commands_map_, commands_lock_)
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, message_(CreateMessage())
, command_(CreateCommand<DeleteSubMenuRequest>(message_))
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~DeleteSubMenuRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
am::CommandsMap commands_map_;
mutable sync_primitives::Lock commands_lock_;
DataAccessor<am::CommandsMap> accessor_;
- MockMessageHelper& mock_message_helper_;
MessageSharedPtr message_;
DeleteSubMenuRequestPtr command_;
MockAppPtr app_;
@@ -149,10 +140,6 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
am::CommandsMap commands_map;
smart_objects::SmartObject commands_msg(smart_objects::SmartType_Map);
commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &commands_msg));
@@ -243,9 +230,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
(*message_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
event.set_smart_object(*message_);
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
MockAppPtr invalid_app;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(invalid_app));
EXPECT_CALL(*app_, RemoveSubMenu(_)).Times(0);
@@ -265,8 +249,6 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
const hmi_apis::Common_Result::eType result_code =
hmi_apis::Common_Result::SUCCESS;
(*message_)[am::strings::params][am::hmi_response::code] = result_code;
- ON_CALL(mock_message_helper_, HMIToMobileResult(result_code))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
event.set_smart_object(*message_);
commands_map_.insert(
@@ -318,10 +300,6 @@ TEST_F(DeleteSubMenuRequestTest,
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
@@ -345,9 +323,6 @@ TEST_F(DeleteSubMenuRequestTest,
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillRepeatedly(Return(am::mobile_api::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
EXPECT_CALL(*app_, commands_map()).Times(2).WillRepeatedly(Return(accessor_));
diff --git a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
index 60697446f2..4f46a6f715 100644
--- a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
@@ -71,17 +71,7 @@ const uint32_t kDiagnosticMode = 5u;
} // namespace
class DiagnosticMessageRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- DiagnosticMessageRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- ~DiagnosticMessageRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
@@ -181,10 +171,6 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) {
DiagnosticMessageRequestPtr command(
CreateCommand<DiagnosticMessageRequest>());
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
index b8c0ed23f3..33733f63ed 100644
--- a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -53,7 +53,6 @@ namespace end_audio_pass_thru_request {
namespace am = ::application_manager;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
@@ -64,12 +63,7 @@ using am::MockMessageHelper;
typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
class EndAudioPassThruRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- EndAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
const uint32_t kConnectionKey = 2u;
@@ -89,10 +83,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false));
MessageSharedPtr ui_command_result;
@@ -120,7 +110,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace end_audio_pass_thru_request
diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
index dfa38a758b..106a59803b 100644
--- a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
@@ -69,9 +69,7 @@ typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
class GetDTCsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
+ GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {}
};
TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
@@ -125,11 +123,7 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
Event event(hmi_apis::FunctionID::VehicleInfo_GetDTCs);
event.set_smart_object(*event_msg);
- MockMessageHelper& mock_message_helper =
- *MockMessageHelper::message_helper_mock();
- ON_CALL(mock_message_helper, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
index a851a72f8e..52aed6feb8 100644
--- a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -70,19 +70,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class GetVehicleDataRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- GetVehicleDataRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~GetVehicleDataRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
public:
@@ -201,8 +189,8 @@ TEST_F(GetVehicleDataRequestTest, Run_SUCCESS) {
CreateCommand<GetVehicleDataRequest>(command_msg));
am::VehicleData vehicle_data;
- vehicle_data.insert(
- am::VehicleData::value_type(kMsgParamKey, am::VehicleDataType::SPEED));
+ vehicle_data.insert(am::VehicleData::value_type(
+ kMsgParamKey, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
@@ -235,7 +223,7 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
const hmi_apis::Common_Result::eType hmi_response_code =
hmi_apis::Common_Result::DATA_NOT_AVAILABLE;
const mobile_result::eType mobile_response_code =
- mobile_result::VEHICLE_DATA_NOT_AVAILABLE;
+ mobile_result::DATA_NOT_AVAILABLE;
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
(*command_msg)[am::strings::params][am::strings::connection_key] =
@@ -251,10 +239,6 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) {
Event event(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
event.set_smart_object(*event_msg);
-
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
diff --git a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
index d886a2b1bd..979fb0cc83 100644
--- a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
@@ -53,7 +53,6 @@ namespace get_way_points_request {
using namespace mobile_apis::Result;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::_;
using application_manager::commands::GetWayPointsRequest;
using application_manager::MockMessageHelper;
@@ -61,6 +60,7 @@ using application_manager::MockHmiInterfaces;
typedef SharedPtr<GetWayPointsRequest> CommandPtr;
typedef mobile_apis::Result::eType MobileResult;
+typedef hmi_apis::Common_Result::eType HmiResult;
namespace {
const uint32_t kCorrelationId = 2u;
@@ -72,14 +72,7 @@ const std::string kMethodName = "Navigation.GetWayPoints";
class GetWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
-
- ~GetWayPointsRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map);
@@ -89,14 +82,9 @@ class GetWayPointsRequestTest
command_sptr_ =
CreateCommand<application_manager::commands::GetWayPointsRequest>(
message_);
- mock_app_ = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
-
- ON_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillByDefault(Return(mobile_apis::Result::SUCCESS));
}
- MockMessageHelper& message_helper_mock_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
utils::SharedPtr<application_manager::commands::GetWayPointsRequest>
@@ -106,17 +94,10 @@ class GetWayPointsRequestTest
class GetWayPointsRequestOnEventTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestOnEventTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~GetWayPointsRequestOnEventTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestOnEventTest() : app_(CreateMockApp()) {}
void CheckOnEventResponse(const std::string& wayPointsParam,
- const MobileResult ResultCode,
+ const HmiResult ResultCode,
const bool success) {
Event event(Event::EventID::Navigation_GetWayPoints);
CommandPtr command(CreateCommand<GetWayPointsRequest>());
@@ -131,17 +112,13 @@ class GetWayPointsRequestOnEventTest
event.set_smart_object(*event_msg);
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(ResultCode));
-
- MockAppPtr app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+ const MobileResult mobile_result = static_cast<MobileResult>(ResultCode);
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event)));
EXPECT_EQ(
- ResultCode,
- static_cast<mobile_apis::Result::eType>(
+ mobile_result,
+ static_cast<MobileResult>(
(*result_msg)[am::strings::msg_params][am::strings::result_code]
.asInt()));
EXPECT_EQ(
@@ -150,7 +127,6 @@ class GetWayPointsRequestOnEventTest
}
protected:
- MockMessageHelper& message_helper_mock_;
MockAppPtr app_;
MockHmiInterfaces hmi_interfaces_;
};
@@ -246,15 +222,15 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_WrongEventId_UNSUCCESS) {
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case1) {
- CheckOnEventResponse("0", SUCCESS, true);
+ CheckOnEventResponse("0", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case2) {
- CheckOnEventResponse("", SUCCESS, true);
+ CheckOnEventResponse("", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case3) {
- CheckOnEventResponse("test", SUCCESS, true);
+ CheckOnEventResponse("test", HmiResult::SUCCESS, true);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) {
@@ -265,7 +241,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse(" ", GENERIC_ERROR, false);
+ CheckOnEventResponse(" ", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) {
@@ -276,7 +252,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\t", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\t", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) {
@@ -287,7 +263,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\n", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\n", HmiResult::GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) {
@@ -298,7 +274,7 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- CheckOnEventResponse("test\t\n", GENERIC_ERROR, false);
+ CheckOnEventResponse("test\t\n", HmiResult::GENERIC_ERROR, false);
}
} // namespace get_way_points_request
diff --git a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
index 9ef978d756..6d7ccb1fa0 100644
--- a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
@@ -56,19 +56,7 @@ using testing::ReturnRef;
using testing::_;
class OnHashChangeNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnHashChangeNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
const uint32_t kConnectionKey = 1u;
@@ -83,7 +71,8 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, curHash()).WillOnce(ReturnRef(return_string));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -112,7 +101,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app, curHash()).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 34f8a010d8..78875ad164 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -235,16 +235,12 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(*mock_app, is_foreground()).WillOnce(Return(true));
- application_manager::MockMessageHelper& mock_message_helper =
- *application_manager::MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(&mock_message_helper);
- EXPECT_CALL(mock_message_helper, SendQueryApps(kConnectionKey, _));
+ EXPECT_CALL(mock_message_helper_, SendQueryApps(kConnectionKey, _));
command->Run();
ASSERT_EQ(application_manager::MessageType::kNotification,
(*msg)[strings::params][strings::message_type].asInt());
- Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(OnHMIStatusNotificationFromMobileTest,
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
index 2da0e60df1..9cb5610621 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -59,9 +59,6 @@ using testing::_;
class OnHMIStatusNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnHMIStatusNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
MessageSharedPtr CreateMsgParams(
const mobile_apis::HMILevel::eType kHMIState) {
MessageSharedPtr msg = CreateMessage();
@@ -70,13 +67,9 @@ class OnHMIStatusNotificationTest
return msg;
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
void SetSendNotificationExpectations(MessageSharedPtr& msg) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -88,8 +81,6 @@ class OnHMIStatusNotificationTest
ASSERT_EQ(CommandImpl::protocol_version_,
(*msg)[strings::params][strings::protocol_version].asInt());
}
-
- MockMessageHelper& message_helper_;
};
TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
@@ -141,7 +132,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) {
EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false));
EXPECT_CALL(*mock_app, set_tts_properties_in_none(true));
- EXPECT_CALL(message_helper_, SendTTSGlobalProperties(_, false, _));
+ EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _));
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
index d56cd98904..7313f32dca 100644
--- a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -61,11 +61,9 @@ using testing::_;
class OnKeyBoardInputNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnKeyBoardInputNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
void SetSendNotificationExpectations(MessageSharedPtr msg) {
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -78,14 +76,6 @@ class OnKeyBoardInputNotificationTest
(*msg)[strings::params][strings::protocol_version].asInt());
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
@@ -95,7 +85,6 @@ class OnKeyBoardInputNotificationTest
return app;
}
- MockMessageHelper& message_helper_;
SharedPtr<ApplicationSet> app_set_;
sync_primitives::Lock lock_;
};
@@ -162,7 +151,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(*mock_app, hmi_level())
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
index 43f725012d..7840e35cec 100644
--- a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
@@ -64,20 +64,7 @@ const uint32_t kConnectionKey = 1u;
} // namespace
class OnSystemRequestNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnSystemRequestNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
const RequestType::eType kRequestType = RequestType::PROPRIETARY;
@@ -107,7 +94,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, TimeoutExchangeSec()).WillOnce(Return(5u));
#endif // PROPRIETARY_MODE
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -143,7 +131,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(true));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -176,7 +165,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
MockPolicyHandlerInterface mock_policy_handler;
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
@@ -203,7 +192,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(false));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
;
diff --git a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
index d00e62bcfb..05d97856e4 100644
--- a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -71,11 +71,9 @@ class OnVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
OnVehicleDataNotificationTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
NotificationPtr command_;
};
@@ -113,7 +111,8 @@ TEST_F(OnVehicleDataNotificationTest,
Run_NotEmptyListOfAppsSubscribedForEvent_SUCCESS) {
am::VehicleData test_vehicle_data;
test_vehicle_data.insert(am::VehicleData::value_type(
- am::strings::fuel_level, am::VehicleDataType::FUELLEVEL));
+ am::strings::fuel_level,
+ mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL));
EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(test_vehicle_data));
@@ -126,9 +125,10 @@ TEST_F(OnVehicleDataNotificationTest,
std::vector<ApplicationSharedPtr> applications;
applications.push_back(mock_app);
- EXPECT_CALL(app_mngr_,
- IviInfoUpdated(am::VehicleDataType::FUELLEVEL, kFuelLevel))
- .WillOnce(Return(applications));
+ EXPECT_CALL(
+ app_mngr_,
+ IviInfoUpdated(mobile_apis::VehicleDataType::VEHICLEDATA_FUELLEVEL,
+ kFuelLevel)).WillOnce(Return(applications));
EXPECT_CALL(*mock_app, app_id()).WillRepeatedly(Return(kAppId));
::utils::custom_string::CustomString dummy_name("test_app");
diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
index e2adc38f50..6c35a5372a 100644
--- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -80,8 +79,7 @@ class PerformAudioPassThruRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
PerformAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map))
, msg_params_((*message_)[am::strings::msg_params]) {}
@@ -137,10 +135,6 @@ class PerformAudioPassThruRequestTest
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(application_sptr_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -153,7 +147,6 @@ class PerformAudioPassThruRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
::smart_objects::SmartObject& msg_params_;
@@ -192,33 +185,33 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) {
(*vr_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(am::mobile_api::Result::GENERIC_ERROR));
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(PerformAudioPassThruRequestTest,
OnEvent_UIHmiSendUnsupportedResource_UNSUPPORTED_RESOURCE) {
- MessageSharedPtr msg_ui = CreateFullParamsUISO();
- (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ MessageSharedPtr mobile_request = CreateFullParamsUISO();
+ (*mobile_request)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ smart_objects::SmartObject initial_prompt =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ initial_prompt[0] = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ initial_prompt[0][am::strings::text] = "tts chunk text";
+ initial_prompt[0][am::strings::type] = 0;
+ (*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] =
+ initial_prompt;
+ EXPECT_CALL(*application_sptr_, hmi_level())
+ .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
utils::SharedPtr<PerformAudioPassThruRequest> command =
- CreateCommand<PerformAudioPassThruRequest>(msg_ui);
-
- MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
- (*msg)[am::strings::params][am::hmi_response::code] =
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- (*msg)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
- (*msg)[am::strings::msg_params][am::strings::info] =
- "UI is not supported by system";
-
- am::event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
- event.set_smart_object(*msg);
+ CreateCommand<PerformAudioPassThruRequest>(mobile_request);
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));
MessageSharedPtr response_msg_tts =
CreateMessage(smart_objects::SmartType_Map);
@@ -227,21 +220,39 @@ TEST_F(PerformAudioPassThruRequestTest,
(*response_msg_tts)[am::strings::msg_params][am::strings::cmd_id] = kCmdId;
am::event_engine::Event event_tts(hmi_apis::FunctionID::TTS_Speak);
event_tts.set_smart_object(*response_msg_tts);
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
- command->on_event(event_tts);
- MessageSharedPtr ui_command_result;
+ MessageSharedPtr response_ui = CreateMessage(smart_objects::SmartType_Map);
+ (*response_ui)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
+ (*response_ui)[am::strings::msg_params][am::strings::cmd_id] = kCommandId;
+ (*response_ui)[am::strings::msg_params][am::strings::info] =
+ "UI is not supported by system";
+ am::event_engine::Event event_ui(
+ hmi_apis::FunctionID::UI_PerformAudioPassThru);
+ event_ui.set_smart_object(*response_ui);
+
+ MessageSharedPtr response_to_mobile;
EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false));
+ EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillRepeatedly(Return(true));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
- .WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true)));
- command->on_event(event);
+ command->Run();
+ command->on_event(event_tts);
+ command->on_event(event_ui);
- ResultCommandExpectations(ui_command_result, "UI is not supported by system");
+ EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool(),
+ false);
+ EXPECT_EQ(
+ (*response_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asInt(),
+ static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
+ EXPECT_EQ((*response_to_mobile)[am::strings::msg_params][am::strings::info]
+ .asString(),
+ "UI is not supported by system");
}
TEST_F(PerformAudioPassThruRequestTest,
@@ -546,10 +557,6 @@ TEST_F(PerformAudioPassThruRequestTest, OnEvent_UIPAPT_Rejected) {
hmi_apis::Common_Result::REJECTED;
event.set_smart_object(*message_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::REJECTED))
- .WillOnce(Return(am::mobile_api::Result::REJECTED));
-
CallOnEvent caller(*command_sptr_, event);
MessageSharedPtr result_message = CatchMobileCommandResult(caller);
@@ -582,15 +589,12 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
-
CallOnEvent caller(*command_sptr_, event);
caller();
}
TEST_F(PerformAudioPassThruRequestTest,
- OnEvent_PAPTunsupportedResource_CorrectInfo) {
+ DISABLED_OnEvent_PAPTunsupportedResource_CorrectInfo) {
const std::string return_info = "Unsupported phoneme type sent in a prompt";
am::event_engine::Event event_speak(hmi_apis::FunctionID::TTS_Speak);
@@ -646,8 +650,6 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
CallOnEvent caller(*command_sptr_, event);
caller();
@@ -771,8 +773,6 @@ TEST_F(PerformAudioPassThruRequestTest,
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::TTS_StopSpeaking)))
.WillOnce(Return(false));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
command_sptr_->onTimeOut();
}
diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
index 84a0e0b354..a272234e82 100644
--- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
@@ -63,7 +63,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,9 +81,7 @@ const uint32_t kConnectionKey = 2u;
class PerformInteractionRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- PerformInteractionRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -92,10 +89,6 @@ class PerformInteractionRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -108,7 +101,6 @@ class PerformInteractionRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -191,10 +183,10 @@ TEST_F(PerformInteractionRequestTest,
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
- .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr response_to_mobile;
@@ -222,10 +214,10 @@ TEST_F(PerformInteractionRequestTest,
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_VR))
- .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr response_msg_vr =
CreateMessage(smart_objects::SmartType_Map);
diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
index 7e46f6942f..c88f4626f0 100644
--- a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
@@ -90,11 +90,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- am::MockMessageHelper& mock_message_helper(
- *am::MockMessageHelper::message_helper_mock());
- EXPECT_CALL(mock_message_helper, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
@@ -102,8 +97,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
command->on_event(event);
-
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
index 844f87d57e..b7a004f199 100644
--- a/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc
@@ -43,17 +43,19 @@
#include "application_manager/application.h"
#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_helper.h"
#include "interfaces/MOBILE_API.h"
#include "application_manager/smart_object_keys.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
-#include "utils/data_accessor.h"
#include "protocol_handler/mock_session_observer.h"
#include "connection_handler/mock_connection_handler.h"
#include "application_manager/mock_hmi_capabilities.h"
#include "application_manager/mock_resume_ctrl.h"
#include "application_manager/mock_hmi_interface.h"
+#include "utils/data_accessor.h"
#include "utils/custom_string.h"
#include "utils/lock.h"
+#include "utils/macro.h"
namespace test {
namespace components {
@@ -90,11 +92,22 @@ class RegisterAppInterfaceRequestTest
RegisterAppInterfaceRequestTest()
: msg_(CreateMessage())
, command_(CreateCommand<RegisterAppInterfaceRequest>(msg_))
- , app_name_("test_app_name_") {
+ , app_name_("test_app_name_")
+ , mock_application_helper_(
+ application_manager_test::MockApplicationHelper::
+ application_helper_mock()) {
InitGetters();
InitLanguage();
}
+ void SetUp() OVERRIDE {
+ testing::Mock::VerifyAndClearExpectations(&mock_application_helper_);
+ }
+
+ void TearDown() OVERRIDE {
+ testing::Mock::VerifyAndClearExpectations(&mock_application_helper_);
+ }
+
void InitBasicMessage() {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
(*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId;
@@ -112,6 +125,7 @@ class RegisterAppInterfaceRequestTest
ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString));
ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage));
ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage));
+ ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId));
return mock_app;
}
@@ -151,6 +165,9 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed));
ON_CALL(app_mngr_, GetDeviceTransportType(_))
.WillByDefault(Return(hmi_apis::Common_TransportType::WIFI));
+ ON_CALL(app_mngr_, IsAppInReconnectMode(_)).WillByDefault(Return(false));
+ ON_CALL(app_mngr_, application_by_policy_id(_))
+ .WillByDefault(Return(ApplicationSharedPtr()));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(
@@ -167,6 +184,43 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
}
+ void SetCommonExpectionsOnSwitchedApplication(
+ MockAppPtr mock_app, mobile_apis::Result::eType response_result_code) {
+ EXPECT_CALL(mock_policy_handler_, AddApplication(_, _)).Times(0);
+
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(response_result_code), _));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered)))
+ .Times(0);
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::Buttons_OnButtonSubscription)))
+ .Times(0);
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_ChangeRegistration))).Times(0);
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_ChangeRegistration))).Times(0);
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::VR_ChangeRegistration))).Times(0);
+
+ EXPECT_CALL(
+ app_mngr_,
+ OnApplicationSwitched(
+ MockAppPtr::static_pointer_cast<application_manager::Application>(
+ mock_app)));
+ }
+
MessageSharedPtr msg_;
SharedPtr<RegisterAppInterfaceRequest> command_;
@@ -194,6 +248,7 @@ class RegisterAppInterfaceRequestTest
MockConnectionHandler mock_connection_handler_;
MockSessionObserver mock_session_observer_;
MockHMICapabilities mock_hmi_capabilities_;
+ application_manager_test::MockApplicationHelper& mock_application_helper_;
};
TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
@@ -353,6 +408,113 @@ TEST_F(RegisterAppInterfaceRequestTest,
command_->Run();
}
+TEST_F(RegisterAppInterfaceRequestTest,
+ SwitchApplication_CorrectHash_ExpectNoCleanupSuccess) {
+ InitBasicMessage();
+
+ const std::string request_hash_id = "abc123";
+ (*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ .WillRepeatedly(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
+
+ EXPECT_CALL(
+ mock_resume_crt_,
+ CheckApplicationHash(
+ MockAppPtr::static_pointer_cast<application_manager::Application>(
+ mock_app),
+ request_hash_id)).WillOnce(Return(true));
+
+ EXPECT_CALL(mock_resume_crt_, RemoveApplicationFromSaved(_)).Times(0);
+
+ EXPECT_CALL(mock_application_helper_, RecallApplicationData(_, _)).Times(0);
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+
+ SetCommonExpectionsOnSwitchedApplication(mock_app,
+ mobile_apis::Result::SUCCESS);
+
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ SwitchApplication_WrongHash_ExpectCleanupResumeFailed) {
+ InitBasicMessage();
+
+ const std::string request_hash_id = "abc123";
+ (*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ .WillRepeatedly(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
+
+ EXPECT_CALL(
+ mock_resume_crt_,
+ CheckApplicationHash(
+ MockAppPtr::static_pointer_cast<application_manager::Application>(
+ mock_app),
+ request_hash_id)).WillOnce(Return(false));
+
+ EXPECT_CALL(
+ mock_application_helper_,
+ RecallApplicationData(
+ MockAppPtr::static_pointer_cast<application_manager::Application>(
+ mock_app),
+ _));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+
+ SetCommonExpectionsOnSwitchedApplication(mock_app,
+ mobile_apis::Result::RESUME_FAILED);
+
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ SwitchApplication_NoHash_ExpectCleanupResumeFailed) {
+ InitBasicMessage();
+
+ MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ .WillRepeatedly(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+
+ EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
+
+ EXPECT_CALL(
+ mock_application_helper_,
+ RecallApplicationData(
+ MockAppPtr::static_pointer_cast<application_manager::Application>(
+ mock_app),
+ _));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).Times(0);
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(mock_app));
+
+ SetCommonExpectionsOnSwitchedApplication(mock_app,
+ mobile_apis::Result::RESUME_FAILED);
+
+ command_->Run();
+}
+
} // namespace register_app_interface_request
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
index e133ec9119..69fee02262 100644
--- a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
@@ -58,7 +58,6 @@ namespace mobile_commands_test {
namespace reset_global_properties {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -83,11 +82,7 @@ class ResetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
ResetGlobalPropertiesRequestTest()
- : mock_message_helper_(am::MockMessageHelper::message_helper_mock())
- , msg_(CreateMessage())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
+ : msg_(CreateMessage()), mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -102,10 +97,6 @@ class ResetGlobalPropertiesRequestTest
.WillByDefault(Return(kCorrelationId));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
- am::MockMessageHelper* mock_message_helper_;
MessageSharedPtr msg_;
MockAppPtr mock_app_;
ResetGlobalPropertiesRequestPtr command_;
@@ -177,7 +168,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help; // = NULL;
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
@@ -230,7 +221,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
smart_objects::SmartObject msg_params =
@@ -272,8 +263,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
const hmi_apis::Common_Result::eType result_code =
hmi_apis::Common_Result::SUCCESS;
(*msg_)[am::strings::params][am::hmi_response::code] = result_code;
- ON_CALL(*mock_message_helper_, HMIToMobileResult(result_code))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
(*msg_)[am::strings::msg_params][am::strings::properties][0] =
mobile_apis::GlobalProperty::VRHELPTITLE;
@@ -285,7 +274,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
command_->Run();
@@ -346,16 +335,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
command_->on_event(event);
}
-TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) {
- Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
- event.set_smart_object(*msg_);
-
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
- EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
-
- command_->on_event(event);
-}
-
TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) {
MessageSharedPtr message(CreateMessage());
ResetGlobalPropertiesResponsePtr command(
@@ -380,7 +359,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
@@ -389,9 +368,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
CreateCommand<ResetGlobalPropertiesRequest>(msg_);
command->Run();
- EXPECT_CALL(*mock_message_helper_, HMIToMobileResult(_))
- .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS),
@@ -402,6 +378,186 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
command->on_event(event);
}
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitTTS_Timeout_GENERIC_ERROR_TTSNotRespond) {
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ ResetGlobalPropertiesRequestPtr command =
+ CreateCommand<ResetGlobalPropertiesRequest>(msg_);
+ command->Run();
+
+ // Received response only from UI
+ MessageSharedPtr ui_msg = CreateMessage();
+ (*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
+ (*ui_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*ui_msg)[am::strings::msg_params] =
+ SmartObject(smart_objects::SmartType_Map);
+ Event ui_event(hmi_apis::FunctionID::UI_SetGlobalProperties);
+ ui_event.set_smart_object(*ui_msg);
+ command->on_event(ui_event);
+
+ // TTS doesn't respond, so timeout should send generic error
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+ const std::string info = "TTS component does not respond";
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command->onTimeOut();
+}
+
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitUI_Timeout_GENERIC_ERROR_UINotRespond) {
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ command_->Run();
+
+ // Received response only from TTS
+ MessageSharedPtr tts_msg = CreateMessage();
+ (*tts_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
+ (*tts_msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+
+ Event tts_event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ tts_event.set_smart_object(*tts_msg);
+ command_->on_event(tts_event);
+
+ // UI doesn't respond, so timeout should send generic error
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+
+ const std::string info = "UI component does not respond";
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command_->onTimeOut();
+}
+
+TEST_F(ResetGlobalPropertiesRequestTest,
+ Run_WaitUIAndTTS_Timeout_GENERIC_ERROR_TTSAndUINotRespond) {
+ Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
+ (*msg_)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::UNSUPPORTED_RESOURCE;
+
+ (*msg_)[am::strings::msg_params][am::strings::properties][0] =
+ mobile_apis::GlobalProperty::TIMEOUTPROMPT;
+ (*msg_)[am::strings::msg_params][am::strings::properties][1] =
+ mobile_apis::GlobalProperty::MENUICON;
+
+ std::vector<std::string> time_out_prompt;
+ time_out_prompt.push_back("time_out");
+ EXPECT_CALL(app_mngr_settings_, time_out_promt())
+ .WillOnce(ReturnRef(time_out_prompt));
+
+ EXPECT_CALL(*mock_app_, set_timeout_prompt(_));
+
+ smart_objects::SmartObjectSPtr prompt =
+ utils::MakeShared<smart_objects::SmartObject>();
+ *prompt = "prompt";
+
+ EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get()));
+
+ EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
+
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::UI_SetGlobalProperties)))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_,
+ ManageHMICommand(HMIResultCodeIs(
+ hmi_apis::FunctionID::TTS_SetGlobalProperties)))
+ .WillOnce(Return(true));
+
+ command_->Run();
+ // TTS and UI don't respond, so timeout should send generic error
+ std::string info = "TTS, UI component does not respond";
+ smart_objects::SmartObjectSPtr response =
+ utils::MakeShared<smart_objects::SmartObject>();
+ (*response)[am::strings::msg_params][am::strings::result_code] =
+ mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ .WillOnce(Return(response));
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(
+ MobileResponseIs(mobile_apis::Result::GENERIC_ERROR, info, false),
+ am::commands::Command::ORIGIN_SDL));
+ command_->onTimeOut();
+}
+
} // namespace reset_global_properties
} // namespace mobile_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
index d9fac769e5..4520e1b120 100644
--- a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
@@ -65,7 +65,6 @@ using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ref;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -84,9 +83,6 @@ const uint32_t kFunctionID = 3u;
class ScrollableMessageRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ScrollableMessageRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
typedef TypeIf<kMocksAreNice,
NiceMock<application_manager_test::MockHMICapabilities>,
application_manager_test::MockHMICapabilities>::Result
@@ -118,11 +114,6 @@ class ScrollableMessageRequestTest
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
command_ = CreateCommand<ScrollableMessageRequest>(msg_);
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MockPolicyHandlerInterface mock_policy_handler_;
@@ -159,10 +150,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_ScrollableMessage);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -185,7 +172,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
@@ -274,8 +260,6 @@ TEST_F(ScrollableMessageRequestTest,
DISABLED_OnEvent_ReceivedUIScrollableMessage_SUCCESS) {
(*msg_)[params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
@@ -289,9 +273,6 @@ TEST_F(ScrollableMessageRequestTest,
(*msg_)[params][hmi_response::code] =
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(
diff --git a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
index 03cc715188..c5786675d6 100644
--- a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
@@ -54,7 +54,6 @@ using utils::SharedPtr;
using testing::_;
using testing::Return;
using testing::ReturnRef;
-using ::testing::Mock;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
@@ -92,18 +91,13 @@ class SendLocationRequestTest
typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt;
- SendLocationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ SendLocationRequestTest() {
mock_app_ = CreateMockApp();
disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
message_ = CreateMessage();
command_ = CreateCommand<UnwrappedSendLocationRequest>(message_);
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void InitialSetup(MessageSharedPtr message_) {
(*message_)[strings::params][strings::connection_key] = kConnectionKey;
(*message_)[strings::params][strings::function_id] = kFunctionID;
@@ -158,7 +152,6 @@ class SendLocationRequestTest
MockAppPtr mock_app_;
MockHMICapabilities mock_hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
SharedPtr<SmartObject> disp_cap_;
MessageSharedPtr message_;
CommandSPrt command_;
@@ -356,10 +349,6 @@ TEST_F(SendLocationRequestTest, OnEvent_Success) {
Event event(hmi_apis::FunctionID::Navigation_SendLocation);
event.set_smart_object(*message_);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
MockAppPtr app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(app));
diff --git a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
index 60b01f2cfa..b278479df8 100644
--- a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -70,19 +69,6 @@ const uint32_t kConnectionKey = 2u;
class SetAppIconRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetAppIconRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockMessageHelper& mock_message_helper_;
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -134,10 +120,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_SetAppIcon);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
diff --git a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
index 68aa76010f..8444b88d63 100644
--- a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
@@ -59,7 +59,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -80,20 +79,12 @@ MATCHER_P(CheckMshCorrId, corr_id, "") {
class SetDisplayLayoutRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetDisplayLayoutRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
+ SetDisplayLayoutRequestTest() : mock_app_(CreateMockApp()) {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- ~SetDisplayLayoutRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -130,7 +121,6 @@ class SetDisplayLayoutRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -164,9 +154,6 @@ TEST_F(SetDisplayLayoutRequestTest,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -245,17 +232,12 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
(*dispaly_capabilities_msg)[am::hmi_response::templates_available] =
"templates_available";
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
EXPECT_CALL(app_mngr_, hmi_capabilities())
.WillOnce(ReturnRef(hmi_capabilities));
EXPECT_CALL(hmi_capabilities, display_capabilities())
.WillOnce(Return(dispaly_capabilities_msg.get()));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
+
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS),
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..641e5636a9 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
@@ -59,7 +59,6 @@ using am::CommandsMap;
using utils::custom_string::CustomString;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kPosition = 1u;
class SetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetGlobalPropertiesRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetGlobalPropertiesRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -118,6 +115,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 +151,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));
@@ -216,10 +217,6 @@ class SetGlobalPropertiesRequestTest
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -242,13 +239,12 @@ 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_;
MockAppPtr mock_app_;
};
@@ -323,6 +319,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 +347,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 +1028,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 +1055,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 +1085,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 +1119,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 +1136,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 +1169,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 +1181,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 +1199,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
diff --git a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
index 3056d0e9fc..cf668c8b36 100644
--- a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
@@ -55,7 +55,6 @@ using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kSeconds = 1u;
class SetMediaClockRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetMediaClockRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetMediaClockRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -85,10 +82,6 @@ class SetMediaClockRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -114,7 +107,6 @@ class SetMediaClockRequestTest
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
}
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -140,10 +132,6 @@ TEST_F(SetMediaClockRequestTest,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_RESPONSE));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -328,12 +316,9 @@ TEST_F(SetMediaClockRequestTest, Run_InvalidApp_Canceled) {
TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
- mobile_apis::Result::SUCCESS;
+ hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Null);
- SharedPtr<SetMediaClockRequest> command(
- CreateCommand<SetMediaClockRequest>(msg));
-
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
MockAppPtr app(CreateMockApp());
@@ -341,7 +326,8 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*msg);
-
+ SharedPtr<SetMediaClockRequest> command(
+ CreateCommand<SetMediaClockRequest>(msg));
command->on_event(event);
}
diff --git a/src/components/application_manager/test/commands/mobile/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc
index d1e3c14181..4752bac0fd 100644
--- a/src/components/application_manager/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/test/commands/mobile/show_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using test::components::policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -73,8 +72,7 @@ const uint32_t kFunctionID = 3u;
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ShowRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ ShowRequestTest() {
mock_app_ = CreateMockApp();
}
sync_primitives::Lock lock_;
@@ -203,16 +201,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MockAppPtr mock_app_;
- MockMessageHelper& mock_message_helper_;
std::string text_field_;
};
@@ -238,10 +227,6 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr vr_command_result;
EXPECT_CALL(
app_mngr_,
@@ -264,12 +249,9 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -298,13 +280,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -328,13 +306,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -361,13 +335,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -392,13 +362,9 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -420,13 +386,9 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -447,13 +409,9 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -478,13 +436,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -506,13 +460,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -533,8 +483,6 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) {
@@ -720,7 +668,6 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) {
}
TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
MessageSharedPtr msg = CreateMsgParams();
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
@@ -745,10 +692,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*ev_msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -764,8 +707,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
(*ui_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(mobile_apis::Result::WARNINGS));
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) {
@@ -943,9 +884,6 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
- ON_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::eType::SUCCESS))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _));
@@ -967,9 +905,6 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) {
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::WARNINGS))
- .WillOnce(Return(mobile_apis::Result::WARNINGS));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
Event event(hmi_apis::FunctionID::UI_Show);
diff --git a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
index cbc2d702b3..7ded373d29 100644
--- a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
@@ -58,28 +58,12 @@ namespace commands = am::commands;
using ::testing::_;
using ::testing::Types;
using ::testing::Return;
-using ::testing::Mock;
-
-using am::MockMessageHelper;
template <class Command>
class MobileNotificationCommandsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
typedef Command CommandType;
-
- public:
- MobileNotificationCommandsTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- ~MobileNotificationCommandsTest() {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- protected:
- MockMessageHelper& message_helper_;
};
typedef Types<commands::OnAppInterfaceUnregisteredNotification,
diff --git a/src/components/application_manager/test/commands/mobile/slider_test.cc b/src/components/application_manager/test/commands/mobile/slider_test.cc
index 20262ed35a..54ac3cccc0 100644
--- a/src/components/application_manager/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/test/commands/mobile/slider_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,8 +81,7 @@ class SliderRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SliderRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, msg_(CreateMessage(smart_objects::SmartType_Map)) {}
MessageSharedPtr CreateFullParamsUISO() {
@@ -123,10 +121,6 @@ class SliderRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectManageMobileCommandWithResultCode(
const mobile_apis::Result::eType code) {
EXPECT_CALL(
@@ -135,12 +129,8 @@ class SliderRequestTest
am::commands::Command::CommandOrigin::ORIGIN_SDL));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -167,10 +157,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_Slider);
event.set_smart_object(*msg);
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
- .WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
-
MessageSharedPtr ui_command_result;
EXPECT_CALL(
app_mngr_,
@@ -193,7 +179,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
class CallOnTimeOut {
@@ -325,9 +310,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderPositionExists_SUCCESS) {
(*msg_)[am::strings::params][am::strings::data]
[am::strings::slider_position] = "position";
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::TIMED_OUT))
- .WillOnce(Return(mobile_apis::Result::TIMED_OUT));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::TIMED_OUT);
Event event(hmi_apis::FunctionID::UI_Slider);
@@ -343,9 +325,6 @@ TEST_F(SliderRequestTest, OnEvent_UISliderAborted_SUCCESS) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::ABORTED;
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::ABORTED))
- .WillOnce(Return(mobile_apis::Result::ABORTED));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::ABORTED);
Event event(hmi_apis::FunctionID::UI_Slider);
diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
index f8a7d22b40..f07012d315 100644
--- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
@@ -84,16 +84,9 @@ const uint32_t kConnectionKey = 5u;
class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SpeakRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , request_(CreateMessage(smart_objects::SmartType_Map))
+ : request_(CreateMessage(smart_objects::SmartType_Map))
, response_(CreateMessage(smart_objects::SmartType_Map))
- , app_(CreateMockApp()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~SpeakRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
const mobile_apis::Result::eType mobile_response,
@@ -114,10 +107,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
MessageSharedPtr response_to_mobile;
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
- .WillOnce(Return(mobile_response));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
@@ -134,7 +123,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
static_cast<int32_t>(mobile_response));
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr request_;
MessageSharedPtr response_;
MockAppPtr app_;
@@ -156,9 +144,6 @@ TEST_F(SpeakRequestTest, OnEvent_SUCCESS_Expect_true) {
MessageSharedPtr response_to_mobile;
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
@@ -349,8 +334,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_Speak_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
- .WillOnce(Return(am::mobile_api::Result::SUCCESS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
@@ -369,8 +352,6 @@ TEST_F(SpeakRequestTest, OnEvent_TTS_SpeakWithWarning_WarningWithSuccess) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
- .WillOnce(Return(am::mobile_api::Result::WARNINGS));
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS), _));
diff --git a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
index 4546293172..87127231be 100644
--- a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -51,16 +51,15 @@ namespace mobile_commands_test {
namespace subscribe_way_points_request {
using ::testing::_;
+using ::testing::A;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::DoAll;
using ::testing::SaveArg;
using ::testing::InSequence;
-using ::testing::Mock;
namespace am = ::application_manager;
using am::commands::SubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr;
@@ -72,14 +71,15 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
MockAppPtr app(CreateMockApp());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(_))
+ ON_CALL(app_mngr_, IsAppSubscribedForWayPoints(A<am::ApplicationSharedPtr>()))
.WillByDefault(Return(false));
ON_CALL(app_mngr_, IsAnyAppSubscribedForWayPoints())
.WillByDefault(Return(true));
{
InSequence dummy;
- EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_));
+ EXPECT_CALL(app_mngr_,
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
EXPECT_CALL(*app, UpdateHash());
}
@@ -106,16 +106,13 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(mock_message_helper);
-
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
{
InSequence dummy;
- EXPECT_CALL(app_mngr_, SubscribeAppForWayPoints(_));
- EXPECT_CALL(*mock_message_helper, HMIToMobileResult(result_code))
+ EXPECT_CALL(app_mngr_,
+ SubscribeAppForWayPoints(A<am::ApplicationSharedPtr>()));
+ EXPECT_CALL(mock_message_helper_, HMIToMobileResult(result_code))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
EXPECT_CALL(*app, UpdateHash());
@@ -123,8 +120,6 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
command->Init();
command->on_event(event);
-
- Mock::VerifyAndClearExpectations(mock_message_helper);
}
} // namespace subscribe_way_points_request
diff --git a/src/components/application_manager/test/commands/mobile/system_request_test.cc b/src/components/application_manager/test/commands/mobile/system_request_test.cc
new file mode 100644
index 0000000000..0e07889b4b
--- /dev/null
+++ b/src/components/application_manager/test/commands/mobile/system_request_test.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2017, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdint.h>
+#include <string>
+#include <set>
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/mobile/system_request.h"
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/policies/mock_policy_handler_interface.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace system_request {
+
+namespace am = application_manager;
+using am::commands::SystemRequest;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using am::MockHmiInterfaces;
+using am::event_engine::Event;
+using policy_test::MockPolicyHandlerInterface;
+using ::utils::SharedPtr;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const std::string kAppPolicyId = "fake-app-id";
+const uint32_t kDefaultTimeout = 1000u;
+const std::string kAppFolderName = "fake-app-name";
+const std::string kAppStorageFolder = "fake-storage";
+const std::string kSystemFilesPath = "/fake/system/files";
+const std::string kFileName = "Filename";
+} // namespace
+
+class SystemRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ SystemRequestTest() : mock_app_(CreateMockApp()) {}
+
+ protected:
+ MessageSharedPtr CreateIVSUMessage() {
+ MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::msg_params][am::strings::request_type] =
+ mobile_apis::RequestType::HTTP;
+ (*msg)[am::strings::msg_params][am::strings::file_name] = kFileName;
+ return msg;
+ }
+
+ void PreConditions() {
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId));
+ ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName));
+
+ ON_CALL(app_mngr_settings_, system_files_path())
+ .WillByDefault(ReturnRef(kSystemFilesPath));
+ ON_CALL(app_mngr_settings_, app_storage_folder())
+ .WillByDefault(ReturnRef(kAppStorageFolder));
+
+ ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _))
+ .WillByDefault(Return(true));
+ }
+
+ void ExpectManageMobileCommandWithResultCode(
+ const mobile_apis::Result::eType code) {
+ EXPECT_CALL(
+ app_mngr_,
+ ManageMobileCommand(MobileResultCodeIs(code),
+ am::commands::Command::CommandOrigin::ORIGIN_SDL));
+ }
+
+ MockAppPtr mock_app_;
+ MockPolicyHandlerInterface mock_policy_handler_;
+};
+
+TEST_F(SystemRequestTest, Run_HTTP_FileName_no_binary_data_REJECTED) {
+ PreConditions();
+ MessageSharedPtr msg = CreateIVSUMessage();
+
+ ExpectManageMobileCommandWithResultCode(mobile_apis::Result::REJECTED);
+
+ SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg));
+ command->Run();
+}
+
+} // namespace system_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
index ae4e46d40b..3d083f5c45 100644
--- a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -90,7 +90,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) {
mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM;
MessageSharedPtr dummy_msg(CreateMessage());
- EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(),
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kConnectionKey, kUnregisterReason))
.WillOnce(Return(dummy_msg));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 9652364646..bb4824e8f7 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -59,7 +59,8 @@ typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kMsgParamKey = "test_key";
-const am::VehicleDataType kVehicleType = am::VehicleDataType::SPEED;
+const mobile_apis::VehicleDataType::eType kVehicleType =
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED;
} // namespace
class UnsubscribeVehicleRequestTest
@@ -91,8 +92,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
kVehicleType;
am::VehicleData data;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
- .WillOnce(ReturnRef(data));
+ EXPECT_CALL(mock_message_helper_, vehicle_data()).WillOnce(ReturnRef(data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
MockAppPtr mock_app(CreateMockApp());
@@ -115,7 +115,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -139,7 +139,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -161,7 +161,7 @@ TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -185,7 +185,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
am::ApplicationSet application_set_;
@@ -228,7 +228,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
.WillRepeatedly(Return(false));
@@ -243,12 +243,9 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
SmartObject message(smart_objects::SmartType_Map);
const hmi_apis::Common_Result::eType hmi_result =
hmi_apis::Common_Result::SUCCESS;
- const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
message[am::strings::params][am::hmi_response::code] = hmi_result;
message[am::strings::msg_params][kMsgParamKey] = true;
test_event.set_smart_object(message);
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
EXPECT_CALL(
app_mngr_,
@@ -272,14 +269,10 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
SmartObject message(smart_objects::SmartType_Map);
const hmi_apis::Common_Result::eType hmi_result =
hmi_apis::Common_Result::SUCCESS;
- const mobile_apis::Result::eType mob_result = mobile_apis::Result::SUCCESS;
message[am::strings::params][am::hmi_response::code] = hmi_result;
message[am::strings::msg_params][kMsgParamKey] = true;
test_event.set_smart_object(message);
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
index 50567a7c62..5615b0cabd 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -72,20 +72,13 @@ class UnSubscribeWayPointsRequestTest
public:
UnSubscribeWayPointsRequestTest()
: command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_))
- , mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
+ , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~UnSubscribeWayPointsRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MessageSharedPtr command_msg_;
::utils::SharedPtr<UnSubscribeWayPointsRequest> command_;
- am::MockMessageHelper& mock_message_helper_;
};
TEST_F(UnSubscribeWayPointsRequestTest,
@@ -107,9 +100,9 @@ TEST_F(UnSubscribeWayPointsRequestTest,
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
-
- EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId))
+ EXPECT_CALL(app_mngr_,
+ IsAppSubscribedForWayPoints(
+ ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
.WillOnce(Return(false));
EXPECT_CALL(
@@ -124,9 +117,9 @@ TEST_F(UnSubscribeWayPointsRequestTest, Run_AppSubscribedForWayPoints_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
-
- EXPECT_CALL(app_mngr_, IsAppSubscribedForWayPoints(kAppId))
+ EXPECT_CALL(app_mngr_,
+ IsAppSubscribedForWayPoints(
+ ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)))
.WillOnce(Return(true));
EXPECT_CALL(app_mngr_,
@@ -161,13 +154,9 @@ TEST_F(UnSubscribeWayPointsRequestTest,
Event event(hmi_apis::FunctionID::Navigation_UnsubscribeWayPoints);
event.set_smart_object(*event_msg);
- EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
-
- EXPECT_CALL(app_mngr_, UnsubscribeAppFromWayPoints(kAppId));
-
- EXPECT_CALL(mock_message_helper_,
- HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
- .WillOnce(Return(mobile_apis::Result::SUCCESS));
+ EXPECT_CALL(app_mngr_,
+ UnsubscribeAppFromWayPoints(
+ ::testing::Matcher<am::ApplicationSharedPtr>(mock_app)));
EXPECT_CALL(
app_mngr_,
diff --git a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
index cab67e641c..dacabba5fd 100644
--- a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
@@ -79,8 +79,7 @@ class UpdateTurnListRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
UpdateTurnListRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<UpdateTurnListRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
@@ -88,7 +87,6 @@ class UpdateTurnListRequestTest
kFunctionId;
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
::utils::SharedPtr<UpdateTurnListRequest> command_;
TypeIf<kMocksAreNice,
@@ -275,9 +273,6 @@ TEST_F(UpdateTurnListRequestTest, OnEvent_UnsupportedResource_SUCCESS) {
Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
@@ -297,9 +292,6 @@ TEST_F(UpdateTurnListRequestTest,
Event event(hmi_apis::FunctionID::Navigation_UpdateTurnList);
event.set_smart_object(*event_msg);
- EXPECT_CALL(mock_message_helper_, HMIToMobileResult(hmi_response_code))
- .WillOnce(Return(mobile_response_code));
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));