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_sub_menu_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc3
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc3
-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_way_points_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc5
-rw-r--r--src/components/application_manager/test/commands/mobile/set_display_layout_test.cc4
-rw-r--r--src/components/application_manager/test/commands/mobile/show_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc4
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc6
14 files changed, 47 insertions, 27 deletions
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 bef00384a7..9617f91016 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
@@ -106,7 +106,7 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
app_mngr_,
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
-
+ command->Init();
command->on_event(event);
EXPECT_EQ((*ui_command_result)[am::strings::msg_params][am::strings::success]
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 ed20ff94d6..f83a40843c 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
@@ -263,6 +263,9 @@ 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))
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 036b0cfeb3..a6d9d8f50a 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
@@ -211,6 +211,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
DeleteInteractionChoiceSetRequestPtr command =
CreateCommand<DeleteInteractionChoiceSetRequest>(message_);
+ command->Init();
command->Run();
}
@@ -247,6 +248,7 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
DeleteInteractionChoiceSetRequestPtr command =
CreateCommand<DeleteInteractionChoiceSetRequest>(message_);
+ command->Init();
command->Run();
}
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 8373601480..beff4c3584 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
@@ -58,6 +58,7 @@ using ::testing::InSequence;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
+using am::MockHmiInterfaces;
using am::MockMessageHelper;
using am::commands::DeleteSubMenuRequest;
@@ -142,6 +143,12 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
event.set_smart_object(*ev_msg);
+ MockHmiInterfaces hmi_interfaces;
+ ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces));
+ EXPECT_CALL(hmi_interfaces,
+ 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));
@@ -234,9 +241,11 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_UnknownEventId_UNSUCCESS) {
TEST_F(DeleteSubMenuRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
Event event(hmi_apis::FunctionID::UI_DeleteSubMenu);
(*message_)[am::strings::params][am::hmi_response::code] =
- am::mobile_api::Result::SUCCESS;
+ 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);
@@ -280,6 +289,7 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
DeleteSubMenuRequestPtr command =
CreateCommand<DeleteSubMenuRequest>(message_);
+ command->Init();
command->on_event(event);
}
@@ -308,8 +318,9 @@ 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));
+ 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);
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 afdf5af3d2..60697446f2 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
@@ -189,9 +189,6 @@ TEST_F(DiagnosticMessageRequestTest, OnEvent_SUCCESS) {
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
- MockAppPtr app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app));
-
command->on_event(event);
}
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 8d0363294d..dfa38a758b 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
@@ -61,12 +61,18 @@ using am::commands::MessageSharedPtr;
using am::commands::GetDTCsRequest;
using am::event_engine::Event;
using am::MockMessageHelper;
+using testing::Mock;
namespace mobile_result = mobile_apis::Result;
typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
class GetDTCsRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {
+ Mock::VerifyAndClearExpectations(message_helper_mock_);
+ }
+};
TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
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 e80f53a8e1..d886a2b1bd 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
@@ -57,6 +57,7 @@ using ::testing::Mock;
using ::testing::_;
using application_manager::commands::GetWayPointsRequest;
using application_manager::MockMessageHelper;
+using application_manager::MockHmiInterfaces;
typedef SharedPtr<GetWayPointsRequest> CommandPtr;
typedef mobile_apis::Result::eType MobileResult;
@@ -151,6 +152,7 @@ class GetWayPointsRequestOnEventTest
protected:
MockMessageHelper& message_helper_mock_;
MockAppPtr app_;
+ MockHmiInterfaces hmi_interfaces_;
};
TEST_F(GetWayPointsRequestTest,
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 0291de6258..e133ec9119 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
@@ -383,11 +383,6 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- MockAppPtr invalid_app;
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app_))
- .WillOnce(Return(invalid_app));
-
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
ResetGlobalPropertiesRequestPtr command =
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 ec069e4825..68aa76010f 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
@@ -253,7 +253,9 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
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/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc
index e0ba409957..86889ac5cd 100644
--- a/src/components/application_manager/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/test/commands/mobile/show_test.cc
@@ -752,12 +752,17 @@ TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
- mobile_apis::Result::SUCCESS;
+ hmi_apis::Common_Result::eType::SUCCESS;
(*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
- EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
+ 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), _));
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*msg);
@@ -776,6 +781,9 @@ 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/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
index 66cd740bbe..4546293172 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
@@ -83,6 +83,7 @@ TEST_F(SubscribeWayPointsRequestTest, Run_SUCCESS) {
EXPECT_CALL(*app, UpdateHash());
}
+ command->Init();
MessageSharedPtr mobile_result_msg(
CatchMobileCommandResult(CallRun(*command)));
@@ -120,6 +121,7 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
EXPECT_CALL(*app, UpdateHash());
}
+ command->Init();
command->on_event(event);
Mock::VerifyAndClearExpectations(mock_message_helper);
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc
index 4cbf98c5e1..46a1ce02eb 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_button_request_test.cc
@@ -145,7 +145,7 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
EXPECT_CALL(*mock_app, UpdateHash());
-
+ command->Init();
command->Run();
}
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 ecc2f8e8a5..9652364646 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
@@ -235,6 +235,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::IGNORED), _));
+ command->Init();
command->Run();
am::event_engine::Event test_event(
@@ -279,9 +280,6 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
HMIToMobileResult(hmi_result)).WillOnce(Return(mob_result));
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
-
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
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 6b363f6aca..cab67e641c 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
@@ -281,9 +281,6 @@ TEST_F(UpdateTurnListRequestTest, OnEvent_UnsupportedResource_SUCCESS) {
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
- MockAppPtr mock_app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app));
-
command_->on_event(event);
}
@@ -306,9 +303,6 @@ TEST_F(UpdateTurnListRequestTest,
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
- MockAppPtr mock_app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app));
-
command_->on_event(event);
}