summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc99
1 files changed, 98 insertions, 1 deletions
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
index 66280eb183..fc50288214 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
@@ -34,7 +34,6 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
-#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
@@ -42,6 +41,9 @@
#include "rc_rpc_plugin/rc_module_constants.h"
#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include <stdint.h>
+#include "gtest/gtest.h"
+
using application_manager::ApplicationSet;
using application_manager::commands::MessageSharedPtr;
using test::components::application_manager_test::MockApplication;
@@ -51,6 +53,7 @@ using test::components::commands_test::CommandsTestMocks;
using ::testing::_;
using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::SaveArg;
namespace {
const uint32_t kAppId = 0u;
@@ -159,6 +162,7 @@ TEST_F(SetInteriorVehicleDataRequestTest,
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ command->Init();
command->Run();
}
@@ -198,6 +202,7 @@ TEST_F(
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ command->Init();
command->Run();
}
@@ -229,7 +234,99 @@ TEST_F(
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ command->Init();
command->Run();
}
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::CLIMATE;
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData]
+ [message_params::kClimateEnable] = true;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillOnce(Return(nullptr));
+
+ MessageSharedPtr message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ command->Init();
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const bool climate_enable =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kClimateControlData]
+ [message_params::kClimateEnable]
+ .asBool();
+ EXPECT_TRUE(climate_enable);
+}
+
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI_HDChannel) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::RADIO;
+
+ msg_params[message_params::kModuleData][message_params::kRadioControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ const std::uint32_t hd_channel = 2u;
+ msg_params[message_params::kModuleData][message_params::kRadioControlData]
+ [message_params::kHdChannel] = hd_channel;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillOnce(Return(nullptr));
+
+ auto message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ command->Init();
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const uint64_t hd_channel_from_hmi =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kRadioControlData]
+ [message_params::kHdChannel]
+ .asUInt();
+
+ EXPECT_EQ(hd_channel, hd_channel_from_hmi);
+}
} // namespace rc_rpc_plugin_test