diff options
3 files changed, 12 insertions, 4 deletions
diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc index 64043d2a88..82836717a3 100644 --- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc @@ -56,8 +56,7 @@ void OnButtonEventNotification::Run() { const bool is_app_id_exists = (*message_)[strings::msg_params].keyExists(strings::app_id); - const ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); + ApplicationSharedPtr app; // CUSTOM_BUTTON notification if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { @@ -67,6 +66,9 @@ void OnButtonEventNotification::Run() { return; } + app = application_manager_.application( + (*message_)[strings::msg_params][strings::app_id].asUInt()); + // custom_button_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists( diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc index b789b7c7e9..c77cd9fbba 100755..100644 --- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc @@ -56,8 +56,7 @@ void OnButtonPressNotification::Run() { const bool is_app_id_exists = (*message_)[strings::msg_params].keyExists(strings::app_id); - const ApplicationSharedPtr app = application_manager_.application( - (*message_)[strings::msg_params][strings::app_id].asUInt()); + ApplicationSharedPtr app; // CUSTOM_BUTTON notification if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) { @@ -67,6 +66,9 @@ void OnButtonPressNotification::Run() { return; } + app = application_manager_.application( + (*message_)[strings::msg_params][strings::app_id].asUInt()); + // custom_button_id is mandatory for CUSTOM_BUTTON notification if (false == (*message_)[strings::msg_params].keyExists( diff --git a/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc index 1520ab4288..793f379286 100644 --- a/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc +++ b/src/components/application_manager/test/commands/mobile/on_button_notification_commands_test.cc @@ -152,6 +152,9 @@ TYPED_TEST(OnButtonNotificationCommandsTest, SharedPtr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); + typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); + EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app)); + EXPECT_CALL(this->app_mngr_, SendMessageToMobile(_, _)).Times(0); command->Run(); @@ -318,6 +321,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) { MessageSharedPtr notification_msg( this->CreateMessage(smart_objects::SmartType_Map)); + (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = kButtonName; |