summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/test/commands/mobile/set_global_properties_test.cc')
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc120
1 files changed, 48 insertions, 72 deletions
diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
index 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);