summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2017-11-30 14:07:52 +0200
committerAndriy Byzhynar <AByzhynar@luxoft.com>2018-01-26 11:38:09 +0200
commitc57507a8a9e31cd2490e163f399374a1ebfeea04 (patch)
tree8b09ce2f454aa9438a5b3758b39b5a84747e0176
parente1d1a09b713f8bee727d259a91493d84b79b3922 (diff)
downloadsdl_core-feature/send_location.tar.gz
Fix missing/wrong result codes mappingfeature/send_location
There was some missings in result code convertion from HMI to Mobile. Also Fixed related unit test.
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc10
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc27
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc1
3 files changed, 24 insertions, 14 deletions
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 7e5ed1feaa..102817576a 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -526,7 +526,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
break;
}
case hmi_apis::Common_Result::DATA_NOT_AVAILABLE: {
- mobile_result = mobile_apis::Result::VEHICLE_DATA_NOT_AVAILABLE;
+ mobile_result = mobile_apis::Result::DATA_NOT_AVAILABLE;
break;
}
case hmi_apis::Common_Result::TIMED_OUT: {
@@ -589,6 +589,14 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
mobile_result = mobile_apis::Result::SAVED;
break;
}
+ case hmi_apis::Common_Result::TRUNCATED_DATA: {
+ mobile_result = mobile_apis::Result::TRUNCATED_DATA;
+ break;
+ }
+ case hmi_apis::Common_Result::READ_ONLY: {
+ mobile_result = mobile_apis::Result::READ_ONLY;
+ break;
+ }
default: {
LOG4CXX_ERROR(logger_, "Unknown HMI result code " << hmi_code);
break;
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index 5ebb030e84..5e7a780f3e 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -206,27 +206,30 @@ TEST_F(CommandRequestImplTest, GetMobileResultCode_SUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>();
+ const std::map<hmi_apis::Common_Result::eType, mobile_apis::Result::eType>
+ mapping_exceptions = {
+ {hmi_apis::Common_Result::NO_DEVICES_CONNECTED,
+ mobile_apis::Result::APPLICATION_NOT_REGISTERED},
+ {hmi_apis::Common_Result::NO_APPS_REGISTERED,
+ mobile_apis::Result::APPLICATION_NOT_REGISTERED},
+ {hmi_apis::Common_Result::DATA_NOT_AVAILABLE,
+ mobile_apis::Result::DATA_NOT_AVAILABLE},
+ {hmi_apis::Common_Result::SAVED, mobile_apis::Result::SAVED}};
+
// Run thru all possible accordance
// of HMI and Mobile result codes.
ResultU result_it;
for (result_it.hmi_ = hmi_apis::Common_Result::SUCCESS;
- result_it.value_ < hmi_apis::Common_Result::TRUNCATED_DATA;
+ result_it.value_ < hmi_apis::Common_Result::READ_ONLY;
++result_it.value_) {
- if (result_it.hmi_ != hmi_apis::Common_Result::NO_DEVICES_CONNECTED &&
- result_it.hmi_ != hmi_apis::Common_Result::NO_APPS_REGISTERED) {
+ if (mapping_exceptions.find(result_it.hmi_) == mapping_exceptions.end()) {
EXPECT_EQ(result_it.mobile_,
command->GetMobileResultCode(result_it.hmi_));
+ } else {
+ EXPECT_EQ(mapping_exceptions.at(result_it.hmi_),
+ command->GetMobileResultCode(result_it.hmi_));
}
}
- EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
- command->GetMobileResultCode(
- hmi_apis::Common_Result::NO_DEVICES_CONNECTED));
- EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED,
- command->GetMobileResultCode(
- hmi_apis::Common_Result::NO_APPS_REGISTERED));
- EXPECT_EQ(
- mobile_apis::Result::GENERIC_ERROR,
- command->GetMobileResultCode(hmi_apis::Common_Result::TRUNCATED_DATA));
}
TEST_F(CommandRequestImplTest, BasicMethodsOverloads_SUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
index c79b664c0c..678ce52edb 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -70,7 +70,6 @@ class OnHMIStatusNotificationTest
void SetSendNotificationExpectations(MessageSharedPtr& msg) {
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
.WillOnce(Return(false));
- EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(app_mngr_, SendMessageToMobile(_, _))