summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKalinich-Luxoft <AKalinich@luxoft.com>2018-07-26 19:57:23 +0300
committerAKalinich-Luxoft <AKalinich@luxoft.com>2018-07-30 10:34:26 +0300
commit5f0bb3cd3d606adf9659e38e3348c8ed8afd3735 (patch)
tree93d5d4928752467c1595ae1d584810bfcb319f4a
parentac1216b8b697b287217175b76da6ad6b0f5649ba (diff)
downloadsdl_core-5f0bb3cd3d606adf9659e38e3348c8ed8afd3735.tar.gz
Answer Livio comments
Fixed affected unit tests Reverted changes related to namespace naming
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc17
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc59
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc2
6 files changed, 47 insertions, 42 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index 0612daa3e3..9b7653ac52 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -42,12 +42,13 @@
#include "utils/gen_hash.h"
#include "utils/helpers.h"
-#define INVALID_IMG_WARNING_INFO "Requested image(s) not found."
-namespace sdl_rpc_plugin {
-using namespace application_manager;
+const char* kInvalidImageWarningInfo = "Requested image(s) not found.";
+namespace sdl_rpc_plugin {
namespace commands {
+using namespace application_manager;
+
CreateInteractionChoiceSetRequest::CreateInteractionChoiceSetRequest(
const application_manager::commands::MessageSharedPtr& message,
ApplicationManager& application_manager,
@@ -106,10 +107,10 @@ void CreateInteractionChoiceSetRequest::Run() {
LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, Result::INVALID_DATA);
return;
- } else if (verification_result_image == Result::WARNINGS ||
- verification_result_secondary_image == Result::WARNINGS) {
- should_send_warnings = true;
- break;
+ } else if (verification_result_image == Result::WARNINGS ||
+ verification_result_secondary_image == Result::WARNINGS) {
+ should_send_warnings = true;
+ break;
}
}
@@ -442,7 +443,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
LOG4CXX_AUTO_TRACE(logger_);
if (!error_from_hmi_ && should_send_warnings) {
- SendResponse(true, mobile_apis::Result::WARNINGS,INVALID_IMG_WARNING_INFO);
+ SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo);
} else if (!error_from_hmi_) {
SendResponse(true, mobile_apis::Result::SUCCESS);
} else {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index fedb4966f5..dfcceea889 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -31,6 +31,7 @@
*/
#include <stdint.h>
+#include <memory>
#include <string>
#include <set>
@@ -64,7 +65,6 @@ using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using ::testing::_;
-
using ::testing::Return;
using ::testing::InSequence;
using sdl_rpc_plugin::commands::AddCommandRequest;
@@ -278,7 +278,7 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_WARNINGS) {
mock_rpc_service_,
ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand)))
.WillOnce(Return(true));
- utils::SharedPtr<AddCommandRequest> request_ptr =
+ std::shared_ptr<AddCommandRequest> request_ptr =
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
index e4144c0911..4f44293fc9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc
@@ -335,7 +335,7 @@ TEST_F(SendLocationRequestTest, Run_LocationImageInvalid_Cancelled) {
(*message_)[strings::msg_params][strings::location_image] =
SmartObject(smart_objects::SmartType_Map);
(*message_)[strings::msg_params][strings::location_image][strings::value] =
- " 1";
+ "1";
EXPECT_CALL(
mock_message_helper_,
VerifyImage(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
index 6f1ccb9cc3..03aa5d85a1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc
@@ -31,6 +31,7 @@
*/
#include <stdint.h>
+#include <memory>
#include <string>
#include <set>
@@ -520,6 +521,10 @@ TEST_F(SetGlobalPropertiesRequestTest,
EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
EXPECT_CALL(
mock_hmi_interfaces_,
@@ -530,7 +535,7 @@ TEST_F(SetGlobalPropertiesRequestTest,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -564,6 +569,10 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_VR_WARNINGS) {
EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
EXPECT_CALL(
mock_hmi_interfaces_,
@@ -574,7 +583,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_VR_WARNINGS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -593,9 +602,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenMenuIcon_Canceled) {
EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
.WillOnce((Return(mobile_apis::Result::ABORTED)));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0);
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0);
EmptyExpectationsSetupHelper();
-
std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
@@ -610,14 +617,27 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenVRHelp_Canceled) {
(*msg)[am::strings::msg_params][am::hmi_request::menu_icon] = menu_icon;
SmartObject vr_help_array(smart_objects::SmartType_Array);
VRArraySetupHelper(msg, vr_help_title, vr_help_array);
+ SmartObject menu_title("Menu_Title");
+ (*msg)[am::strings::msg_params][am::hmi_request::menu_title] = menu_title;
EXPECT_CALL(mock_message_helper_, VerifyImage(menu_icon, _, _))
.WillOnce((Return(mobile_apis::Result::SUCCESS)));
EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(vr_help_array, _, _))
.WillOnce((Return(mobile_apis::Result::ABORTED)));
- EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0);
EmptyExpectationsSetupHelper();
+ EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(&vr_help_title));
+ EXPECT_CALL(*mock_app_, vr_help()).WillOnce(Return(&vr_help_array));
+ EXPECT_CALL(*mock_app_, set_vr_help_title(vr_help_title));
+ EXPECT_CALL(*mock_app_, set_vr_help(vr_help_array));
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
+ EXPECT_CALL(*mock_app_, set_menu_icon(menu_icon));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillOnce(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_,
+ OnSetGlobalPropertiesReceived(_, false));
+
std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
@@ -732,7 +752,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -749,16 +769,9 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRCouldNotGenerate_INVALID_DATA) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject* vr_help_title = NULL;
- CommandsMap commands_map;
- SmartObject empty_msg(smart_objects::SmartType_Map);
- commands_map.insert(std::pair<uint32_t, SmartObject*>(1u, &empty_msg));
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
- EXPECT_CALL(*mock_app_, vr_help_title()).WillOnce(Return(vr_help_title));
- EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
+ EXPECT_CALL(*mock_app_, set_menu_title(menu_title));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -815,7 +828,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) {
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
@@ -830,23 +843,13 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey));
- SmartObject vr_help_title(smart_objects::SmartType_Null);
- EXPECT_CALL(*mock_app_, vr_help_title())
- .Times(2)
- .WillRepeatedly(Return(&vr_help_title));
-
- CommandsMap commands_map;
- DataAccessor<CommandsMap> accessor(commands_map, lock_ptr_);
- EXPECT_CALL(*mock_app_, commands_map()).WillOnce(Return(accessor));
+
SmartObject vr_help_array(smart_objects::SmartType_Array);
vr_help_array[0] = SmartObject(smart_objects::SmartType_Map);
vr_help_array[0][am::strings::text] = kText;
vr_help_array[0][am::strings::position] = kPosition;
SmartObject vr_synonyms(smart_objects::SmartType_Array);
vr_synonyms[0] = vr_help_array;
- const CustomString name("name");
- EXPECT_CALL(*mock_app_, name()).WillOnce(ReturnRef(name));
- EXPECT_CALL(*mock_app_, set_vr_help_title(SmartObject(name)));
EXPECT_CALL(*mock_app_, set_menu_title(_)).Times(0);
EXPECT_CALL(*mock_app_, set_menu_icon(_)).Times(0);
EXPECT_CALL(*mock_app_, set_keyboard_props(keyboard_properties));
@@ -858,7 +861,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataFromSynonyms_SUCCESS) {
ON_CALL(mock_hmi_interfaces_,
GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI))
.WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE));
- SharedPtr<SetGlobalPropertiesRequest> command(
+ std::shared_ptr<SetGlobalPropertiesRequest> command(
CreateCommand<SetGlobalPropertiesRequest>(msg));
command->Run();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
index 2d9be1b5cf..4725af4671 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
@@ -31,6 +31,7 @@
*/
#include <stdint.h>
+#include <memory>
#include <string>
#include <set>
@@ -362,7 +363,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WARNINGS) {
msg_params[am::strings::graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
@@ -461,7 +462,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WARNINGS) {
msg_params[am::strings::secondary_graphic] = graphic;
(*msg)[am::strings::msg_params] = msg_params;
- SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
index d07e76350f..78fca8681a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc
@@ -274,7 +274,7 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_WARNINGS) {
SubscribeApplicationToSoftButton(_, _, kFunctionId));
MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command_)));
- ASSERT_TRUE(result_msg);
+ ASSERT_TRUE(result_msg != nullptr);
EXPECT_EQ(
hmi_apis::FunctionID::Navigation_UpdateTurnList,
(*result_msg)[am::strings::params][am::strings::function_id].asInt());