summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc71
1 files changed, 30 insertions, 41 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index f3bfe12ab1..56e0766184 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -202,22 +202,19 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::eType::SEEKLEFT,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
@@ -249,30 +246,30 @@ TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::eType::NAV_CENTER_LOCATION,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
-TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
- const mobile_apis::ButtonName::eType kButtonName =
- mobile_apis::ButtonName::OK;
+TEST_F(SubscribeButtonRequestTest,
+ Run_App_Version_4_5_and_OK_btn_Expect_PlayPause_btn_sent_to_HMI) {
+ const mobile_apis::ButtonName::eType button_ok = mobile_apis::ButtonName::OK;
- MessageSharedPtr msg(CreateMessage());
- (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ const mobile_apis::ButtonName::eType button_play_pause =
+ mobile_apis::ButtonName::PLAY_PAUSE;
+
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::msg_params][am::strings::button_name] = button_ok;
CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
MockAppPtr app(CreateMockApp());
@@ -284,41 +281,33 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
.WillByDefault(Return(true));
MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
- (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
- (*button_caps_ptr)[1][am::hmi_response::button_name] =
- mobile_apis::ButtonName::PLAY_PAUSE;
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = button_ok;
+ (*button_caps_ptr)[1][am::hmi_response::button_name] = button_play_pause;
ON_CALL(mock_hmi_capabilities_, button_capabilities())
.WillByDefault(Return(button_caps_ptr));
- ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+ ON_CALL(*app, IsSubscribedToButton(button_play_pause))
+ .WillByDefault(Return(false));
MessageSharedPtr hmi_result_msg;
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
.WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
- MessageSharedPtr mobile_result_msg;
- EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
- .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
ASSERT_TRUE(command->Init());
command->Run();
- EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_SubscribeButton,
static_cast<hmi_apis::FunctionID::eType>(
(*hmi_result_msg)[am::strings::params][am::strings::function_id]
.asInt()));
- EXPECT_EQ(hmi_apis::Common_ButtonName::PLAY_PAUSE,
- static_cast<hmi_apis::Common_ButtonName::eType>(
- (*hmi_result_msg)[am::strings::msg_params][am::strings::name]
- .asInt()));
-
- EXPECT_EQ(mobile_apis::Result::SUCCESS,
- static_cast<mobile_apis::Result::eType>(
- (*mobile_result_msg)[am::strings::msg_params]
- [am::strings::result_code]
- .asInt()));
+ EXPECT_EQ(
+ hmi_apis::Common_ButtonName::PLAY_PAUSE,
+ static_cast<hmi_apis::Common_ButtonName::eType>(
+ (*hmi_result_msg)[am::strings::msg_params][am::strings::button_name]
+ .asInt()));
}
} // namespace subscribe_button_request