summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/commands/mobile
diff options
context:
space:
mode:
authorAlexander Kutsan <akutsan@luxoft.com>2017-08-21 22:10:18 +0300
committerAlexander Kutsan <akutsan@luxoft.com>2017-08-21 22:10:18 +0300
commit44ac9792ac23d05475204e154ddce859d0ceb1d5 (patch)
tree80d875ac4244d0c1c644747e37bfb1d3fc7b21e0 /src/components/application_manager/test/commands/mobile
parent31d409f6389e6f18429d076e5b1353aabb22caf4 (diff)
parentf78d4122fc3de1070dc3fe4496488a13e29d9d8c (diff)
downloadsdl_core-44ac9792ac23d05475204e154ddce859d0ceb1d5.tar.gz
Merge remote-tracking branch 'origin/develop' into feature/sdl_remote_control_baseline
Diffstat (limited to 'src/components/application_manager/test/commands/mobile')
-rw-r--r--src/components/application_manager/test/commands/mobile/add_command_request_test.cc4
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc7
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/mobile/change_registration_test.cc52
-rw-r--r--src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc120
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_command_request_test.cc20
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_file_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc20
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc17
-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/dial_number_request_test.cc18
-rw-r--r--src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc59
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc62
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_interaction_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/read_did_request_test.cc3
-rw-r--r--src/components/application_manager/test/commands/mobile/register_app_interface_request_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc36
-rw-r--r--src/components/application_manager/test/commands/mobile/scrollable_message_test.cc11
-rw-r--r--src/components/application_manager/test/commands/mobile/send_location_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/mobile/set_app_icon_test.cc17
-rw-r--r--src/components/application_manager/test/commands/mobile/set_display_layout_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc120
-rw-r--r--src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc17
-rw-r--r--src/components/application_manager/test/commands/mobile/show_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/slider_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/speak_request_test.cc7
-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_button_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc6
34 files changed, 329 insertions, 392 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 567c3d32f9..dec0ffe7ad 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
@@ -62,7 +62,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::testing::_;
using ::utils::SharedPtr;
using ::testing::Return;
@@ -520,7 +519,6 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) {
EXPECT_CALL(mock_message_helper_,
HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, UpdateHash());
request_ptr->on_event(event);
}
@@ -541,7 +539,6 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
EXPECT_CALL(*mock_app_, commands_map())
.WillRepeatedly(
Return(DataAccessor<am::CommandsMap>(commands_map, lock_)));
- EXPECT_CALL(*mock_app_, UpdateHash());
EXPECT_CALL(
app_mngr_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand)))
@@ -668,7 +665,6 @@ TEST_F(AddCommandRequestTest,
event_ui.set_smart_object(*msg_);
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
event_vr.set_smart_object(*msg_);
- EXPECT_CALL(*mock_app_, UpdateHash());
request_ptr->on_event(event_ui);
request_ptr->on_event(event_vr);
}
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 95bcede5fa..bef00384a7 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,7 +54,6 @@ namespace am = ::application_manager;
using am::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockHmiInterfaces;
using am::MockMessageHelper;
using ::testing::_;
using ::testing::Mock;
@@ -98,12 +97,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
Event event(hmi_apis::FunctionID::UI_AddSubMenu);
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));
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 a835239a90..ee0662e5c6 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::MockHmiInterfaces;
using am::MockMessageHelper;
typedef SharedPtr<AlertManeuverRequest> CommandPtr;
@@ -93,10 +92,7 @@ class AlertManeuverRequestTest
EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
.WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
MessageSharedPtr response_to_mobile;
@@ -213,13 +209,10 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceFromFunction(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillRepeatedly(
Return(am::HmiInterfaces::InterfaceID::HMI_INTERFACE_TTS));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
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 b52c7911c1..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
@@ -56,7 +56,6 @@ using am::commands::AlertRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::utils::SharedPtr;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
@@ -125,15 +124,13 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
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_));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(
Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(
Return(am::HmiInterfaces::InterfaceState::STATE_NOT_AVAILABLE));
@@ -199,7 +196,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
};
TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) {
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 0c76a08fe9..2fd43a6353 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
@@ -65,7 +65,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::testing::_;
using ::testing::Mock;
using ::utils::SharedPtr;
@@ -118,28 +117,28 @@ class ChangeRegistrationRequestTest
.WillOnce(Return(supported_languages_.get()));
EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces_));
+ .WillRepeatedly(ReturnRef(mock_hmi_interfaces_));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
@@ -185,10 +184,7 @@ class ChangeRegistrationRequestTest
(*tts_response)[strings::params][hmi_response::code] = hmi_response;
(*tts_response)[strings::msg_params] = 0;
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(state));
am::event_engine::Event event_ui(
@@ -251,8 +247,6 @@ class ChangeRegistrationRequestTest
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_));
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(hmi_capabilities_));
}
@@ -288,7 +282,6 @@ class ChangeRegistrationRequestTest
MockHMICapabilities;
sync_primitives::Lock app_set_lock_;
MockHMICapabilities hmi_capabilities_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr supported_languages_;
@@ -322,25 +315,25 @@ TEST_F(ChangeRegistrationRequestTest,
ExpectationsHmiCapabilities(supported_languages);
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_RESPONSE));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
command->Run();
@@ -367,10 +360,7 @@ TEST_F(ChangeRegistrationRequestTest,
hmi_apis::FunctionID::TTS_ChangeRegistration);
event_tts.set_smart_object(*tts_response);
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
MessageSharedPtr response_to_mobile;
@@ -478,25 +468,25 @@ TEST_F(ChangeRegistrationRequestTest,
ExpectationsHmiCapabilities(supported_languages);
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::VR_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_ChangeRegistration))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
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 a0b0dc32ff..a627740588 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
@@ -64,7 +64,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::testing::_;
using ::testing::Mock;
using ::utils::SharedPtr;
@@ -116,7 +115,7 @@ class CreateInteractionChoiceSetRequestTest
: message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
, message_(CreateMessage())
, command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_))
- , app_(CreateMockApp()) {
+ , mock_app_(CreateMockApp()) {
Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
~CreateInteractionChoiceSetRequestTest() {
@@ -166,7 +165,7 @@ class CreateInteractionChoiceSetRequestTest
MockMessageHelper& message_helper_mock_;
MessageSharedPtr message_;
CreateInteractionChoiceSetRequestPtr command_;
- MockAppPtr app_;
+ MockAppPtr mock_app_;
sync_primitives::Lock lock_;
};
@@ -213,11 +212,10 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr =
CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr);
- MockAppPtr mock_app = CreateMockApp();
- ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
- ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
+
smart_objects::SmartObject* null_obj = NULL;
- ON_CALL(*mock_app, FindChoiceSet(_)).WillByDefault(Return(null_obj));
+ ON_CALL(*mock_app_, FindChoiceSet(_)).WillByDefault(Return(null_obj));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[strings::params][hmi_response::code] =
@@ -229,25 +227,21 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
event.set_smart_object(*msg);
smart_objects::SmartObject* ptr = NULL;
- ON_CALL(*mock_app, FindCommand(kCmdId)).WillByDefault(Return(ptr));
+ ON_CALL(*mock_app_, FindCommand(kCmdId)).WillByDefault(Return(ptr));
EXPECT_EQ(NULL, ptr);
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- ON_CALL(*mock_message_helper, HMIToMobileResult(_))
+ ON_CALL(message_helper_mock_, HMIToMobileResult(_))
.WillByDefault(Return(mobile_apis::Result::SUCCESS));
am::CommandsMap commands_map;
- ON_CALL(*mock_app, commands_map())
+ ON_CALL(*mock_app_, commands_map())
.WillByDefault(
Return(DataAccessor<am::CommandsMap>(commands_map, lock_)));
- MockHmiInterfaces hmi_interfaces;
- ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces));
- ON_CALL(hmi_interfaces, GetInterfaceFromFunction(_))
+
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(
Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication));
- ON_CALL(hmi_interfaces, GetInterfaceState(_))
- .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true));
req_vr->Run();
@@ -287,7 +281,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::choice_set][0]
[am::strings::secondary_image] = kSecondImage;
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -303,14 +297,14 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* invalid_choice_set_id =
&((*message_)[am::strings::msg_params]
[am::strings::interaction_choice_set_id]);
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(invalid_choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
command_->Run();
@@ -337,13 +331,13 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::choice_set][1]
[am::strings::vr_commands][0] = kVrCommands1;
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -372,9 +366,9 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
kChoiceSetId;
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillRepeatedly(Return(choice_set_id));
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
@@ -443,17 +437,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
Run_ValidAmountVrCommands_SUCCESS) {
FillMessageFieldsItem1(message_);
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.Times(AtLeast(2))
.WillOnce(Return(kConnectionKey))
@@ -482,16 +476,16 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::choice_set][1]
[am::strings::vr_commands][0] = kVrCommands2;
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
command_->Run();
}
@@ -528,17 +522,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
FillMessageFieldsItem1(message_);
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
@@ -561,17 +555,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem1(message_);
FillMessageFieldsItem2(message_);
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
@@ -595,17 +589,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
@@ -620,7 +614,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
TEST_F(CreateInteractionChoiceSetRequestTest,
OnTimeOut_InvalidErrorFromHMI_UNSUCCESS) {
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
@@ -642,17 +636,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
@@ -664,7 +658,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
event.set_smart_object(*message_);
command_->on_event(event);
- EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId));
+ EXPECT_CALL(*mock_app_, RemoveChoiceSet(kChoiceSetId));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
command_->onTimeOut();
@@ -682,17 +676,17 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
@@ -707,7 +701,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
MockAppPtr invalid_app;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(invalid_app));
- EXPECT_CALL(*app_, RemoveChoiceSet(_)).Times(0);
+ EXPECT_CALL(*mock_app_, RemoveChoiceSet(_)).Times(0);
command_->onTimeOut();
}
@@ -724,34 +718,38 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
-
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
- .WillOnce(Return(choice_set_id));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).WillOnce(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _));
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
+
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
+ .WillOnce(Return(choice_set_id));
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _));
+
command_->Run();
FillMessageFieldsItem2(message_);
+
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _)).Times(0);
EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
+
Event event(hmi_apis::FunctionID::VR_AddCommand);
event.set_smart_object(*message_);
- MockAppPtr invalid_app;
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(invalid_app));
command_->on_event(event);
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
- EXPECT_CALL(*app_, RemoveChoiceSet(_));
+ EXPECT_CALL(app_mngr_, TerminateRequest(_, _, _));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ EXPECT_CALL(*mock_app_, RemoveChoiceSet(_));
+
command_->onTimeOut();
}
@@ -791,18 +789,18 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app_));
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
smart_objects::SmartObject* choice_set_id = NULL;
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
+ EXPECT_CALL(*mock_app_, FindChoiceSet(kChoiceSetId))
.WillRepeatedly(Return(choice_set_id));
EXPECT_CALL(app_mngr_, GenerateGrammarID())
.WillRepeatedly(Return(kGrammarId));
- EXPECT_CALL(*app_, AddChoiceSet(kChoiceSetId, _)).Times(2);
+ EXPECT_CALL(*mock_app_, AddChoiceSet(kChoiceSetId, _)).Times(2);
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
command_->Run();
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 1e03dcaaf1..efa889a2c1 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
@@ -61,7 +61,6 @@ using am::commands::DeleteCommandRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr;
@@ -130,15 +129,12 @@ 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_);
}
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -158,12 +154,12 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_VR));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(*mock_app_, FindCommand(kCommandId))
@@ -189,8 +185,6 @@ TEST_F(DeleteCommandRequestTest,
EXPECT_CALL(*mock_app_, RemoveCommand(kCommandId));
- EXPECT_CALL(*mock_app_, UpdateHash());
-
MessageSharedPtr vr_command_result;
EXPECT_CALL(
app_mngr_,
@@ -218,12 +212,12 @@ TEST_F(DeleteCommandRequestTest,
(*test_msg)[am::strings::vr_commands] = 0;
(*test_msg)[am::strings::menu_params] = 0;
- ON_CALL(hmi_interfaces_, GetInterfaceFromFunction(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(*app, FindCommand(kCommandId)).WillByDefault(Return(test_msg.get()));
@@ -248,8 +242,6 @@ 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_file_test.cc b/src/components/application_manager/test/commands/mobile/delete_file_test.cc
index 6af9a62bf0..3692f7298e 100644
--- a/src/components/application_manager/test/commands/mobile/delete_file_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_file_test.cc
@@ -159,7 +159,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) {
kConnectionKey;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app_));
+ .WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, hmi_level())
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
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 64c2fae1d3..036b0cfeb3 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
@@ -191,8 +191,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
[am::strings::interaction_choice_set_id]);
smart_objects::SmartObject* invalid_choice_set_id = NULL;
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app_));
+
InSequence seq;
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -206,8 +208,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId));
EXPECT_CALL(*app_, UpdateHash());
- command_->Run();
- EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get()));
+ DeleteInteractionChoiceSetRequestPtr command =
+ CreateCommand<DeleteInteractionChoiceSetRequest>(message_);
+
+ command->Run();
}
TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
@@ -221,8 +225,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
smart_objects::SmartObject* choice_set_id =
&((*message_)[am::strings::msg_params]);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app_));
+
InSequence seq;
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app_));
EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
.WillOnce(Return(choice_set_id));
@@ -238,8 +244,10 @@ TEST_F(DeleteInteractionChoiceSetRequestTest, Run_SendVrDeleteCommand_SUCCESS) {
EXPECT_CALL(*app_, RemoveChoiceSet(kChoiceSetId));
EXPECT_CALL(*app_, UpdateHash());
- command_->Run();
- EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get()));
+ DeleteInteractionChoiceSetRequestPtr command =
+ CreateCommand<DeleteInteractionChoiceSetRequest>(message_);
+
+ command->Run();
}
TEST_F(DeleteInteractionChoiceSetResponseTest, Run_SuccessFalse_UNSUCCESS) {
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 24b7d0f356..82700cca5c 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
@@ -272,8 +272,9 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_));
+
InSequence seq;
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
EXPECT_CALL(*app_, commands_map()).WillOnce(Return(accessor_));
EXPECT_CALL(*app_, app_id()).WillOnce(Return(kConnectionKey));
EXPECT_CALL(*app_, get_grammar_id()).WillOnce(Return(kGrammarId));
@@ -284,8 +285,11 @@ TEST_F(DeleteSubMenuRequestTest, OnEvent_DeleteSubmenu_SUCCESS) {
EXPECT_CALL(*app_, RemoveSubMenu(_));
EXPECT_CALL(*app_, UpdateHash());
- command_->on_event(event);
- EXPECT_TRUE(Mock::VerifyAndClearExpectations(app_.get()));
+
+ DeleteSubMenuRequestPtr command =
+ CreateCommand<DeleteSubMenuRequest>(message_);
+
+ command->on_event(event);
}
TEST_F(DeleteSubMenuResponseTest, Run_SUCCESS) {
@@ -317,7 +321,7 @@ TEST_F(DeleteSubMenuRequestTest,
HMIToMobileResult(hmi_apis::Common_Result::SUCCESS))
.WillByDefault(Return(am::mobile_api::Result::SUCCESS));
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ 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_));
EXPECT_CALL(*app_, RemoveCommand(_)).Times(0);
@@ -340,7 +344,10 @@ TEST_F(DeleteSubMenuRequestTest,
commands_map_.insert(
std::make_pair(0, &((*message_)[am::strings::msg_params])));
- EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
+ 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_));
EXPECT_CALL(*app_, RemoveCommand(_)).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 60697446f2..afdf5af3d2 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,6 +189,9 @@ 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/dial_number_request_test.cc b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc
index 2f7415c98e..33c84d305a 100644
--- a/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/dial_number_request_test.cc
@@ -156,15 +156,6 @@ TEST_F(DialNumberRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
}
TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) {
- MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
- (*command_msg)[am::strings::params][am::strings::connection_key] =
- kConnectionKey;
-
- DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
-
- MockAppPtr app(CreateMockApp());
- EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(app));
-
MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
(*event_msg)[am::strings::params][am::hmi_response::code] =
mobile_apis::Result::SUCCESS;
@@ -173,10 +164,19 @@ TEST_F(DialNumberRequestTest, OnEvent_SUCCESS) {
Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
event.set_smart_object(*event_msg);
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillRepeatedly(Return(app));
+
EXPECT_CALL(
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+ MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*command_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ DialNumberRequestPtr command(CreateCommand<DialNumberRequest>(command_msg));
command->on_event(event);
}
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 ceb5e3b916..b8c0ed23f3 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
@@ -59,7 +59,6 @@ using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
using am::commands::EndAudioPassThruRequest;
using am::event_engine::Event;
-using am::MockHmiInterfaces;
using am::MockMessageHelper;
typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
@@ -90,12 +89,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
Event event(hmi_apis::FunctionID::UI_EndAudioPassThru);
event.set_smart_object(*event_msg);
- MockHmiInterfaces hmi_interfaces;
- ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces));
- ON_CALL(hmi_interfaces,
- GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
- .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
-
EXPECT_CALL(mock_message_helper_,
HMIToMobileResult(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE))
.WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
@@ -108,6 +101,9 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
ManageMobileCommand(_, am::commands::Command::CommandOrigin::ORIGIN_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+
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/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
index 31d406d959..8d0363294d 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
@@ -112,8 +112,6 @@ TEST_F(GetDTCsRequestTest, OnEvent_UnknownEvent_UNSUCCESS) {
}
TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
- GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
-
MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
(*event_msg)[am::strings::msg_params] = 0;
(*event_msg)[am::strings::params][am::hmi_response::code] =
@@ -130,6 +128,10 @@ TEST_F(GetDTCsRequestTest, OnEvent_SUCCESS) {
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS), _));
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+
+ GetDTCsRequestPtr command(CreateCommand<GetDTCsRequest>());
command->on_event(event);
}
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 320117d34d..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
@@ -76,6 +76,7 @@ class GetWayPointsRequestTest
: message_helper_mock_(*am::MockMessageHelper::message_helper_mock()) {
Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
+
~GetWayPointsRequestTest() {
Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
@@ -90,6 +91,9 @@ class GetWayPointsRequestTest
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_;
@@ -126,8 +130,13 @@ class GetWayPointsRequestOnEventTest
}
event.set_smart_object(*event_msg);
- ON_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillByDefault(Return(ResultCode));
+
+ EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
+ .WillOnce(Return(ResultCode));
+
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+
MessageSharedPtr result_msg(
CatchMobileCommandResult(CallOnEvent(*command, event)));
EXPECT_EQ(
@@ -196,7 +205,7 @@ TEST_F(GetWayPointsRequestTest, Run_ApplicationRegistered_Success) {
}
TEST_F(GetWayPointsRequestTest,
- OnEvent_NavigationGetWayPointsEvent_SendResponce) {
+ OnEvent_NavigationGetWayPointsEvent_SendResponse) {
am::event_engine::Event event(hmi_apis::FunctionID::Navigation_GetWayPoints);
(*message_)[am::strings::params][am::hmi_response::code] =
@@ -249,42 +258,46 @@ TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_SUCCESS_Case3) {
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case1) {
- EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
- .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
CheckOnEventResponse(" ", GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case2) {
- EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
- .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
CheckOnEventResponse("test\t", GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case3) {
- EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
- .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
CheckOnEventResponse("test\n", GENERIC_ERROR, false);
}
TEST_F(GetWayPointsRequestOnEventTest, OnEvent_Expect_GENERIC_ERROR_Case4) {
- EXPECT_CALL(app_mngr_, hmi_interfaces()).WillOnce(ReturnRef(hmi_interfaces_));
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_Navigation))
- .WillOnce(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(message_helper_mock_, HMIToMobileResult(_))
- .WillOnce(Return(mobile_apis::Result::GENERIC_ERROR));
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+
CheckOnEventResponse("test\t\n", GENERIC_ERROR, false);
}
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 9126e43050..e2adc38f50 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
@@ -55,7 +55,6 @@ using am::commands::PerformAudioPassThruRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Mock;
@@ -131,8 +130,6 @@ class PerformAudioPassThruRequestTest
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_));
command_sptr_ =
CreateCommand<am::commands::PerformAudioPassThruRequest>(message_);
@@ -156,7 +153,6 @@ class PerformAudioPassThruRequestTest
}
sync_primitives::Lock lock_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
@@ -217,10 +213,10 @@ TEST_F(PerformAudioPassThruRequestTest,
am::event_engine::Event event(hmi_apis::FunctionID::UI_PerformAudioPassThru);
event.set_smart_object(*msg);
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -312,10 +308,10 @@ TEST_F(PerformAudioPassThruRequestTest,
// Send speak request sending
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
@@ -324,10 +320,10 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
@@ -359,10 +355,10 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_StopSpeaking))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _)).Times(0);
@@ -395,10 +391,10 @@ TEST_F(PerformAudioPassThruRequestTest,
InSequence dummy;
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
@@ -407,10 +403,10 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
@@ -463,10 +459,10 @@ TEST_F(PerformAudioPassThruRequestTest,
InSequence dummy;
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
@@ -475,10 +471,10 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
@@ -506,10 +502,10 @@ TEST_F(
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Perform audio path thru request sending
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
@@ -518,10 +514,10 @@ TEST_F(
// Perform audio path thru request sending
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_OnRecordStart))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// Start recording notification sending
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
@@ -583,7 +579,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
@@ -609,7 +605,7 @@ TEST_F(PerformAudioPassThruRequestTest,
hmi_apis::Common_Result::SUCCESS;
event_perform.set_smart_object(*message_);
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
// First call on_event for setting result_tts_speak_ to UNSUPPORTED_RESOURCE
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
@@ -619,7 +615,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// Second call for test correct behavior of UI_PerformAudioPassThru event
EXPECT_CALL(app_mngr_, EndAudioPassThrough()).WillOnce(Return(false));
EXPECT_CALL(app_mngr_, StopAudioPassThru(_)).Times(0);
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
CallOnEvent caller_perform(*command_sptr_, event_perform);
@@ -648,7 +644,7 @@ TEST_F(PerformAudioPassThruRequestTest,
StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _));
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ 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));
@@ -673,7 +669,7 @@ TEST_F(PerformAudioPassThruRequestTest,
app_mngr_,
StartAudioPassThruThread(kConnectionKey, kCorrelationId, _, _, _, _));
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
CallOnEvent caller(*command_sptr_, event);
caller();
@@ -732,10 +728,10 @@ TEST_F(PerformAudioPassThruRequestTest,
MessageSharedPtr perform_result_msg;
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_Speak))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&speak_reqeust_result_msg), Return(true)));
@@ -744,10 +740,10 @@ TEST_F(PerformAudioPassThruRequestTest,
ON_CALL(app_mngr_, GetNextHMICorrelationID())
.WillByDefault(Return(kCorrelationId));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_PerformAudioPassThru))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_, GetInterfaceState(_))
+ ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(DoAll(SaveArg<0>(&perform_result_msg), Return(true)));
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 22ce735c61..84a0e0b354 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
@@ -62,7 +62,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::testing::_;
using ::testing::Mock;
using ::utils::SharedPtr;
@@ -91,8 +90,6 @@ class PerformInteractionRequestTest
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 {
@@ -111,7 +108,6 @@ class PerformInteractionRequestTest
}
sync_primitives::Lock lock_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -174,10 +170,6 @@ TEST_F(PerformInteractionRequestTest,
MockAppPtr mock_app;
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app));
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
-
MessageSharedPtr response_msg_vr =
CreateMessage(smart_objects::SmartType_Map);
(*response_msg_vr)[strings::params][hmi_response::code] =
@@ -197,10 +189,10 @@ TEST_F(PerformInteractionRequestTest,
am::event_engine::Event event_ui(hmi_apis::FunctionID::UI_PerformInteraction);
event_ui.set_smart_object(*response_msg_ui);
- EXPECT_CALL(hmi_interfaces,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- EXPECT_CALL(hmi_interfaces,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -228,10 +220,10 @@ TEST_F(PerformInteractionRequestTest,
utils::SharedPtr<PerformInteractionRequest> command =
CreateCommand<PerformInteractionRequest>(msg_from_mobile);
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_VR))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
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 334f559ae6..7e46f6942f 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
@@ -98,6 +98,9 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+
command->on_event(event);
testing::Mock::VerifyAndClearExpectations(&mock_message_helper);
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 96b3cb067b..844f87d57e 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
@@ -151,8 +151,6 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed));
ON_CALL(app_mngr_, GetDeviceTransportType(_))
.WillByDefault(Return(hmi_apis::Common_TransportType::WIFI));
- ON_CALL(app_mngr_, hmi_interfaces())
- .WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
ON_CALL(
@@ -191,15 +189,11 @@ class RegisterAppInterfaceRequestTest
typedef IsNiceMock<application_manager_test::MockHMICapabilities,
kMocksAreNice>::Result MockHMICapabilities;
- typedef IsNiceMock<am::MockHmiInterfaces, kMocksAreNice>::Result
- MockHmiInterfaces;
-
MockPolicyHandlerInterface mock_policy_handler_;
MockResumeCtrl mock_resume_crt_;
MockConnectionHandler mock_connection_handler_;
MockSessionObserver mock_session_observer_;
MockHMICapabilities mock_hmi_capabilities_;
- MockHmiInterfaces mock_hmi_interfaces_;
};
TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
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 fdfb862449..0291de6258 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
@@ -280,7 +280,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, reset_vr_help_title());
EXPECT_CALL(*mock_app_, reset_vr_help());
-
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help =
@@ -293,13 +292,10 @@ TEST_F(ResetGlobalPropertiesRequestTest,
event.set_smart_object(*msg_);
- ON_CALL(*mock_message_helper_, HMIToMobileResult(result_code))
- .WillByDefault(Return(am::mobile_api::Result::SUCCESS));
EXPECT_CALL(app_mngr_,
ManageMobileCommand(
MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS),
am::commands::Command::ORIGIN_SDL));
- EXPECT_CALL(*mock_app_, UpdateHash());
command_->on_event(event);
}
@@ -346,7 +342,6 @@ TEST_F(ResetGlobalPropertiesRequestTest,
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::WARNINGS),
am::commands::Command::ORIGIN_SDL));
- EXPECT_CALL(*mock_app_, UpdateHash());
command_->on_event(event);
}
@@ -370,8 +365,7 @@ TEST_F(ResetGlobalPropertiesResponseTest, Run_Sendmsg_SUCCESS) {
command->Run();
}
-TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
- Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
+TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
(*msg_)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::eType::SUCCESS;
@@ -389,24 +383,28 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_UNSUCCESS) {
EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
- command_->Run();
-
- event.set_smart_object(*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),
- am::commands::Command::ORIGIN_SDL));
-
MockAppPtr invalid_app;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_))
.WillOnce(Return(invalid_app));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
- command_->on_event(event);
+ ResetGlobalPropertiesRequestPtr command =
+ 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),
+ am::commands::Command::ORIGIN_SDL));
+
+ Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
+ event.set_smart_object(*msg_);
+ command->on_event(event);
}
} // namespace reset_global_properties
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 aba549eb34..d9fac769e5 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
@@ -61,7 +61,6 @@ using am::commands::ScrollableMessageRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Eq;
@@ -146,11 +145,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.WillByDefault(Return(mock_app));
ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey));
- 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));
MockHMICapabilities hmi_capabilities;
ON_CALL(app_mngr_, hmi_capabilities())
@@ -298,11 +292,6 @@ TEST_F(ScrollableMessageRequestTest,
EXPECT_CALL(mock_message_helper_, HMIToMobileResult(_))
.WillOnce(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
- MockHmiInterfaces hmi_interfaces;
- ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
- .WillOnce(Return(am::HmiInterfaces::STATE_AVAILABLE));
-
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 df412695fd..03cc715188 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
@@ -351,11 +351,19 @@ TEST_F(SendLocationRequestTest, Run_HMIUINotCoop_Cancelled) {
TEST_F(SendLocationRequestTest, OnEvent_Success) {
mobile_apis::Result::eType response_code = mobile_apis::Result::SUCCESS;
(*message_)[strings::params][hmi_response::code] = response_code;
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
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));
+
command_->on_event(event);
}
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 b51b7c83ea..60b01f2cfa 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
@@ -55,7 +55,6 @@ using am::commands::SetAppIconRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Mock;
@@ -73,6 +72,15 @@ class SetAppIconRequestTest
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() {
@@ -118,12 +126,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
ON_CALL(*mock_app, set_app_icon_path(_)).WillByDefault(Return(true));
ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(file_path));
- 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));
-
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
@@ -158,7 +160,6 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace set_app_icon_request
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 c454e6516d..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
@@ -57,7 +57,6 @@ using am::commands::SetDisplayLayoutRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Mock;
@@ -89,8 +88,6 @@ class SetDisplayLayoutRequestTest
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_));
}
~SetDisplayLayoutRequestTest() {
@@ -133,7 +130,6 @@ class SetDisplayLayoutRequestTest
}
sync_primitives::Lock lock_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -164,7 +160,7 @@ TEST_F(SetDisplayLayoutRequestTest,
Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
event.set_smart_object(*msg);
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -186,6 +182,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_InvalidApp_UNSUCCESS) {
MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+
MockAppPtr invalid_mock_app;
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(invalid_mock_app));
@@ -209,8 +206,6 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationKey));
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillOnce(ReturnRef(mock_hmi_interfaces_));
EXPECT_CALL(
mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetDisplayLayout))
@@ -236,14 +231,13 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
}
TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
- CommandPtr command(CreateCommand<SetDisplayLayoutRequest>());
-
am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::msg_params][am::hmi_response::display_capabilities] = 0;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
event.set_smart_object(*msg);
MockHMICapabilities hmi_capabilities;
@@ -251,6 +245,9 @@ 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));
@@ -264,6 +261,7 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS),
am::commands::Command::CommandOrigin::ORIGIN_SDL));
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
command->on_event(event);
}
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 0908b54ba7..7143bdf71a 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
@@ -55,7 +55,6 @@ using am::commands::SetGlobalPropertiesRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using am::CommandsMap;
using utils::custom_string::CustomString;
using ::utils::SharedPtr;
@@ -119,8 +118,6 @@ 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,
@@ -155,8 +152,6 @@ 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,8 +211,9 @@ class SetGlobalPropertiesRequestTest
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_));
+ ON_CALL(mock_hmi_interfaces_,
+ GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
+ .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
void TearDown() OVERRIDE {
@@ -237,22 +233,21 @@ class SetGlobalPropertiesRequestTest
void ExpectationsHmiInterface_Run() {
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
}
sync_primitives::Lock lock_;
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -297,8 +292,6 @@ TEST_F(SetGlobalPropertiesRequestTest,
ON_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillByDefault(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(*mock_app_, UpdateHash());
-
(*msg_vr)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
Event event_vr(hmi_apis::FunctionID::TTS_SetGlobalProperties);
@@ -330,9 +323,6 @@ 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))
@@ -345,6 +335,8 @@ TEST_F(SetGlobalPropertiesRequestTest,
MessageSharedPtr response = CreateMessage(smart_objects::SmartType_Map);
(*response)[am::strings::params][am::hmi_response::code] =
hmi_apis::Common_Result::SUCCESS;
+ (*response)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
(*response)[am::strings::msg_params][am::strings::info] = "qwe";
am::event_engine::Event event_tts(
@@ -356,16 +348,10 @@ TEST_F(SetGlobalPropertiesRequestTest,
utils::SharedPtr<SetGlobalPropertiesRequest> command =
CreateCommand<SetGlobalPropertiesRequest>(response);
- MockAppPtr mock_app(CreateMockApp());
- ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
-
ON_CALL(mock_message_helper_, HMIToMobileResult(_))
.WillByDefault(Return(mobile_apis::Result::UNSUPPORTED_RESOURCE));
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillRepeatedly(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
MessageSharedPtr response_to_mobile;
@@ -393,11 +379,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRNoMenuAndKeyboard_SUCCESS) {
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -434,11 +420,11 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -595,10 +581,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -667,10 +653,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) {
EXPECT_CALL(*mock_app_, app_id());
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -712,10 +698,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) {
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -757,10 +743,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) {
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
@@ -791,10 +777,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
@@ -822,10 +808,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) {
EXPECT_CALL(*mock_app_, timeout_prompt()).Times(0);
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
@@ -852,10 +838,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) {
EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(&timeout_prompt));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillOnce(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
@@ -1060,16 +1046,16 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) {
hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
- SharedPtr<SetGlobalPropertiesRequest> command(
- CreateCommand<SetGlobalPropertiesRequest>(msg));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
+ SharedPtr<SetGlobalPropertiesRequest> command(
+ CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventUISetupHelper(msg, command);
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
@@ -1077,11 +1063,8 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) {
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_app_, UpdateHash());
- EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
EXPECT_CALL(app_mngr_,
@@ -1100,23 +1083,20 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) {
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.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_));
- EXPECT_CALL(*mock_app_, UpdateHash());
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
event.set_smart_object(*msg);
- EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_))
+ 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));
@@ -1133,23 +1113,25 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) {
hmi_apis::Common_Result::WARNINGS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetGlobalProperties))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventUISetupHelper(msg, command);
- EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_))
+ 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))
- .WillOnce(Return(MockAppPtr()));
+ .WillRepeatedly(Return(MockAppPtr()));
+
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
Event event(hmi_apis::FunctionID::UI_SetGlobalProperties);
@@ -1181,17 +1163,17 @@ TEST_F(SetGlobalPropertiesRequestTest,
hmi_apis::Common_Result::SUCCESS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
OnEventTTSSetupHelper(msg, command);
- EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
EXPECT_CALL(app_mngr_,
@@ -1200,9 +1182,6 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, HMIToMobileResult(response_code))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, UpdateHash());
Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*msg);
@@ -1217,10 +1196,10 @@ TEST_F(SetGlobalPropertiesRequestTest,
hmi_apis::Common_Result::WARNINGS;
(*msg)[am::strings::params][am::hmi_response::code] = response_code;
ON_CALL(
- hmi_interfaces_,
+ mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::TTS_SetGlobalProperties))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_TTS));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
SharedPtr<SetGlobalPropertiesRequest> command(
@@ -1228,7 +1207,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
OnEventTTSSetupHelper(msg, command);
- EXPECT_CALL(hmi_interfaces_, GetInterfaceState(_))
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
EXPECT_CALL(app_mngr_,
@@ -1237,9 +1216,6 @@ TEST_F(SetGlobalPropertiesRequestTest,
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_app_, UpdateHash());
Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties);
event.set_smart_object(*msg);
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 da6f29cf5e..3056d0e9fc 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
@@ -53,7 +53,6 @@ namespace am = ::application_manager;
using am::commands::SetMediaClockRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockHmiInterfaces;
using am::MockMessageHelper;
using ::testing::_;
using ::testing::Mock;
@@ -84,8 +83,6 @@ class SetMediaClockRequestTest
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 {
@@ -117,7 +114,6 @@ class SetMediaClockRequestTest
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
}
- NiceMock<MockHmiInterfaces> hmi_interfaces_;
MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
@@ -140,7 +136,7 @@ TEST_F(SetMediaClockRequestTest,
Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*ev_msg);
- EXPECT_CALL(hmi_interfaces_,
+ EXPECT_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_NOT_RESPONSE));
@@ -183,10 +179,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppID));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetMediaClockTimer))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true));
@@ -218,10 +214,10 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) {
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppID));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceFromFunction(hmi_apis::FunctionID::UI_SetMediaClockTimer))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_UI));
- ON_CALL(hmi_interfaces_,
+ ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).WillOnce(Return(true));
@@ -340,6 +336,9 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) {
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
+ MockAppPtr app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
+
Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer);
event.set_smart_object(*msg);
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 49c23c4b64..86889ac5cd 100644
--- a/src/components/application_manager/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/test/commands/mobile/show_test.cc
@@ -56,7 +56,6 @@ using am::commands::ShowRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using test::components::policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
@@ -177,13 +176,6 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app));
ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey));
- MockHmiInterfaces hmi_interfaces;
- ON_CALL(app_mngr_, hmi_interfaces()).WillByDefault(ReturnRef(hmi_interfaces));
- ON_CALL(hmi_interfaces, GetInterfaceFromFunction(_))
- .WillByDefault(
- Return(am::HmiInterfaces::HMI_INTERFACE_BasicCommunication));
- ON_CALL(hmi_interfaces, GetInterfaceState(_))
- .WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::hmi_response::code] =
@@ -775,6 +767,8 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*msg);
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
+
command->on_event(event);
}
@@ -795,6 +789,8 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) {
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*msg);
+ EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
+
command->on_event(event);
}
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 7f260f7ddb..20262ed35a 100644
--- a/src/components/application_manager/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/test/commands/mobile/slider_test.cc
@@ -56,7 +56,6 @@ using am::commands::SliderRequest;
using am::commands::CommandImpl;
using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
@@ -159,11 +158,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.WillByDefault(Return(mock_app));
ON_CALL(*mock_app, app_id()).WillByDefault(Return(kConnectionKey));
- 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));
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::hmi_response::code] =
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 58eec42902..f8a7d22b40 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
@@ -67,7 +67,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
-using am::MockHmiInterfaces;
using ::testing::_;
using ::utils::SharedPtr;
using ::testing::Return;
@@ -113,10 +112,8 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
MessageSharedPtr response_to_mobile;
- MockHmiInterfaces hmi_interfaces;
- EXPECT_CALL(app_mngr_, hmi_interfaces())
- .WillOnce(ReturnRef(hmi_interfaces));
- EXPECT_CALL(hmi_interfaces, GetInterfaceState(_)).WillOnce(Return(state));
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(state));
MockMessageHelper* mock_message_helper =
MockMessageHelper::message_helper_mock();
EXPECT_CALL(*mock_message_helper, HMIToMobileResult(_))
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 7cc5e59470..ae4e46d40b 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
@@ -84,7 +84,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ .WillRepeatedly(Return(mock_app));
const mobile_apis::AppInterfaceUnregisteredReason::eType kUnregisterReason =
mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM;
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 2c47e58054..4cbf98c5e1 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
@@ -132,7 +132,7 @@ TEST_F(UnsubscribeButtonRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ .WillRepeatedly(Return(mock_app));
EXPECT_CALL(*mock_app, UnsubscribeFromButton(kButtonId))
.WillOnce(Return(true));
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 eae368347e..ecc2f8e8a5 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
@@ -181,22 +181,26 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
(*command_msg)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
(*command_msg)[am::strings::msg_params][kMsgParamKey] = true;
+
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
+
EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
- CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
am::ApplicationSet application_set_;
MockAppPtr mock_app(CreateMockApp());
application_set_.insert(mock_app);
DataAccessor<am::ApplicationSet> accessor(application_set_, app_set_lock_);
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ .WillRepeatedly(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, applications()).WillRepeatedly(Return(accessor));
EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
.WillRepeatedly(Return(true));
+
EXPECT_CALL(*mock_app, UnsubscribeFromIVI(kVehicleType))
.WillRepeatedly(Return(true));
@@ -204,6 +208,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
+ CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
command->Run();
}
@@ -281,8 +286,6 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataUnsubscribed_SUCCESS) {
app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_result::SUCCESS), _));
- EXPECT_CALL(*mock_app, UpdateHash());
-
command->on_event(test_event);
}
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 738cf35553..50567a7c62 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
@@ -152,7 +152,7 @@ TEST_F(UnSubscribeWayPointsRequestTest,
OnEvent_ReceivedNavigationUnSubscribeWayPointsEvent_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(mock_app));
+ .WillRepeatedly(Return(mock_app));
MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map));
(*event_msg)[am::strings::msg_params] = 0;
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..6b363f6aca 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,6 +281,9 @@ 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);
}
@@ -303,6 +306,9 @@ 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);
}