diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi')
59 files changed, 1438 insertions, 996 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc index 50b7aae42a..7dadad59fe 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/activate_app_request_test.cc @@ -30,12 +30,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/activate_app_request.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/command_impl.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" +#include "gtest/gtest.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -47,9 +47,9 @@ using ::testing::_; namespace am = ::application_manager; namespace strings = ::application_manager::strings; +using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::ActivateAppRequest; -using am::commands::CommandImpl; using ::test::components::application_manager_test::MockApplication; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc index a5707488dd..01487284a4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/add_statistics_info_notification_test.cc @@ -30,15 +30,15 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/add_statistics_info_notification.h" +#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/policies/policy_handler.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/policies/policy_handler.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -49,11 +49,11 @@ namespace add_statistics_info_notification { namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_notification = ::application_manager::hmi_notification; -using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::AddStatisticsInfoNotification; using am::commands::CommandImpl; +using am::commands::MessageSharedPtr; using policy::PolicyHandler; using policy_test::MockPolicyHandlerInterface; +using sdl_rpc_plugin::commands::AddStatisticsInfoNotification; using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc index a2fcf8f605..251fe230fc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_all_apps_response_test.cc @@ -30,13 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/allow_all_apps_response.h" +#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/command_impl.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { namespace commands_test { @@ -53,7 +53,7 @@ typedef std::shared_ptr<AllowAllAppsResponse> ResponsePtr; namespace { const bool kResponseIsAllowed = true; -} // +} // namespace class AllowAllAppsResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {}; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc index 2ce400542a..a0e23d7b9d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/allow_app_response_test.cc @@ -30,8 +30,8 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/allow_app_response.h" +#include "gtest/gtest.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -53,7 +53,7 @@ namespace hmi_response = ::application_manager::hmi_response; namespace { const uint32_t kConnectionKey = 1u; const bool kIsResponseAllowed = true; -} +} // namespace typedef std::shared_ptr<AllowAppResponse> ResponsePtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc index a3f0ab6933..9cd87b053d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_request_test.cc @@ -28,7 +28,7 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. -*/ + */ #include "hmi/basic_communication_get_system_time_request.h" @@ -60,7 +60,7 @@ TEST_F(BasicCommunicationGetSystemTimeRequestTest, OnTimeout) { ON_CALL(app_mngr_, protocol_handler()) .WillByDefault(ReturnRef(mock_protocol_handler)); - EXPECT_CALL(mock_protocol_handler, NotifyOnFailedHandshake()); + EXPECT_CALL(mock_protocol_handler, NotifyOnGetSystemTimeFailed()); command->onTimeOut(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc index 8f56c6462c..0c8e986fc6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/basic_communication_get_system_time_response_test.cc @@ -30,12 +30,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "application_manager/commands/commands_test.h" #include "hmi/basic_communication_get_system_time_response.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" #include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "interfaces/HMI_API.h" namespace test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc index 6ed15bebeb..7d9ed899a6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/button_get_capabilities_response_test.cc @@ -30,13 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/button_get_capabilities_response.h" +#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" #include "application_manager/mock_hmi_capabilities.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { namespace commands_test { @@ -45,8 +45,8 @@ namespace button_get_capabilities_response { using application_manager::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::ButtonGetCapabilitiesResponse; -using ::testing::ReturnRef; using ::testing::NiceMock; +using ::testing::ReturnRef; namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; @@ -100,7 +100,8 @@ TEST_F(ButtonGetCapabilitiesResponseTest, Run_CodeAborted_SUCCESS) { EXPECT_CALL(mock_hmi_capabilities_, set_button_capabilities(capabilities_)) .Times(0); EXPECT_CALL(mock_hmi_capabilities_, - set_preset_bank_capabilities(preset_bank_capabilities_)).Times(0); + set_preset_bank_capabilities(preset_bank_capabilities_)) + .Times(0); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc index 6914a4ca7e..087109c871 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/close_popup_response_test.cc @@ -35,13 +35,13 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" -#include "application_manager/commands/response_from_hmi.h" -#include "hmi/close_popup_response.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/commands/response_from_hmi.h" #include "application_manager/mock_application.h" +#include "application_manager/smart_object_keys.h" +#include "hmi/close_popup_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -50,9 +50,9 @@ namespace hmi_commands_test { namespace close_popup_response { namespace am = ::application_manager; +using am::commands::CommandImpl; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::ClosePopupResponse; -using am::commands::CommandImpl; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc index 874d27b4b0..c66cb81141 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -37,194 +37,191 @@ #include <vector> #include "gtest/gtest.h" +#include "hmi/activate_app_request.h" +#include "hmi/activate_app_response.h" +#include "hmi/add_statistics_info_notification.h" #include "hmi/allow_all_apps_request.h" #include "hmi/allow_all_apps_response.h" #include "hmi/allow_app_request.h" #include "hmi/allow_app_response.h" +#include "hmi/basic_communication_system_request.h" +#include "hmi/basic_communication_system_response.h" +#include "hmi/bc_get_file_path_request.h" +#include "hmi/bc_get_file_path_response.h" +#include "hmi/button_get_capabilities_request.h" +#include "hmi/button_get_capabilities_response.h" +#include "hmi/close_popup_request.h" +#include "hmi/close_popup_response.h" +#include "hmi/dial_number_request.h" +#include "hmi/dial_number_response.h" +#include "hmi/get_system_info_request.h" +#include "hmi/get_system_info_response.h" +#include "hmi/mixing_audio_supported_request.h" +#include "hmi/mixing_audio_supported_response.h" +#include "hmi/navi_alert_maneuver_request.h" +#include "hmi/navi_alert_maneuver_response.h" #include "hmi/navi_audio_start_stream_request.h" #include "hmi/navi_audio_start_stream_response.h" #include "hmi/navi_audio_stop_stream_request.h" #include "hmi/navi_audio_stop_stream_response.h" -#include "hmi/update_device_list_request.h" -#include "hmi/update_device_list_response.h" -#include "hmi/on_update_device_list.h" -#include "hmi/on_start_device_discovery.h" -#include "hmi/update_app_list_request.h" -#include "hmi/update_app_list_response.h" -#include "hmi/on_find_applications.h" -#include "hmi/sdl_get_list_of_permissions_request.h" -#include "hmi/sdl_get_list_of_permissions_response.h" -#include "hmi/sdl_get_user_friendly_message_request.h" -#include "hmi/sdl_get_user_friendly_message_response.h" -#include "hmi/sdl_get_status_update_request.h" -#include "hmi/sdl_get_status_update_response.h" -#include "hmi/on_status_update_notification.h" -#include "hmi/update_sdl_request.h" -#include "hmi/update_sdl_response.h" -#include "hmi/activate_app_request.h" -#include "hmi/activate_app_response.h" -#include "hmi/mixing_audio_supported_request.h" -#include "hmi/mixing_audio_supported_response.h" +#include "hmi/navi_get_way_points_request.h" +#include "hmi/navi_get_way_points_response.h" +#include "hmi/navi_is_ready_request.h" +#include "hmi/navi_is_ready_response.h" +#include "hmi/navi_send_location_request.h" +#include "hmi/navi_send_location_response.h" +#include "hmi/navi_show_constant_tbt_request.h" +#include "hmi/navi_show_constant_tbt_response.h" +#include "hmi/navi_start_stream_request.h" +#include "hmi/navi_start_stream_response.h" +#include "hmi/navi_stop_stream_request.h" +#include "hmi/navi_stop_stream_response.h" +#include "hmi/navi_subscribe_way_points_request.h" +#include "hmi/navi_subscribe_way_points_response.h" +#include "hmi/navi_unsubscribe_way_points_request.h" +#include "hmi/navi_unsubscribe_way_points_response.h" +#include "hmi/navi_update_turn_list_request.h" +#include "hmi/navi_update_turn_list_response.h" #include "hmi/on_allow_sdl_functionality_notification.h" +#include "hmi/on_app_activated_notification.h" +#include "hmi/on_app_deactivated_notification.h" #include "hmi/on_app_permission_changed_notification.h" #include "hmi/on_app_permission_consent_notification.h" -#include "hmi/on_app_activated_notification.h" +#include "hmi/on_app_registered_notification.h" +#include "hmi/on_app_unregistered_notification.h" #include "hmi/on_audio_data_streaming_notification.h" -#include "hmi/on_video_data_streaming_notification.h" -#include "hmi/on_sdl_consent_needed_notification.h" +#include "hmi/on_button_event_notification.h" +#include "hmi/on_button_press_notification.h" +#include "hmi/on_button_subscription_notification.h" +#include "hmi/on_device_chosen_notification.h" +#include "hmi/on_device_state_changed_notification.h" +#include "hmi/on_driver_distraction_notification.h" +#include "hmi/on_event_changed_notification.h" #include "hmi/on_exit_all_applications_notification.h" #include "hmi/on_exit_application_notification.h" +#include "hmi/on_file_removed_notification.h" +#include "hmi/on_find_applications.h" +#include "hmi/on_ignition_cycle_over_notification.h" +#include "hmi/on_navi_tbt_client_state_notification.h" +#include "hmi/on_navi_way_point_change_notification.h" +#include "hmi/on_policy_update.h" #include "hmi/on_put_file_notification.h" +#include "hmi/on_ready_notification.h" +#include "hmi/on_received_policy_update.h" +#include "hmi/on_record_start_notification.h" #include "hmi/on_resume_audio_source_notification.h" -#include "hmi/on_ignition_cycle_over_notification.h" +#include "hmi/on_sdl_close_notification.h" +#include "hmi/on_sdl_consent_needed_notification.h" +#include "hmi/on_sdl_persistence_complete_notification.h" +#include "hmi/on_start_device_discovery.h" +#include "hmi/on_status_update_notification.h" +#include "hmi/on_system_context_notification.h" +#include "hmi/on_system_error_notification.h" #include "hmi/on_system_info_changed_notification.h" -#include "hmi/get_system_info_request.h" -#include "hmi/get_system_info_response.h" -#include "hmi/close_popup_request.h" -#include "hmi/close_popup_response.h" -#include "hmi/button_get_capabilities_request.h" -#include "hmi/button_get_capabilities_response.h" +#include "hmi/on_system_request_notification.h" +#include "hmi/on_tts_language_change_notification.h" +#include "hmi/on_tts_reset_timeout_notification.h" +#include "hmi/on_tts_started_notification.h" +#include "hmi/on_tts_stopped_notification.h" +#include "hmi/on_ui_command_notification.h" +#include "hmi/on_ui_keyboard_input_notification.h" +#include "hmi/on_ui_language_change_notification.h" +#include "hmi/on_ui_reset_timeout_notification.h" +#include "hmi/on_ui_touch_event_notification.h" +#include "hmi/on_update_device_list.h" +#include "hmi/on_video_data_streaming_notification.h" +#include "hmi/on_vr_command_notification.h" +#include "hmi/on_vr_language_change_notification.h" +#include "hmi/on_vr_started_notification.h" +#include "hmi/on_vr_stopped_notification.h" +#include "hmi/sdl_activate_app_request.h" +#include "hmi/sdl_activate_app_response.h" +#include "hmi/sdl_get_list_of_permissions_request.h" +#include "hmi/sdl_get_list_of_permissions_response.h" +#include "hmi/sdl_get_status_update_request.h" +#include "hmi/sdl_get_status_update_response.h" +#include "hmi/sdl_get_user_friendly_message_request.h" +#include "hmi/sdl_get_user_friendly_message_response.h" +#include "hmi/sdl_policy_update.h" +#include "hmi/sdl_policy_update_response.h" +#include "hmi/tts_change_registration_request.h" +#include "hmi/tts_change_registration_response.h" +#include "hmi/tts_get_capabilities_request.h" +#include "hmi/tts_get_capabilities_response.h" +#include "hmi/tts_get_language_request.h" +#include "hmi/tts_get_language_response.h" +#include "hmi/tts_get_supported_languages_request.h" +#include "hmi/tts_get_supported_languages_response.h" +#include "hmi/tts_is_ready_request.h" +#include "hmi/tts_is_ready_response.h" +#include "hmi/tts_set_global_properties_request.h" +#include "hmi/tts_set_global_properties_response.h" +#include "hmi/tts_speak_request.h" +#include "hmi/tts_speak_response.h" +#include "hmi/tts_stop_speaking_request.h" +#include "hmi/tts_stop_speaking_response.h" #include "hmi/ui_add_command_request.h" #include "hmi/ui_add_command_response.h" -#include "hmi/ui_delete_command_request.h" -#include "hmi/ui_delete_command_response.h" #include "hmi/ui_add_submenu_request.h" #include "hmi/ui_add_submenu_response.h" +#include "hmi/ui_alert_request.h" +#include "hmi/ui_alert_response.h" +#include "hmi/ui_change_registration_request.h" +#include "hmi/ui_change_registration_response.h" +#include "hmi/ui_delete_command_request.h" +#include "hmi/ui_delete_command_response.h" #include "hmi/ui_delete_submenu_request.h" #include "hmi/ui_delete_submenu_response.h" -#include "hmi/ui_get_supported_languages_request.h" -#include "hmi/ui_get_supported_languages_response.h" -#include "hmi/ui_get_language_request.h" -#include "hmi/ui_get_language_response.h" +#include "hmi/ui_end_audio_pass_thru_request.h" +#include "hmi/ui_end_audio_pass_thru_response.h" #include "hmi/ui_get_capabilities_request.h" #include "hmi/ui_get_capabilities_response.h" -#include "hmi/ui_change_registration_request.h" -#include "hmi/ui_change_registration_response.h" -#include "hmi/ui_show_request.h" -#include "hmi/ui_show_response.h" -#include "hmi/ui_alert_request.h" -#include "hmi/ui_alert_response.h" +#include "hmi/ui_get_language_request.h" +#include "hmi/ui_get_language_response.h" +#include "hmi/ui_get_supported_languages_request.h" +#include "hmi/ui_get_supported_languages_response.h" #include "hmi/ui_is_ready_request.h" #include "hmi/ui_is_ready_response.h" -#include "hmi/ui_slider_request.h" -#include "hmi/ui_slider_response.h" -#include "hmi/ui_set_media_clock_timer_request.h" -#include "hmi/ui_set_media_clock_timer_response.h" -#include "hmi/ui_set_global_properties_request.h" -#include "hmi/ui_set_global_properties_response.h" +#include "hmi/ui_perform_audio_pass_thru_request.h" +#include "hmi/ui_perform_audio_pass_thru_response.h" +#include "hmi/ui_perform_interaction_request.h" +#include "hmi/ui_perform_interaction_response.h" #include "hmi/ui_scrollable_message_request.h" #include "hmi/ui_scrollable_message_response.h" #include "hmi/ui_set_app_icon_request.h" #include "hmi/ui_set_app_icon_response.h" -#include "hmi/ui_perform_audio_pass_thru_response.h" -#include "hmi/ui_perform_audio_pass_thru_request.h" -#include "hmi/ui_end_audio_pass_thru_request.h" -#include "hmi/ui_end_audio_pass_thru_response.h" -#include "hmi/ui_perform_interaction_request.h" -#include "hmi/ui_perform_interaction_response.h" -#include "hmi/vr_is_ready_request.h" -#include "hmi/vr_is_ready_response.h" +#include "hmi/ui_set_display_layout_request.h" +#include "hmi/ui_set_display_layout_response.h" +#include "hmi/ui_set_global_properties_request.h" +#include "hmi/ui_set_global_properties_response.h" +#include "hmi/ui_set_media_clock_timer_request.h" +#include "hmi/ui_set_media_clock_timer_response.h" +#include "hmi/ui_show_request.h" +#include "hmi/ui_show_response.h" +#include "hmi/ui_slider_request.h" +#include "hmi/ui_slider_response.h" +#include "hmi/update_app_list_request.h" +#include "hmi/update_app_list_response.h" +#include "hmi/update_device_list_request.h" +#include "hmi/update_device_list_response.h" +#include "hmi/update_sdl_request.h" +#include "hmi/update_sdl_response.h" #include "hmi/vr_add_command_request.h" #include "hmi/vr_add_command_response.h" -#include "hmi/vr_delete_command_request.h" -#include "hmi/vr_delete_command_response.h" #include "hmi/vr_change_registration_request.h" #include "hmi/vr_change_registration_response.h" -#include "hmi/vr_get_supported_languages_request.h" -#include "hmi/vr_get_supported_languages_response.h" -#include "hmi/vr_get_language_request.h" -#include "hmi/vr_get_language_response.h" +#include "hmi/vr_delete_command_request.h" +#include "hmi/vr_delete_command_response.h" #include "hmi/vr_get_capabilities_request.h" #include "hmi/vr_get_capabilities_response.h" -#include "hmi/tts_is_ready_request.h" -#include "hmi/tts_is_ready_response.h" -#include "hmi/tts_change_registration_request.h" -#include "hmi/tts_change_registration_response.h" -#include "hmi/tts_get_supported_languages_request.h" -#include "hmi/tts_get_supported_languages_response.h" -#include "hmi/tts_get_language_request.h" -#include "hmi/tts_get_language_response.h" -#include "hmi/tts_stop_speaking_request.h" -#include "hmi/tts_stop_speaking_response.h" -#include "hmi/tts_speak_request.h" -#include "hmi/tts_speak_response.h" -#include "hmi/tts_set_global_properties_request.h" -#include "hmi/tts_set_global_properties_response.h" -#include "hmi/tts_get_capabilities_request.h" -#include "hmi/tts_get_capabilities_response.h" +#include "hmi/vr_get_language_request.h" +#include "hmi/vr_get_language_response.h" +#include "hmi/vr_get_supported_languages_request.h" +#include "hmi/vr_get_supported_languages_response.h" +#include "hmi/vr_is_ready_request.h" +#include "hmi/vr_is_ready_response.h" #include "hmi/vr_perform_interaction_request.h" #include "hmi/vr_perform_interaction_response.h" -#include "hmi/sdl_activate_app_request.h" -#include "hmi/sdl_activate_app_response.h" -#include "hmi/on_app_permission_changed_notification.h" -#include "hmi/on_event_changed_notification.h" -#include "hmi/navi_is_ready_request.h" -#include "hmi/navi_show_constant_tbt_request.h" -#include "hmi/navi_show_constant_tbt_response.h" -#include "hmi/navi_is_ready_response.h" -#include "hmi/navi_alert_maneuver_request.h" -#include "hmi/navi_alert_maneuver_response.h" -#include "hmi/navi_update_turn_list_request.h" -#include "hmi/navi_update_turn_list_response.h" -#include "hmi/navi_subscribe_way_points_request.h" -#include "hmi/navi_subscribe_way_points_response.h" -#include "hmi/navi_unsubscribe_way_points_request.h" -#include "hmi/navi_unsubscribe_way_points_response.h" -#include "hmi/navi_get_way_points_request.h" -#include "hmi/navi_get_way_points_response.h" -#include "hmi/on_ready_notification.h" -#include "hmi/on_device_chosen_notification.h" -#include "hmi/on_file_removed_notification.h" -#include "hmi/on_system_context_notification.h" -#include "hmi/on_app_registered_notification.h" -#include "hmi/on_app_unregistered_notification.h" -#include "hmi/on_driver_distraction_notification.h" -#include "hmi/on_tts_started_notification.h" -#include "hmi/on_tts_stopped_notification.h" -#include "hmi/on_vr_started_notification.h" -#include "hmi/on_vr_stopped_notification.h" -#include "hmi/on_vr_command_notification.h" -#include "hmi/on_ui_command_notification.h" -#include "hmi/on_app_deactivated_notification.h" -#include "hmi/on_ui_language_change_notification.h" -#include "hmi/on_vr_language_change_notification.h" -#include "hmi/on_tts_language_change_notification.h" -#include "hmi/on_navi_tbt_client_state_notification.h" -#include "hmi/on_navi_way_point_change_notification.h" -#include "hmi/on_button_event_notification.h" -#include "hmi/on_button_press_notification.h" -#include "hmi/on_button_subscription_notification.h" -#include "hmi/on_ui_keyboard_input_notification.h" -#include "hmi/on_ui_touch_event_notification.h" -#include "hmi/on_ui_reset_timeout_notification.h" -#include "hmi/navi_start_stream_request.h" -#include "hmi/navi_start_stream_response.h" -#include "hmi/navi_stop_stream_request.h" -#include "hmi/navi_stop_stream_response.h" -#include "hmi/on_system_request_notification.h" -#include "hmi/ui_set_display_layout_request.h" -#include "hmi/ui_set_display_layout_response.h" -#include "hmi/on_sdl_close_notification.h" -#include "hmi/on_sdl_persistence_complete_notification.h" -#include "hmi/on_record_start_notification.h" -#include "hmi/add_statistics_info_notification.h" -#include "hmi/on_system_error_notification.h" -#include "hmi/basic_communication_system_request.h" -#include "hmi/basic_communication_system_response.h" -#include "hmi/sdl_policy_update.h" -#include "hmi/sdl_policy_update_response.h" -#include "hmi/on_received_policy_update.h" -#include "hmi/on_policy_update.h" -#include "hmi/get_urls.h" -#include "hmi/get_urls_response.h" -#include "hmi/on_device_state_changed_notification.h" -#include "hmi/navi_send_location_request.h" -#include "hmi/navi_send_location_response.h" -#include "hmi/on_tts_reset_timeout_notification.h" -#include "hmi/dial_number_request.h" -#include "hmi/dial_number_response.h" -#include "hmi/bc_get_file_path_request.h" -#include "hmi/bc_get_file_path_response.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -242,16 +239,16 @@ namespace dummy_hmi_commands_test { namespace commands = sdl_rpc_plugin::commands; -using ::testing::_; -using ::testing::NotNull; -using ::testing::Types; +using ::application_manager::ApplicationSharedPtr; using application_manager::commands::MessageSharedPtr; -using ::test::components::event_engine_test::MockEventDispatcher; +using ::test::components::application_manager_test::MockApplication; using ::test::components::application_manager_test::MockApplicationManager; using ::test::components::application_manager_test:: MockApplicationManagerSettings; -using ::application_manager::ApplicationSharedPtr; -using ::test::components::application_manager_test::MockApplication; +using ::test::components::event_engine_test::MockEventDispatcher; +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; template <class Command> class HMICommandsTest : public components::commands_test::CommandRequestTest< @@ -321,8 +318,6 @@ typedef Types<commands::OnStartDeviceDiscovery, commands::SDLActivateAppRequest, commands::SDLPolicyUpdateResponse, commands::SDLPolicyUpdate, - commands::GetUrlsResponse, - commands::GetUrls, commands::OnAppPermissionChangedNotification, commands::SDLGetListOfPermissionsResponse, commands::SDLGetListOfPermissionsRequest, @@ -359,7 +354,8 @@ typedef Types<commands::OnStartDeviceDiscovery, commands::UIGetLanguageRequest, commands::UIGetCapabilitiesResponse, commands::UIGetCapabilitiesRequest, - commands::UIChangeRegistratioResponse> HMICommandsListFirst; + commands::UIChangeRegistratioResponse> + HMICommandsListFirst; typedef Types<commands::UIChangeRegistrationRequest, commands::UIPerformAudioPassThruResponse, @@ -409,7 +405,8 @@ typedef Types<commands::UIChangeRegistrationRequest, commands::ClosePopupResponse, commands::ClosePopupRequest, commands::UIIsReadyResponse, - commands::UIIsReadyRequest> HMICommandsListSecond; + commands::UIIsReadyRequest> + HMICommandsListSecond; typedef Types<commands::NaviIsReadyResponse, commands::NaviIsReadyRequest, @@ -447,7 +444,8 @@ typedef Types<commands::NaviIsReadyResponse, commands::OnVRStoppedNotification, commands::OnVRCommandNotification, commands::OnUICommandNotification, - commands::OnAppDeactivatedNotification> HMICommandsListThird; + commands::OnAppDeactivatedNotification> + HMICommandsListThird; typedef Types<commands::hmi::OnButtonEventNotification, commands::hmi::OnButtonPressNotification, @@ -493,14 +491,16 @@ typedef Types<commands::hmi::OnButtonEventNotification, commands::OnNaviWayPointChangeNotification, commands::OnUILanguageChangeNotification, commands::OnVRLanguageChangeNotification, - commands::OnTTSLanguageChangeNotification> HMICommandsListFourth; + commands::OnTTSLanguageChangeNotification> + HMICommandsListFourth; typedef Types<commands::AllowAllAppsRequest, commands::AllowAllAppsResponse, commands::AllowAppRequest, commands::AllowAppResponse, commands::BCGetFilePathRequest, - commands::BCGetFilePathResponse> HMICommandsListFifth; + commands::BCGetFilePathResponse> + HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc index 4cbe7305ea..5b860499dd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_request_test.cc @@ -35,13 +35,13 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" -#include "application_manager/mock_application_manager.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/commands/request_to_hmi.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/smart_object_keys.h" #include "hmi/get_system_info_request.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -51,9 +51,9 @@ namespace get_system_info_request { namespace am = ::application_manager; namespace strings = ::application_manager::strings; +using am::commands::CommandImpl; using am::commands::RequestToHMI; using sdl_rpc_plugin::commands::GetSystemInfoRequest; -using am::commands::CommandImpl; typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc index 6908e21053..11589683be 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_system_info_response_test.cc @@ -33,32 +33,32 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/response_from_hmi.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/commands/response_from_hmi.h" -#include "hmi/get_system_info_response.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/commands/commands_test.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/get_system_info_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { namespace commands_test { namespace hmi_commands_test { namespace get_system_info_response { -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; +using am::commands::CommandImpl; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::GetSystemInfoResponse; using sdl_rpc_plugin::commands::SystemInfo; -using am::commands::CommandImpl; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc deleted file mode 100644 index 20a05d8601..0000000000 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_test.cc +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (c) 2018, Ford Motor Company - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following - * disclaimer in the documentation and/or other materials provided with the - * distribution. - * - * Neither the name of the Ford Motor Company nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <stdint.h> -#include <string> - -#include "gtest/gtest.h" -#include "application_manager/message.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/mock_application.h" -#include "application_manager/mock_application_manager.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/command.h" -#include "hmi/get_urls.h" -#include "application_manager/policies/policy_handler.h" -#include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/commands/command_request_test.h" -#include "application_manager/commands/request_from_hmi.h" -#include "policy/mock_policy_manager.h" -#include "application_manager/event_engine/event_dispatcher.h" - -namespace test { -namespace components { -namespace commands_test { -namespace hmi_commands_test { -namespace get_urls { - -using namespace hmi_apis; -using namespace policy; -using ::testing::NiceMock; -using ::testing::_; -using ::testing::SetArgReferee; -using ::test::components::application_manager_test::MockApplication; -namespace am = ::application_manager; -namespace strings = ::application_manager::strings; -using am::commands::RequestFromHMI; -using sdl_rpc_plugin::commands::GetUrls; -using am::commands::CommandImpl; -using policy::PolicyHandler; -using policy_test::MockPolicyHandlerInterface; - -typedef std::shared_ptr<RequestFromHMI> RequestFromHMIPtr; - -namespace { -const uint32_t kInvalidAppId_ = 0u; -const uint32_t kAppIdForSending = 1u; -const uint32_t kConnectionKey = 2u; -const uint32_t kServiceType = 0u; -const std::string kInitialService = "0x0"; -const std::string kPolicyService = "7"; -const std::string kDefaultUrl = "URL is not found"; -const std::string kDefaultId = "default"; -const std::string kPolicyAppId = "policy_app_id"; -} // namespace - -class GetUrlsTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { - public: - MessageSharedPtr command_msg_; - RequestFromHMIPtr request_command_; - - GetUrlsTest() { - command_msg_ = - CreateMessage(ns_smart_device_link::ns_smart_objects::SmartType_Map); - (*command_msg_)[am::strings::params][am::strings::connection_key] = - kConnectionKey; - (*command_msg_)[am::strings::msg_params][am::hmi_request::service] = - kInitialService; - - request_command_ = CreateCommand<GetUrls>(command_msg_); - } -}; - -TEST_F(GetUrlsTest, RUN_SUCCESS) { - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - // EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(_, _)); - - request_command_->Run(); -} - -TEST_F(GetUrlsTest, RUN_PolicyNotEnabled_UNSUCCESS) { - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(false)); - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - request_command_->Run(); - - EXPECT_EQ(am::MessageType::kResponse, - (*command_msg_)[strings::params][strings::message_type].asInt()); - EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE, - (*command_msg_)[strings::params][am::hmi_response::code].asInt()); -} - -TEST_F(GetUrlsTest, RUN_EmptyEndpoints_UNSUCCESS) { - EndpointUrls endpoints_; - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - request_command_->Run(); - - EXPECT_EQ(am::MessageType::kResponse, - (*command_msg_)[strings::params][strings::message_type].asInt()); - EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE, - (*command_msg_)[strings::params][am::hmi_response::code].asInt()); -} - -#ifdef EXTENDED_POLICY -TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_SUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_request::service] = - kPolicyService; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - endpoints_.push_back(data); - - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - - MockAppPtr mock_app = CreateMockApp(); - - EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) - .WillOnce(Return(kAppIdForSending)); - - EXPECT_CALL(app_mngr_, application(kAppIdForSending)) - .WillOnce(Return(mock_app)); - EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppIdForSending)); - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - request_command_->Run(); - - EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists( - am::hmi_request::service)); - - EXPECT_EQ(am::MessageType::kResponse, - (*command_msg_)[strings::params][strings::message_type].asInt()); - EXPECT_EQ(Common_Result::SUCCESS, - (*command_msg_)[strings::params][am::hmi_response::code].asInt()); - - EXPECT_EQ(kAppIdForSending, - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [strings::app_id].asInt()); - EXPECT_EQ(kDefaultUrl, - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [strings::url].asString()); -} - -TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_IncorrectIdForSending_UNSUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_request::service] = - kPolicyService; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - endpoints_.push_back(data); - - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - - EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) - .WillOnce(Return(kInvalidAppId_)); - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - EXPECT_CALL(app_mngr_, application(kInvalidAppId_)).Times(0); - - request_command_->Run(); -} - -TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_ApplicationIsNotValid_UNSUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_request::service] = - kPolicyService; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - endpoints_.push_back(data); - - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - - MockAppPtr invalid_mock_app; - - EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) - .WillOnce(Return(kAppIdForSending)); - - EXPECT_CALL(app_mngr_, application(kAppIdForSending)) - .WillOnce(Return(invalid_mock_app)); - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - request_command_->Run(); - - EXPECT_EQ(am::MessageType::kResponse, - (*command_msg_)[strings::params][strings::message_type].asInt()); - EXPECT_EQ(Common_Result::DATA_NOT_AVAILABLE, - (*command_msg_)[strings::params][am::hmi_response::code].asInt()); -} - -TEST_F(GetUrlsTest, ProcessPolicyServiceURLs_FoundURLForApplication_SUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_request::service] = - kPolicyService; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - data.app_id = kPolicyAppId; - endpoints_.push_back(data); - - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kPolicyService, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - - MockAppPtr mock_app = CreateMockApp(); - - EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) - .WillOnce(Return(kAppIdForSending)); - - EXPECT_CALL(app_mngr_, application(kAppIdForSending)) - .WillOnce(Return(mock_app)); - - EXPECT_CALL(*mock_app, policy_app_id()).WillOnce(Return(kPolicyAppId)); - - EXPECT_CALL(mock_rpc_service_, ManageHMICommand(command_msg_, _)) - .WillOnce(Return(true)); - - request_command_->Run(); - - EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists( - am::hmi_request::service)); - - EXPECT_EQ(am::MessageType::kResponse, - (*command_msg_)[strings::params][strings::message_type].asInt()); - EXPECT_EQ(Common_Result::SUCCESS, - (*command_msg_)[strings::params][am::hmi_response::code].asInt()); -} -#endif - -TEST_F(GetUrlsTest, DISABLED_ProcessServiceURLs_SUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] = - kDefaultUrl; - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [am::hmi_response::policy_app_id] = "1"; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - data.app_id = "1"; - endpoints_.push_back(data); - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - - request_command_->Run(); - - EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists( - am::hmi_request::service)); - EXPECT_EQ(kDefaultUrl, - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [am::strings::url].asString()); - EXPECT_EQ(endpoints_[0].app_id, - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [am::hmi_response::policy_app_id].asString()); -} - -TEST_F(GetUrlsTest, ProcessServiceURLs_PolicyDefaultId_SUCCESS) { - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] = - kDefaultUrl; - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - [am::hmi_response::policy_app_id] = kDefaultId; - - EXPECT_CALL(mock_policy_handler_, PolicyEnabled()).WillOnce(Return(true)); - EndpointUrls endpoints_; - EndpointData data(kDefaultUrl); - endpoints_.push_back(data); - EXPECT_CALL(mock_policy_handler_, GetUpdateUrls(kServiceType, _)) - .WillOnce(SetArgReferee<1>(endpoints_)); - MockAppPtr mock_app = CreateMockApp(); - EXPECT_CALL(app_mngr_, application_by_policy_id(_)) - .WillOnce(Return(mock_app)); - request_command_->Run(); - - EXPECT_FALSE((*command_msg_)[am::strings::msg_params].keyExists( - am::hmi_request::service)); - EXPECT_TRUE( - (*command_msg_)[am::strings::msg_params][am::hmi_response::urls][0] - .keyExists(am::hmi_response::policy_app_id)); -} - -} // namespace get_urls -} // namespace hmi_commands_test -} // namespace commands_test -} // namespace components -} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc index ca322ea425..26f7a63872 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc @@ -33,81 +33,81 @@ #include <stdint.h> #include <string> #include <vector> -#include "gtest/gtest.h" #include "application_manager/commands/commands_test.h" -#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h" +#include "gtest/gtest.h" +#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_app_permission_changed_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_app_registered_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_audio_data_streaming_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_button_event_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_button_subscription_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_file_removed_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_navi_tbt_client_state_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_navi_way_point_change_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h" #include "sdl_rpc_plugin/commands/hmi/on_put_file_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h" +#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_resume_audio_source_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_sdl_close_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_sdl_consent_needed_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_sdl_persistence_complete_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h" #include "sdl_rpc_plugin/commands/hmi/on_status_update_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_record_start_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_app_activated_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_app_deactivated_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_app_unregistered_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_button_press_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_event_changed_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ready_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_reset_timeout_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_started_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_tts_stopped_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ui_command_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ui_keyboard_input_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_ui_reset_timeout_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_app_permission_consent_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ignition_cycle_over_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_policy_update.h" -#include "sdl_rpc_plugin/commands/hmi/on_received_policy_update.h" -#include "sdl_rpc_plugin/commands/hmi/on_system_error_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_system_info_changed_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_allow_sdl_functionality_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_device_state_changed_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_exit_all_applications_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_exit_application_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_ui_touch_event_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_video_data_streaming_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_vr_command_notification.h" #include "sdl_rpc_plugin/commands/hmi/on_vr_language_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_start_device_discovery.h" -#include "sdl_rpc_plugin/commands/hmi/on_device_chosen_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_system_context_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_system_request_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_tts_language_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_ui_language_change_notification.h" -#include "sdl_rpc_plugin/commands/hmi/on_driver_distraction_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_vr_started_notification.h" +#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h" -#include "utils/lock.h" #include "utils/data_accessor.h" +#include "utils/lock.h" #include "utils/signals.h" -#include "utils/file_system.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/mock_rpc_plugin_manager.h" -#include "application_manager/mock_state_controller.h" +#include "application_manager/hmi_capabilities_impl.h" #include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" -#include "application_manager/hmi_capabilities_impl.h" #include "application_manager/mock_hmi_capabilities.h" -#include "transport_manager/mock_transport_manager.h" +#include "application_manager/mock_message_helper.h" +#include "application_manager/mock_resume_ctrl.h" +#include "application_manager/mock_rpc_plugin_manager.h" +#include "application_manager/mock_state_controller.h" +#include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" #include "connection_handler/mock_connection_handler.h" #include "connection_handler/mock_connection_handler_settings.h" -#include "test/application_manager/mock_application_manager_settings.h" -#include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/mock_message_helper.h" #include "protocol_handler/mock_session_observer.h" -#include "application_manager/mock_resume_ctrl.h" +#include "smart_objects/smart_object.h" +#include "test/application_manager/mock_application_manager_settings.h" +#include "transport_manager/mock_transport_manager.h" +#include "utils/file_system.h" namespace am = application_manager; @@ -117,22 +117,22 @@ namespace commands_test { namespace hmi_commands_test { namespace hmi_notifications_test { -using ::testing::_; -using ::testing::Test; -using ::testing::Types; -using ::testing::Return; -using ::testing::ReturnRef; -using ::testing::NiceMock; -using ::testing::InSequence; -using ::smart_objects::SmartObject; +using ::application_manager::ApplicationSharedPtr; +using ::application_manager::MockMessageHelper; using ::application_manager::commands::MessageSharedPtr; +using ::smart_objects::SmartObject; +using ::test::components::application_manager_test::MockApplication; using ::test::components::application_manager_test::MockApplicationManager; using ::test::components::application_manager_test:: MockApplicationManagerSettings; -using ::application_manager::ApplicationSharedPtr; -using ::test::components::application_manager_test::MockApplication; using ::test::components::event_engine_test::MockEventDispatcher; -using ::application_manager::MockMessageHelper; +using ::testing::_; +using ::testing::InSequence; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::ReturnRef; +using ::testing::Test; +using ::testing::Types; using namespace sdl_rpc_plugin::commands; using namespace am::commands; @@ -148,6 +148,11 @@ typedef NiceMock< #define NAVI true #define NOT_NAVI false +namespace { +const am::WindowID kDefaultWindowId = + mobile_apis::PredefinedWindows::DEFAULT_WINDOW; +} + ACTION_P(GetEventId, event_id) { *event_id = arg0.id(); } @@ -155,8 +160,8 @@ ACTION_P(GetArg, arg) { *arg = arg0; } -ACTION_P(GetArg3, result) { - arg3 = *result; +ACTION_P(GetArg4, result) { + arg4 = *result; } ACTION_P2(GetConnectIdPermissionConsent, connect_id, consent) { @@ -192,6 +197,14 @@ const int32_t kMobileProtocolType_ = 0; const int32_t kProtocolVersion_ = 3; const uint32_t kCorrelationId_ = 1939u; const uint32_t kAppId_ = 2014u; +const std::string kDefaultLanguage = "en-us"; +const mobile_apis::Language::eType kMobileLanguage = + mobile_apis::Language::EN_US; + +// LSDW - lock screen dismissal warning +const std::string kLockScreenDismissalWarningMessage_en = + "Swipe down to dismiss, acknowledging that you are not the driver"; +const uint32_t kConnectionKey = 2u; } // namespace class HMICommandsNotificationsTest @@ -240,6 +253,9 @@ class HMICommandsNotificationsTest .WillByDefault(ReturnRef(mock_event_dispatcher_)); ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_)); ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_)); + ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_)); + ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage)) + .WillByDefault(Return(kDefaultLanguage)); } am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock, @@ -259,6 +275,8 @@ class HMICommandsNotificationsTest .WillByDefault(Return(vc)); ON_CALL(**app_mock, IsAudioApplication()) .WillByDefault(Return(media || navi || vc)); + ON_CALL(**app_mock, ui_language()) + .WillByDefault(ReturnRef(kMobileLanguage)); return app; } #if defined(OS_POSIX) @@ -319,7 +337,8 @@ typedef Types<OnAppPermissionChangedNotification, OnSDLPersistenceCompleteNotification, OnStatusUpdateNotification, OnVideoDataStreamingNotification, - OnRecordStartdNotification> HMIOnNotificationsListToHMITypes; + OnRecordStartdNotification> + HMIOnNotificationsListToHMITypes; typedef Types< CommandPair<OnAppActivatedNotification, @@ -1023,7 +1042,8 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_)); EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( - kAppId_, *it_mobile_reason)).WillOnce(Return(notification)); + kAppId_, *it_mobile_reason)) + .WillOnce(Return(notification)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(notification, Command::SOURCE_SDL)); EXPECT_CALL(app_mngr_, @@ -1088,6 +1108,7 @@ TEST_F(HMICommandsNotificationsTest, .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, SetRegularState(app_, + kDefaultWindowId, mobile_apis::HMILevel::HMI_NONE, mobile_apis::AudioStreamingState::NOT_AUDIBLE, mobile_apis::VideoStreamingState::NOT_STREAMABLE, @@ -1112,12 +1133,7 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); - EXPECT_CALL(mock_state_controller_, - SetRegularState(app_, - mobile_apis::HMILevel::HMI_NONE, - mobile_apis::AudioStreamingState::NOT_AUDIBLE, - mobile_apis::VideoStreamingState::NOT_STREAMABLE, - false)); + EXPECT_CALL(mock_state_controller_, ExitDefaultWindow(app_)); command->Run(); } @@ -1135,7 +1151,8 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); EXPECT_CALL(mock_state_controller_, - SetRegularState(_, mobile_apis::HMILevel::HMI_FULL, true)); + SetRegularState( + _, kDefaultWindowId, mobile_apis::HMILevel::HMI_FULL, true)); EXPECT_CALL(app_mngr_, get_settings()) .WillOnce(ReturnRef(app_mngr_settings_)); @@ -1336,8 +1353,10 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang)); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); - EXPECT_CALL(mock_state_controller_, - SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false)); + EXPECT_CALL( + mock_state_controller_, + SetRegularState( + app_, kDefaultWindowId, mobile_apis::HMILevel::HMI_NONE, false)); EXPECT_CALL(mock_message_helper_, GetOnAppInterfaceUnregisteredNotificationToMobile( kAppId_, @@ -1377,10 +1396,11 @@ TEST_F(HMICommandsNotificationsTest, [am::strings::id] = "2014"; std::shared_ptr<Command> command = CreateCommand<OnDeviceChosenNotification>(message); - EXPECT_CALL(app_mngr_, - ConnectToDevice( - (*message)[am::strings::msg_params][am::strings::device_info] - [am::strings::id].asString())); + EXPECT_CALL( + app_mngr_, + ConnectToDevice((*message)[am::strings::msg_params] + [am::strings::device_info][am::strings::id] + .asString())); command->Run(); } @@ -1413,7 +1433,8 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(app_)); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); - EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it)); + EXPECT_CALL(mock_state_controller_, + SetRegularState(app_, kDefaultWindowId, *it)); command->Run(); } } @@ -1462,7 +1483,8 @@ TEST_F(HMICommandsNotificationsTest, EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); EXPECT_CALL(app_mngr_, state_controller()) .WillOnce(ReturnRef(mock_state_controller_)); - EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it)); + EXPECT_CALL(mock_state_controller_, + SetRegularState(app_, kDefaultWindowId, *it)); command->Run(); } } @@ -1790,11 +1812,26 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) { hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::state] = state; + (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey; std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); EXPECT_CALL(app_mngr_, set_driver_distraction_state(state)); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_)); + + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_)); + typedef boost::optional<bool> OptionalBool; + + ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(true))); + std::string required_language = "en-us"; + ON_CALL(mock_policy_handler_, + LockScreenDismissalWarningMessage(required_language)) + .WillByDefault(Return( + boost::optional<std::string>(kLockScreenDismissalWarningMessage_en))); + + ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(*app_ptr_, app_id()).Times(0); command->Run(); @@ -1802,16 +1839,28 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) { TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationInvalidApp) { - const hmi_apis::Common_DriverDistractionState::eType state = - hmi_apis::Common_DriverDistractionState::DD_ON; + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::state] = state; + (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey; std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); ApplicationSharedPtr invalid_app; application_set_.insert(invalid_app); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_)); + + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_)); + typedef boost::optional<bool> OptionalBool; + ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(true))); + std::string required_language = "en-us"; + ON_CALL(mock_policy_handler_, + LockScreenDismissalWarningMessage(required_language)) + .WillByDefault(Return( + boost::optional<std::string>(kLockScreenDismissalWarningMessage_en))); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); EXPECT_CALL(*app_ptr_, app_id()).Times(0); command->Run(); @@ -1822,21 +1871,33 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) { hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::mobile_notification::state] = state; + (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey; std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); application_set_.insert(app_); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_)); + + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_)); + typedef boost::optional<bool> OptionalBool; + ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(true))); + std::string required_language = "en-us"; + ON_CALL(mock_policy_handler_, + LockScreenDismissalWarningMessage(required_language)) + .WillByDefault(Return( + boost::optional<std::string>(kLockScreenDismissalWarningMessage_en))); + ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_)); + policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(app_mngr_, GetPolicyHandler()) - .WillOnce(ReturnRef(mock_policy_handler_)); - EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)) .WillOnce(GetMessage(message)); - EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_)); + ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_)); command->Run(); EXPECT_EQ( diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc index 8164f957cb..64bf167f83 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_request_test.cc @@ -33,13 +33,13 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/commands/request_to_hmi.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/mixing_audio_supported_request.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -51,9 +51,9 @@ using ::testing::_; using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; +using am::commands::CommandImpl; using am::commands::RequestToHMI; using sdl_rpc_plugin::commands::MixingAudioSupportedRequest; -using am::commands::CommandImpl; typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc index aa651c2dca..8c2f07a1d6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/mixing_audio_supported_response_test.cc @@ -33,18 +33,18 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/commands/response_from_hmi.h" -#include "interfaces/HMI_API.h" -#include "interfaces/MOBILE_API.h" #include "application_manager/mock_application.h" #include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "interfaces/HMI_API.h" +#include "interfaces/MOBILE_API.h" #include "sdl_rpc_plugin/commands/hmi/mixing_audio_supported_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -52,15 +52,15 @@ namespace commands_test { namespace hmi_commands_test { namespace mixing_audio_supported_response { +using ::testing::NiceMock; using ::testing::Return; using ::testing::ReturnRef; -using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; -using sdl_rpc_plugin::commands::MixingAudioSupportedResponse; -using application_manager::commands::ResponseFromHMI; -using am::commands::CommandImpl; using am::HMICapabilities; +using am::commands::CommandImpl; +using application_manager::commands::ResponseFromHMI; +using sdl_rpc_plugin::commands::MixingAudioSupportedResponse; namespace hmi_response = ::application_manager::hmi_response; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc index d8454bb98e..926e51446f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_audio_start_stream_request_test.cc @@ -36,13 +36,13 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_interface.h" -#include "application_manager/commands/commands_test.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -54,9 +54,9 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; namespace commands = am::commands; +using am::event_engine::Event; using commands::MessageSharedPtr; using sdl_rpc_plugin::commands::AudioStartStreamRequest; -using am::event_engine::Event; namespace { const uint32_t kHmiAppId = 13u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc index 1a03ecf523..5e13755a32 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_request_test.cc @@ -34,15 +34,15 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/hmi_interfaces.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/event_engine/event.h" -#include "application_manager/mock_hmi_interface.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" -#include "application_manager/commands/commands_test.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -54,8 +54,8 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::NaviIsReadyRequest; using am::event_engine::Event; +using sdl_rpc_plugin::commands::NaviIsReadyRequest; namespace { const hmi_apis::FunctionID::eType kEventID = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc index 23f01fac3f..e166928348 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_is_ready_response_test.cc @@ -33,12 +33,12 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "gtest/gtest.h" #include "hmi/navi_is_ready_response.h" namespace test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc index 3110a11fd8..d6ef540bc0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_request_test.cc @@ -36,14 +36,14 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/hmi_interfaces.h" -#include "application_manager/mock_hmi_interface.h" #include "application_manager/event_engine/event.h" +#include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_interface.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -55,8 +55,8 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest; using am::event_engine::Event; +using sdl_rpc_plugin::commands::NaviSetVideoConfigRequest; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc index 06fa61db29..c4e7976bde 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_set_video_config_response_test.cc @@ -30,13 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "application_manager/commands/commands_test.h" #include "hmi/navi_set_video_config_response.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" namespace test { namespace components { @@ -47,8 +47,8 @@ namespace navi_set_video_config_response { using sdl_rpc_plugin::commands::NaviSetVideoConfigResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; -using testing::ReturnRef; using ::testing::NiceMock; +using testing::ReturnRef; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc index a7f50504fb..232d5ab628 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_start_stream_request_test.cc @@ -36,12 +36,12 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" #include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_interface.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -53,9 +53,9 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; namespace commands = am::commands; +using am::event_engine::Event; using commands::MessageSharedPtr; using sdl_rpc_plugin::commands::NaviStartStreamRequest; -using am::event_engine::Event; namespace { const uint32_t kHmiAppId = 13u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc index e4a79997fd..b32189ce1a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/navi_stop_stream_requests_test.cc @@ -30,17 +30,17 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "hmi/navi_stop_stream_request.h" #include "hmi/navi_audio_stop_stream_request.h" +#include "hmi/navi_stop_stream_request.h" #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" #include "application_manager/hmi_interfaces.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_interface.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -76,7 +76,8 @@ class NaviStopStreamRequestsTest }; typedef testing::Types<commands::AudioStopStreamRequest, - commands::NaviStopStreamRequest> RequestCommandsList; + commands::NaviStopStreamRequest> + RequestCommandsList; TYPED_TEST_CASE(NaviStopStreamRequestsTest, RequestCommandsList); TYPED_TEST(NaviStopStreamRequestsTest, Run_HmiInterfaceNotAvailable_NoRequest) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc new file mode 100644 index 0000000000..f3ed480180 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "hmi/on_bc_system_capability_updated_notification_from_hmi.h" + +#include "application_manager/commands/commands_test.h" +#include "gtest/gtest.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace on_bc_system_capability_updated_notification_from_hmi { + +using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotificationFromHMI; +using ::testing::_; +using ::testing::Return; + +typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotificationFromHMI> + OnBCSystemCapabilityUpdatedNotificationFromHMIPtr; + +namespace strings = application_manager::strings; +namespace { +const uint32_t kAppId = 1u; +} // namespace + +MATCHER(CheckMessageToMobile, "") { + const auto function_id = mobile_apis::FunctionID::OnSystemCapabilityUpdatedID; + + const bool is_function_id_matched = + function_id == static_cast<am::mobile_api::FunctionID::eType>( + (*arg)[strings::params][strings::function_id].asInt()); + const bool app_id_exist = + (*arg)[strings::msg_params].keyExists(strings::app_id); + bool is_connection_key_correct = true; + if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) { + is_connection_key_correct = + (*arg)[strings::params][strings::connection_key] == kAppId; + } + return is_function_id_matched && !app_id_exist && is_connection_key_correct; +} + +MATCHER_P(CheckDisplayCapabilitiesNotChanged, display_capability, "") { + return display_capability == arg; +} + +class OnBCSystemCapabilityUpdatedNotificationFromHMITest + : public CommandsTest<CommandsTestMocks::kIsNice> { + protected: + OnBCSystemCapabilityUpdatedNotificationFromHMITest() + : message_(CreateMessage()) + , display_capability_( + (*message_)[am::strings::msg_params][strings::system_capability] + [strings::display_capabilities]) { + command_ = + CreateCommand<OnBCSystemCapabilityUpdatedNotificationFromHMI>(message_); + mock_app_ = CreateMockApp(); + } + + OnBCSystemCapabilityUpdatedNotificationFromHMIPtr command_; + MockAppPtr mock_app_; + MessageSharedPtr message_; + const SmartObject display_capability_; +}; + +TEST_F( + OnBCSystemCapabilityUpdatedNotificationFromHMITest, + Run_AppIdNotPresentedInMessage_SetSystemDisplayCapabilitiesToHMICapabilities_SendMessageToMobile) { + (*message_)[am::strings::msg_params][strings::system_capability] + [am::strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DISPLAYS; + + EXPECT_CALL(mock_hmi_capabilities_, + set_system_display_capabilities( + CheckDisplayCapabilitiesNotChanged(display_capability_))); + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand( + CheckMessageToMobile(), + ::application_manager::commands::Command::CommandSource::SOURCE_SDL)) + .WillOnce(Return(true)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest, + Run_AppNotRegisteredWithPresentedAppIdInMessage_MessageNotSendToMobile) { + (*message_)[am::strings::msg_params][strings::system_capability] + [am::strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DISPLAYS; + (*message_)[strings::msg_params][strings::app_id] = kAppId; + ApplicationSharedPtr app; // Empty application shared pointer + + ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(app)); + EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F( + OnBCSystemCapabilityUpdatedNotificationFromHMITest, + Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToApp_SendMessageToMobile) { + (*message_)[am::strings::msg_params][strings::system_capability] + [am::strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DISPLAYS; + (*message_)[strings::msg_params][strings::app_id] = kAppId; + + ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_)); + + EXPECT_CALL(*mock_app_, + set_display_capabilities( + CheckDisplayCapabilitiesNotChanged(display_capability_))); + EXPECT_CALL( + mock_rpc_service_, + ManageMobileCommand( + CheckMessageToMobile(), + ::application_manager::commands::Command::CommandSource::SOURCE_SDL)) + .WillOnce(Return(true)); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +} // namespace on_bc_system_capability_updated_notification_from_hmi +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc new file mode 100644 index 0000000000..cb8894749f --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "hmi/on_bc_system_capability_updated_notification.h" + +#include "application_manager/commands/commands_test.h" +#include "gtest/gtest.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace on_bc_system_capability_updated_notification { + +using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotification; +using ::testing::_; +using ::testing::Return; + +typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotification> + OnBCSystemCapabilityUpdatedNotificationPtr; + +namespace strings = application_manager::strings; +namespace { +const uint32_t kConnectionKey = 1u; +} + +MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") { + return display_capabilities == + (*arg)[strings::msg_params][strings::system_capability] + [strings::display_capabilities]; +} + +class OnBCSystemCapabilityUpdatedNotificationTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + protected: + void SetUp() OVERRIDE { + message_ = CreateMessage(); + (*message_)[strings::params][strings::connection_key] = kConnectionKey; + + command_ = CreateCommand<OnBCSystemCapabilityUpdatedNotification>(message_); + mock_app_ = CreateMockApp(); + } + + OnBCSystemCapabilityUpdatedNotificationPtr command_; + MockAppPtr mock_app_; + MessageSharedPtr message_; +}; + +TEST_F(OnBCSystemCapabilityUpdatedNotificationTest, + SystemDisplayCapabilities_SUCCESS) { + (*message_)[am::strings::msg_params][strings::system_capability] + [am::strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DISPLAYS; + + smart_objects::SmartObjectSPtr system_display_capabilities = + std::make_shared<smart_objects::SmartObject>( + smart_objects::SmartType_Null); + + EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities()) + .Times(2) + .WillRepeatedly(Return(system_display_capabilities)); + + EXPECT_CALL( + mock_rpc_service_, + SendMessageToHMI(CheckDisplayCapabilities(*system_display_capabilities))); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +TEST_F(OnBCSystemCapabilityUpdatedNotificationTest, + SystemDisplayCapabilities_DATA_NOT_AVAILABLE) { + (*message_)[am::strings::msg_params][strings::system_capability] + [am::strings::system_capability_type] = + mobile_apis::SystemCapabilityType::DISPLAYS; + EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities()) + .WillOnce(Return(nullptr)); + + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0); + + ASSERT_TRUE(command_->Init()); + command_->Run(); +} + +} // namespace on_bc_system_capability_updated_notification +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc index fc3899e861..fe6ba7c4e3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc @@ -33,17 +33,17 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "utils/lock.h" -#include "utils/data_accessor.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/on_driver_distraction_notification.h" #include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" +#include "utils/data_accessor.h" +#include "utils/lock.h" namespace test { namespace components { @@ -52,22 +52,65 @@ namespace hmi_commands_test { namespace on_driver_distraction_notification { using ::testing::_; -using ::testing::Return; +using ::testing::DoAll; using ::testing::Eq; +using ::testing::NiceMock; +using ::testing::Return; +using ::testing::SaveArg; +using ::testing::SetArgumentPointee; + namespace am = ::application_manager; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification; using namespace am::commands; +using test::components::commands_test::MobileResultCodeIs; + +namespace { +const std::string kDefaultLanguage = "en-us"; +const mobile_apis::Language::eType kMobileLanguage = + mobile_apis::Language::EN_US; -typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr; +// LSDW - lock screen dismissal warning +const std::string kLockScreenDismissalWarningMessage_en = + "Swipe down to dismiss, acknowledging that you are not the driver"; +const uint32_t kConnectionKey = 2u; +} // namespace class HMIOnDriverDistractionNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: HMIOnDriverDistractionNotificationTest() - : app_set_lock_(std::make_shared<sync_primitives::Lock>()) {} + : mock_app_(CreateMockApp()) + , app_set_lock_(std::make_shared<sync_primitives::Lock>()) + , accessor(app_set_, app_set_lock_) { + app_set_.insert(mock_app_); + InitMocksRelations(); + } + + typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr; + typedef boost::optional<bool> OptionalBool; + + void SetUp() OVERRIDE { + ON_CALL(*mock_app_, ui_language()) + .WillByDefault(ReturnRef(kMobileLanguage)); + ON_CALL(app_mngr_, application(kConnectionKey)) + .WillByDefault(Return(mock_app_)); + ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage)) + .WillByDefault(Return(kDefaultLanguage)); + } + + MockAppPtr mock_app_; std::shared_ptr<sync_primitives::Lock> app_set_lock_; - policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_; + am::ApplicationSet app_set_; + DataAccessor<am::ApplicationSet> accessor; + NiceMock<policy_test::MockPolicyHandlerInterface> + mock_policy_handler_interface_; + + void InitMocksRelations() { + ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor)); + ON_CALL(app_mngr_, GetPolicyHandler()) + .WillByDefault(ReturnRef(mock_policy_handler_interface_)); + } }; MATCHER_P2(CheckNotificationParams, function_id, state, "") { @@ -83,76 +126,238 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") { return is_function_id_matched && is_state_matched; } -ACTION_P(GetArg3, result) { - arg3 = *result; +ACTION_P(GetArg4, result) { + arg4 = *result; } -TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) { - const hmi_apis::Common_DriverDistractionState::eType state = - hmi_apis::Common_DriverDistractionState::DD_ON; +ACTION_P(SetMessage, lockScreenDismissalWarning) { + smart_objects::SmartObject& notification = arg0; + + notification[application_manager::strings::msg_params] + [application_manager::mobile_notification:: + lock_screen_dismissal_warning] = lockScreenDismissalWarning; +} + +TEST_F(HMIOnDriverDistractionNotificationTest, + Run_SendNotificationToMobile_SUCCESS) { + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; + (*commands_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; NotificationPtr command( CreateCommand<OnDriverDistractionNotification>(commands_msg)); EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); - MockAppPtr mock_app = CreateMockApp(); - am::ApplicationSet app_set; - app_set.insert(mock_app); + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(true))); + + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_)) + .WillByDefault(Return(kLockScreenDismissalWarningMessage_en)); + + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcAllowed; + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); + + MessageSharedPtr message_to_mobile( + CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand( + CheckNotificationParams( + am::mobile_api::FunctionID::OnDriverDistractionID, state), + Command::CommandSource::SOURCE_SDL)) + .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true))); + command->Run(); + + ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists( + am::mobile_notification::lock_screen_dismissal_warning)); + + auto LSDW_message = + (*message_to_mobile) + [am::strings::msg_params] + [am::mobile_notification::lock_screen_dismissal_warning] + .asString(); + + EXPECT_EQ(kLockScreenDismissalWarningMessage_en, LSDW_message); +} + +TEST_F(HMIOnDriverDistractionNotificationTest, + Run_PushMobileMessage_If_DisallowedByPolicy) { + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; + MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); + (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; + (*commands_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + NotificationPtr command( + CreateCommand<OnDriverDistractionNotification>(commands_msg)); + + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(boost::optional<bool>(true))); + + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_)) + .WillByDefault(Return(kLockScreenDismissalWarningMessage_en)); - DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcDisallowed; - EXPECT_CALL(app_mngr_, GetPolicyHandler()) - .WillOnce(ReturnRef(mock_policy_handler_interface_)); - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(3); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); - EXPECT_CALL(*mock_app, + MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(*mock_app_, PushMobileMessage(CheckNotificationParams( - am::mobile_api::FunctionID::OnDriverDistractionID, state))); + am::mobile_api::FunctionID::OnDriverDistractionID, state))) + .WillOnce(SaveArg<0>(&pushed_message)); + EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); command->Run(); + + ASSERT_TRUE((*pushed_message)[am::strings::msg_params].keyExists( + am::mobile_notification::lock_screen_dismissal_warning)); + + auto lock_screen_dismissal_warning_message = + (*pushed_message)[am::strings::msg_params] + [am::mobile_notification::lock_screen_dismissal_warning] + .asString(); + + EXPECT_EQ(kLockScreenDismissalWarningMessage_en, + lock_screen_dismissal_warning_message); } TEST_F(HMIOnDriverDistractionNotificationTest, - Run_SendNotificationToMobile_SUCCESS) { - const hmi_apis::Common_DriverDistractionState::eType state = - hmi_apis::Common_DriverDistractionState::DD_ON; + Run_SendNotificationIfLockScreenDismissalMissed) { + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; NotificationPtr command( CreateCommand<OnDriverDistractionNotification>(commands_msg)); + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(boost::optional<bool>())); + + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcAllowed; + ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillByDefault(GetArg4(&result)); + + MessageSharedPtr command_result; + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)) + .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true))); + + command->Run(); + + auto& msg_params = + (*command_result)[application_manager::strings::msg_params]; + EXPECT_FALSE(msg_params.keyExists( + application_manager::mobile_notification::lock_screen_dismissal_enabled)); + EXPECT_FALSE(msg_params.keyExists( + application_manager::mobile_notification::lock_screen_dismissal_warning)); +} + +// LSDW - lock screen dimissal +TEST_F(HMIOnDriverDistractionNotificationTest, + Run_SendNotificationToMobile_LSDWMessageIsAbsent_SUCCESS) { + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; + MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); + (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; + (*commands_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + + NotificationPtr command( + CreateCommand<OnDriverDistractionNotification>(commands_msg)); + EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); - MockAppPtr mock_app = CreateMockApp(); - am::ApplicationSet app_set; - app_set.insert(mock_app); + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(false))); - DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_); - EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); + // LockScreenDismissalWarning won't be added to message if value of + // LockScreenDismissalEnabledState is false + std::string required_language = "en-us"; + EXPECT_CALL(mock_policy_handler_interface_, + LockScreenDismissalWarningMessage(required_language)) + .Times(0); policy::CheckPermissionResult result; result.hmi_level_permitted = policy::kRpcAllowed; - EXPECT_CALL(app_mngr_, GetPolicyHandler()) - .WillOnce(ReturnRef(mock_policy_handler_interface_)); - EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _)) - .WillOnce(GetArg3(&result)); + MessageSharedPtr message_to_mobile( + CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(2); + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( CheckNotificationParams( am::mobile_api::FunctionID::OnDriverDistractionID, state), - Command::CommandSource::SOURCE_SDL)); - + Command::CommandSource::SOURCE_SDL)) + .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true))); command->Run(); + + EXPECT_FALSE((*message_to_mobile)[am::strings::msg_params].keyExists( + am::mobile_notification::lock_screen_dismissal_warning)); } -} // on_driver_distraction_notification +TEST_F(HMIOnDriverDistractionNotificationTest, + Run_SendNotificationToMobile_SpecifiedLanguageIsAbsent_SUCCESS) { + const auto state = hmi_apis::Common_DriverDistractionState::DD_ON; + MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map)); + (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state; + (*commands_msg)[am::strings::params][am::strings::connection_key] = + kConnectionKey; + + NotificationPtr command( + CreateCommand<OnDriverDistractionNotification>(commands_msg)); + + EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state))); + + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState()) + .WillByDefault(Return(OptionalBool(true))); + + ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_)) + .WillByDefault(Return(kLockScreenDismissalWarningMessage_en)); + + // In case when specified language is absent in policy table, will added + // message on default language (en-us) + const mobile_apis::Language::eType mobile_language = + mobile_apis::Language::FR_FR; + std::string required_language = "FR-FR"; + ON_CALL(*mock_app_, ui_language()).WillByDefault(ReturnRef(mobile_language)); + ON_CALL(mock_message_helper_, MobileLanguageToString(mobile_language)) + .WillByDefault(Return(required_language)); + + policy::CheckPermissionResult result; + result.hmi_level_permitted = policy::kRpcAllowed; + EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _)) + .WillOnce(GetArg4(&result)); + + MessageSharedPtr message_to_mobile( + CreateMessage(smart_objects::SmartType_Map)); + EXPECT_CALL(mock_rpc_service_, + ManageMobileCommand( + CheckNotificationParams( + am::mobile_api::FunctionID::OnDriverDistractionID, state), + Command::CommandSource::SOURCE_SDL)) + .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true))); + command->Run(); + + ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists( + am::mobile_notification::lock_screen_dismissal_warning)); + + auto lock_screen_dismissal_warning_message = + (*message_to_mobile) + [am::strings::msg_params] + [am::mobile_notification::lock_screen_dismissal_warning] + .asString(); + + EXPECT_EQ(kLockScreenDismissalWarningMessage_en, + lock_screen_dismissal_warning_message); +} +} // namespace on_driver_distraction_notification } // namespace hmi_commands_test } // namespace commands_test } // namespace components diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc index 339a749909..a9bc97f842 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/get_urls_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_service_status_update_notification_test.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Ford Motor Company + * Copyright (c) 2019, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,59 +29,67 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - #include <stdint.h> -#include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/command.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/application.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" -#include "application_manager/commands/response_to_hmi.h" -#include "hmi/get_urls_response.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/on_service_update_notification.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { namespace commands_test { namespace hmi_commands_test { -namespace get_urls_response { +namespace on_service_update_notification { -using ::testing::_; -using ::testing::Return; -namespace am = ::application_manager; -namespace strings = ::application_manager::strings; -using sdl_rpc_plugin::commands::GetUrlsResponse; -using am::commands::ResponseToHMI; -using am::commands::CommandImpl; +using namespace application_manager; +using sdl_rpc_plugin::commands::hmi::OnServiceUpdateNotification; -typedef std::shared_ptr<ResponseToHMI> ResponseToHMIPtr; +typedef std::shared_ptr<OnServiceUpdateNotification> NotificationPtr; +typedef hmi_apis::Common_ServiceType::eType ServiceType; +typedef hmi_apis::Common_ServiceEvent::eType ServiceEvent; namespace { -const uint32_t kConnectionKey = 2u; +const uint32_t kConnectionKey = 1232u; +const uint32_t kHmi_app_id = 321u; } // namespace -class GetUrlResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {}; +class OnServiceUpdateNotificationTest + : public CommandsTest<CommandsTestMocks::kIsNice> { + public: + OnServiceUpdateNotificationTest() + : message_(CreateMessage(smart_objects::SmartType_Map)) {} + + public: + MessageSharedPtr message_; + NotificationPtr command_; +}; + +TEST_F(OnServiceUpdateNotificationTest, SendNotificationToHMI) { + (*message_)[strings::msg_params][hmi_notification::service_type] = + ServiceType::AUDIO; + (*message_)[strings::msg_params][hmi_notification::service_event] = + ServiceEvent::REQUEST_ACCEPTED; + (*message_)[strings::msg_params][strings::app_id] = kConnectionKey; + command_ = CreateCommand<OnServiceUpdateNotification>(message_); + + EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(message_)).Times(1); -TEST_F(GetUrlResponseTest, RUN_SendRequest_SUCCESS) { - MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); - (*command_msg)[strings::msg_params][strings::number] = "123"; - (*command_msg)[strings::params][strings::connection_key] = kConnectionKey; + auto mock_app = std::make_shared<NiceMock<MockApplication> >(); - ResponseToHMIPtr command(CreateCommand<GetUrlsResponse>(command_msg)); - EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(command_msg)); + ON_CALL(app_mngr_, application(kConnectionKey)) + .WillByDefault(Return(mock_app)); - command->Run(); + ON_CALL(*mock_app, hmi_app_id()).WillByDefault(Return(kHmi_app_id)); - EXPECT_EQ((*command_msg)[strings::params][strings::protocol_type].asInt(), - CommandImpl::hmi_protocol_type_); - EXPECT_EQ((*command_msg)[strings::params][strings::protocol_version].asInt(), - CommandImpl::protocol_version_); + command_->Init(); + command_->Run(); } -} // namespace get_urls_response +} // namespace on_service_update_notification } // namespace hmi_commands_test } // namespace commands_test } // namespace components diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc index 2d50ec2b72..f9dbbf259f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_system_time_ready_notification_test.cc @@ -30,12 +30,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "application_manager/commands/commands_test.h" #include "hmi/on_system_time_ready_notification.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_event_dispatcher.h" #include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "interfaces/HMI_API.h" namespace test { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc index 8e62c1a409..67c36dce9c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc @@ -34,13 +34,13 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/commands/command_impl.h" #include "hmi/rc_get_capabilities_response.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -52,8 +52,8 @@ using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; namespace hmi_response = am::hmi_response; -using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse; using am::commands::CommandImpl; +using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse; typedef std::shared_ptr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr; typedef NiceMock< @@ -139,6 +139,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) { radio_control_capability["hdChannelAvailable"] = true; radio_control_capability["rdsDataAvailable"] = true; radio_control_capability["availableHDsAvailable"] = true; + radio_control_capability["availableHdChannelsAvailable"] = true; radio_control_capability["stateAvailable"] = true; radio_control_capability["signalStrengthAvailable"] = true; radio_control_capability["signalChangeThresholdAvailable"] = true; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc index c7fbdb663b..539c0efeb3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_request_test.cc @@ -34,15 +34,15 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" +#include "application_manager/event_engine/event.h" #include "application_manager/hmi_interfaces.h" -#include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/mock_hmi_interface.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/event_engine/event.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -54,8 +54,8 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::RCIsReadyRequest; using am::event_engine::Event; +using sdl_rpc_plugin::commands::RCIsReadyRequest; typedef std::shared_ptr<RCIsReadyRequest> RCIsReadyRequestPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc index a1a8c1c87e..4224e82b5f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_is_ready_response_test.cc @@ -35,11 +35,11 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "hmi/rc_is_ready_response.h" -#include "application_manager/mock_event_dispatcher.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc index 25abefb010..3e7e6e6f59 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/response_from_hmi_test.cc @@ -32,24 +32,24 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" +#include "application_manager/commands/command.h" +#include "application_manager/commands/response_from_hmi.h" #include "application_manager/smart_object_keys.h" #include "application_manager/test/include/application_manager/commands/commands_test.h" -#include "application_manager/commands/command.h" #include "application_manager/test/include/application_manager/mock_event_dispatcher.h" -#include "application_manager/commands/response_from_hmi.h" +#include "gtest/gtest.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { namespace commands_test { namespace hmi_commands_test { namespace response_from_hmi { +using ::test::components::event_engine_test::MockEventDispatcher; using ::testing::_; +using ::testing::DoAll; using ::testing::Return; using ::testing::SaveArg; -using ::testing::DoAll; -using ::test::components::event_engine_test::MockEventDispatcher; namespace am = ::application_manager; using application_manager::commands::ResponseFromHMI; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc index 917de81fb3..93344f1a0d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_request_test.cc @@ -32,19 +32,19 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "utils/lock.h" -#include "utils/helpers.h" -#include "hmi/sdl_activate_app_request.h" -#include "application_manager/mock_application.h" #include "application_manager/application_manager.h" -#include "application_manager/policies/mock_policy_handler_interface.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_message_helper.h" #include "application_manager/event_engine/event.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_message_helper.h" #include "application_manager/mock_state_controller.h" +#include "application_manager/policies/mock_policy_handler_interface.h" #include "connection_handler/mock_connection_handler.h" +#include "gtest/gtest.h" +#include "hmi/sdl_activate_app_request.h" +#include "utils/helpers.h" +#include "utils/lock.h" namespace test { namespace components { @@ -55,18 +55,17 @@ namespace sdl_activate_app_request { namespace am = ::application_manager; namespace strings = am::strings; namespace hmi_response = am::hmi_response; +using am::ApplicationSet; using am::commands::MessageSharedPtr; +using am::event_engine::Event; +using connection_handler_test::MockConnectionHandler; +using policy_test::MockPolicyHandlerInterface; using sdl_rpc_plugin::commands::SDLActivateAppRequest; -using am::ApplicationSet; +using testing::Gt; using testing::Mock; +using ::testing::NiceMock; using testing::Return; using testing::ReturnRef; -using testing::Mock; -using testing::Gt; -using ::testing::NiceMock; -using policy_test::MockPolicyHandlerInterface; -using connection_handler_test::MockConnectionHandler; -using am::event_engine::Event; namespace { const uint32_t kCorrelationID = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc index bca316bcfa..b35ccde314 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_activate_app_response_test.cc @@ -33,12 +33,12 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/sdl_activate_app_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -48,8 +48,8 @@ namespace sdl_activate_app_response { namespace am = ::application_manager; namespace strings = ::application_manager::strings; -using sdl_rpc_plugin::commands::SDLActivateAppResponse; using am::commands::CommandImpl; +using sdl_rpc_plugin::commands::SDLActivateAppResponse; typedef std::shared_ptr<SDLActivateAppResponse> SDLActivateAppResponsePtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc index 262ac5fc7d..c8cc4bb18c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_list_of_permisssions_request_test.cc @@ -32,11 +32,11 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "hmi/sdl_get_list_of_permissions_request.h" +#include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/commands/command_request_test.h" +#include "gtest/gtest.h" +#include "hmi/sdl_get_list_of_permissions_request.h" namespace test { namespace components { @@ -46,8 +46,8 @@ namespace sdl_get_list_of_permissions_request { using application_manager::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::SDLGetListOfPermissionsRequest; -using test::components::policy_test::MockPolicyHandlerInterface; using smart_objects::SmartObject; +using test::components::policy_test::MockPolicyHandlerInterface; using testing::Return; using testing::ReturnRef; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc new file mode 100644 index 0000000000..8e802bbd7d --- /dev/null +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_policy_configuration_data_request_test.cc @@ -0,0 +1,180 @@ +/* + * Copyright (c) 2019, Ford Motor Company + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following + * disclaimer in the documentation and/or other materials provided with the + * distribution. + * + * Neither the name of the Ford Motor Company nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include "hmi/sdl_get_policy_configuration_data_request.h" +#include "application_manager/commands/command_request_test.h" +#include "gtest/gtest.h" +#include "smart_objects/smart_object.h" + +namespace test { +namespace components { +namespace commands_test { +namespace hmi_commands_test { +namespace sdl_get_policy_configuration_data_request { + +using testing::Return; + +using sdl_rpc_plugin::commands::SDLGetPolicyConfigurationDataRequest; +using test::components::policy_test::MockPolicyHandlerInterface; + +namespace strings = ::app_mngr::strings; +namespace hmi_response = ::app_mngr::hmi_response; + +class SDLGetPolicyConfigurationDataRequestTest + : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; + +MATCHER_P(GetPolicyConfigurationDataFirstElementMatches, + string_first_element_value, + "") { + auto message = static_cast<smart_objects::SmartObject>(*arg); + if (!message.keyExists(strings::msg_params) || + !message[strings::msg_params].keyExists(strings::value)) { + return false; + } + + if (message[strings::msg_params][strings::value].getType() != + smart_objects::SmartType::SmartType_Array || + message[strings::msg_params][strings::value].empty()) { + return false; + } + + Json::Reader reader; + Json::Value msg_json_value(Json::ValueType::arrayValue); + + auto msg_value_first = message[strings::msg_params][strings::value][0]; + return msg_value_first.asString() == string_first_element_value; +} + +MATCHER_P(HMIResultCodeIs, result_code, "") { + return result_code == + static_cast<hmi_apis::Common_Result::eType>( + (*arg)[strings::params][hmi_response::code].asInt()); +} + +TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Fail_DataNotAvailable) { + std::string kInvalidKey = "invalid_key"; + + PolicyTable pt; + ON_CALL(mock_policy_handler_, GetPolicyTableData()) + .WillByDefault(Return(pt.ToJsonValue())); + + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::msg_params][strings::policy_type] = kInvalidKey; + (*msg)[strings::msg_params][strings::property] = kInvalidKey; + + std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command( + CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg)); + + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand( + HMIResultCodeIs(hmi_apis::Common_Result::DATA_NOT_AVAILABLE), + Command::SOURCE_SDL_TO_HMI)); + + command->Run(); +} + +void clear_new_line_symbol(std::string& str_to_clear) { + str_to_clear.erase( + std::remove_if(str_to_clear.begin(), + str_to_clear.end(), + [](char character) { return '\n' == character; }), + str_to_clear.end()); +} + +TEST_F(SDLGetPolicyConfigurationDataRequestTest, Run_Success) { + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::msg_params][strings::policy_type] = "module_config"; + (*msg)[strings::msg_params][strings::property] = "endpoints"; + + std::shared_ptr<SDLGetPolicyConfigurationDataRequest> command( + CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg)); + + policy_table::ModuleConfig module_config_with_endpoints; + policy_table::URLList endpoint_url_list; + policy_table::URL urls; + urls.push_back("https://url1.com"); + urls.push_back("https://url2.com"); + endpoint_url_list["default"] = urls; + module_config_with_endpoints.endpoints["0x9"] = endpoint_url_list; + + PolicyTable pt; + pt.mark_initialized(); + pt.module_config.mark_initialized(); + pt.module_config = module_config_with_endpoints; + + ON_CALL(mock_policy_handler_, GetPolicyTableData()) + .WillByDefault(Return(pt.ToJsonValue())); + + auto json_val = module_config_with_endpoints.endpoints.ToJsonValue(); + Json::FastWriter writer; + std::string expected_string = writer.write(json_val); + clear_new_line_symbol(expected_string); + + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches( + expected_string), + Command::SOURCE_SDL_TO_HMI)); + command->Run(); +} + +TEST_F(SDLGetPolicyConfigurationDataRequestTest, + Run_RetriveStringValueFromPolicy) { + MessageSharedPtr msg = CreateMessage(); + (*msg)[strings::msg_params][strings::policy_type] = + "consumer_friendly_messages"; + (*msg)[strings::msg_params][strings::property] = "version"; + + auto command = CreateCommand<SDLGetPolicyConfigurationDataRequest>(msg); + + const std::string version_test_value("version string"); + PolicyTable pt; + pt.mark_initialized(); + pt.consumer_friendly_messages->mark_initialized(); + pt.consumer_friendly_messages->version = + rpc::String<1, 100>(version_test_value); + + ON_CALL(mock_policy_handler_, GetPolicyTableData()) + .WillByDefault(Return(pt.ToJsonValue())); + + EXPECT_CALL(mock_rpc_service_, + ManageHMICommand(GetPolicyConfigurationDataFirstElementMatches( + version_test_value), + Command::SOURCE_SDL_TO_HMI)); + + command->Run(); +} + +} // namespace sdl_get_policy_configuration_data_request +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc index fca8ed840f..021dfc8b1d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_status_update_request_test.cc @@ -32,11 +32,11 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "hmi/sdl_get_status_update_request.h" +#include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/commands/command_request_test.h" +#include "gtest/gtest.h" +#include "hmi/sdl_get_status_update_request.h" namespace test { namespace components { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc index b040f8ea40..5cac1c823f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc @@ -34,15 +34,15 @@ #include <string> #include <vector> -#include "gtest/gtest.h" -#include "hmi/sdl_get_user_friendly_message_request.h" +#include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/mock_message_helper.h" #include "application_manager/mock_state_controller.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/mock_message_helper.h" -#include "application_manager/mock_hmi_capabilities.h" +#include "gtest/gtest.h" +#include "hmi/sdl_get_user_friendly_message_request.h" #include "smart_objects/smart_object.h" -#include "application_manager/commands/command_request_test.h" namespace test { namespace components { @@ -50,11 +50,11 @@ namespace commands_test { namespace hmi_commands_test { namespace sdl_get_user_friendly_message_request { +using application_manager::MockMessageHelper; using application_manager::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::SDLGetUserFriendlyMessageRequest; -using application_manager::MockMessageHelper; -using test::components::policy_test::MockPolicyHandlerInterface; using test::components::application_manager_test::MockHMICapabilities; +using test::components::policy_test::MockPolicyHandlerInterface; using testing::_; using testing::Return; using testing::ReturnRef; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc index 581913d3a5..57bb018273 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_notifications_test.cc @@ -34,8 +34,8 @@ #include "application_manager/commands/commands_test.h" -#include "application_manager/commands/notification_to_hmi.h" #include "application_manager/commands/command_notification_impl.h" +#include "application_manager/commands/notification_to_hmi.h" namespace test { namespace components { @@ -45,8 +45,8 @@ namespace simple_notifications_test { using namespace application_manager; -using ::testing::Types; using commands::NotificationToHMI; +using ::testing::Types; template <typename Command> class SimpleNotificationsTest : public CommandsTest<CommandsTestMocks::kIsNice> { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc index a69f6c71fc..fc2cd1cca4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_request_from_hmi_test.cc @@ -30,14 +30,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/commands/command.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/request_from_hmi.h" #include "application_manager/event_engine/event.h" #include "application_manager/mock_event_dispatcher.h" -#include "application_manager/commands/request_from_hmi.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -46,12 +46,12 @@ namespace hmi_commands_test { namespace simple_requests_from_hmi_test { using ::testing::_; -using ::testing::Types; -using ::testing::NotNull; using ::testing::NiceMock; +using ::testing::NotNull; +using ::testing::Types; namespace commands = ::application_manager::commands; -using commands::MessageSharedPtr; using ::application_manager::event_engine::EventObserver; +using commands::MessageSharedPtr; using ::test::components::event_engine_test::MockEventDispatcher; class RequestFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> { @@ -89,7 +89,7 @@ TEST_F(RequestFromHMITest, SendResponse_SUCCESS) { hmi_apis::Common_Result::SUCCESS); } -} // namespace simple_requests_to_hmi_test +} // namespace simple_requests_from_hmi_test } // namespace hmi_commands_test } // namespace commands_test } // namespace components diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc index 599c7e50f2..162e832e9f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_requests_to_hmi_test.cc @@ -30,16 +30,18 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/commands/command_request_test.h" #include "application_manager/commands/command.h" -#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h" +#include "application_manager/commands/command_request_test.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/request_to_hmi.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h" +#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h" #include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h" #include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h" +#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h" +#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h" #include "sdl_rpc_plugin/commands/hmi/navi_alert_maneuver_request.h" #include "sdl_rpc_plugin/commands/hmi/navi_audio_stop_stream_request.h" #include "sdl_rpc_plugin/commands/hmi/navi_get_way_points_request.h" @@ -53,21 +55,15 @@ #include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h" -#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h" -#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h" -#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h" -#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h" -#include "application_manager/commands/request_to_hmi.h" -#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h" +#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h" +#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h" +#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h" +#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h" +#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h" #include "sdl_rpc_plugin/commands/hmi/tts_is_ready_request.h" #include "sdl_rpc_plugin/commands/hmi/tts_set_global_properties_request.h" #include "sdl_rpc_plugin/commands/hmi/tts_speak_request.h" #include "sdl_rpc_plugin/commands/hmi/tts_stop_speaking_request.h" -#include "sdl_rpc_plugin/commands/hmi/tts_get_supported_languages_request.h" -#include "sdl_rpc_plugin/commands/hmi/tts_change_registration_request.h" -#include "sdl_rpc_plugin/commands/hmi/tts_get_capabilities_request.h" -#include "sdl_rpc_plugin/commands/hmi/tts_get_language_request.h" -#include "sdl_rpc_plugin/commands/hmi/close_popup_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_add_command_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_add_submenu_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_alert_request.h" @@ -81,6 +77,11 @@ #include "sdl_rpc_plugin/commands/hmi/ui_is_ready_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_perform_audio_pass_thru_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_perform_interaction_request.h" +#include "sdl_rpc_plugin/commands/hmi/ui_scrollable_message_request.h" +#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h" +#include "sdl_rpc_plugin/commands/hmi/ui_set_app_icon_request.h" +#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h" +#include "sdl_rpc_plugin/commands/hmi/ui_set_global_properties_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_set_media_clock_timer_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_show_request.h" #include "sdl_rpc_plugin/commands/hmi/ui_slider_request.h" @@ -88,23 +89,11 @@ #include "sdl_rpc_plugin/commands/hmi/vr_change_registration_request.h" #include "sdl_rpc_plugin/commands/hmi/vr_delete_command_request.h" #include "sdl_rpc_plugin/commands/hmi/vr_get_capabilities_request.h" -#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h" #include "sdl_rpc_plugin/commands/hmi/vr_get_language_request.h" +#include "sdl_rpc_plugin/commands/hmi/vr_get_supported_languages_request.h" #include "sdl_rpc_plugin/commands/hmi/vr_is_ready_request.h" #include "sdl_rpc_plugin/commands/hmi/vr_perform_interaction_request.h" -#include "sdl_rpc_plugin/commands/hmi/allow_all_apps_request.h" -#include "sdl_rpc_plugin/commands/hmi/basic_communication_system_request.h" -#include "sdl_rpc_plugin/commands/hmi/button_get_capabilities_request.h" -#include "sdl_rpc_plugin/commands/hmi/allow_app_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_send_location_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_unsubscribe_way_points_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_update_turn_list_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_show_constant_tbt_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_stop_stream_request.h" -#include "sdl_rpc_plugin/commands/hmi/navi_subscribe_way_points_request.h" -#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h" -#include "sdl_rpc_plugin/commands/hmi/dial_number_request.h" -#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h" +#include "smart_objects/smart_object.h" #include "application_manager/mock_event_dispatcher.h" @@ -115,8 +104,8 @@ namespace hmi_commands_test { namespace simple_requests_to_hmi_test { using ::testing::_; -using ::testing::Types; using ::testing::NotNull; +using ::testing::Types; namespace am_commands = application_manager::commands; using am_commands::MessageSharedPtr; using event_engine_test::MockEventDispatcher; @@ -221,7 +210,8 @@ typedef Types<sdl_rpc_plugin::commands::UIScrollableMessageRequest, typedef Types<sdl_rpc_plugin::commands::TTSIsReadyRequest, sdl_rpc_plugin::commands::UIIsReadyRequest, sdl_rpc_plugin::commands::NaviIsReadyRequest, - sdl_rpc_plugin::commands::VRIsReadyRequest> RequestCommandsList3; + sdl_rpc_plugin::commands::VRIsReadyRequest> + RequestCommandsList3; TYPED_TEST_CASE(RequestToHMICommandsTest, RequestCommandsList); TYPED_TEST_CASE(RequestToHMICommandsTest2, RequestCommandsList2); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc index 4f415975ba..f232240c28 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_from_hmi_test.cc @@ -32,13 +32,18 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/commands/command.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/notification_from_hmi.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/activate_app_response.h" #include "hmi/basic_communication_system_response.h" +#include "hmi/close_popup_response.h" +#include "hmi/dial_number_response.h" #include "hmi/navi_alert_maneuver_response.h" #include "hmi/navi_audio_start_stream_response.h" #include "hmi/navi_audio_stop_stream_response.h" @@ -50,20 +55,13 @@ #include "hmi/navi_subscribe_way_points_response.h" #include "hmi/navi_unsubscribe_way_points_response.h" #include "hmi/navi_update_turn_list_response.h" +#include "hmi/on_find_applications.h" +#include "hmi/on_update_device_list.h" +#include "hmi/sdl_policy_update_response.h" #include "hmi/tts_change_registration_response.h" -#include "hmi/ui_set_app_icon_response.h" -#include "hmi/ui_set_display_layout_response.h" -#include "hmi/ui_set_global_properties_response.h" -#include "hmi/ui_scrollable_message_response.h" -#include "application_manager/mock_event_dispatcher.h" -#include "application_manager/mock_hmi_capabilities.h" -#include "application_manager/policies/mock_policy_handler_interface.h" -#include "hmi/dial_number_response.h" -#include "hmi/close_popup_response.h" #include "hmi/tts_set_global_properties_response.h" #include "hmi/tts_speak_response.h" #include "hmi/tts_stop_speaking_response.h" -#include "hmi/tts_change_registration_response.h" #include "hmi/ui_add_command_response.h" #include "hmi/ui_add_submenu_response.h" #include "hmi/ui_alert_response.h" @@ -73,28 +71,21 @@ #include "hmi/ui_end_audio_pass_thru_response.h" #include "hmi/ui_perform_audio_pass_thru_response.h" #include "hmi/ui_perform_interaction_response.h" +#include "hmi/ui_scrollable_message_response.h" +#include "hmi/ui_send_haptic_data_response.h" +#include "hmi/ui_set_app_icon_response.h" +#include "hmi/ui_set_display_layout_response.h" +#include "hmi/ui_set_global_properties_response.h" #include "hmi/ui_set_media_clock_timer_response.h" #include "hmi/ui_show_response.h" #include "hmi/ui_slider_response.h" +#include "hmi/update_app_list_response.h" +#include "hmi/update_device_list_response.h" #include "hmi/vr_add_command_response.h" #include "hmi/vr_change_registration_response.h" #include "hmi/vr_delete_command_response.h" #include "hmi/vr_perform_interaction_response.h" -#include "hmi/activate_app_response.h" -#include "hmi/basic_communication_system_response.h" -#include "hmi/navi_unsubscribe_way_points_response.h" -#include "hmi/navi_update_turn_list_response.h" -#include "hmi/navi_send_location_response.h" -#include "hmi/navi_show_constant_tbt_response.h" -#include "hmi/navi_start_stream_response.h" -#include "hmi/navi_subscribe_way_points_response.h" -#include "hmi/on_find_applications.h" -#include "hmi/on_update_device_list.h" -#include "hmi/sdl_policy_update_response.h" -#include "hmi/update_app_list_response.h" -#include "hmi/update_device_list_response.h" -#include "application_manager/commands/notification_from_hmi.h" -#include "hmi/ui_send_haptic_data_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -102,12 +93,12 @@ namespace commands_test { namespace hmi_commands_test { namespace simple_response_from_hmi_test { +using ::test::components::event_engine_test::MockEventDispatcher; using ::testing::_; +using ::testing::Eq; using ::testing::Return; using ::testing::ReturnRef; using ::testing::Types; -using ::testing::Eq; -using ::test::components::event_engine_test::MockEventDispatcher; namespace am = ::application_manager; namespace commands = sdl_rpc_plugin::commands; @@ -218,7 +209,8 @@ typedef Types< CommandData<sdl_rpc_plugin::commands::UIScrollableMessageResponse, hmi_apis::FunctionID::UI_ScrollableMessage>, CommandData<sdl_rpc_plugin::commands::UISendHapticDataResponse, - hmi_apis::FunctionID::UI_SendHapticData> > ResponseCommandsList; + hmi_apis::FunctionID::UI_SendHapticData> > + ResponseCommandsList; typedef Types<sdl_rpc_plugin::commands::AudioStopStreamResponse, sdl_rpc_plugin::commands::NaviStopStreamResponse, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc index 643e21d818..910c3f2873 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/simple_response_to_hmi_test.cc @@ -30,16 +30,16 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/commands/response_to_hmi.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "sdl_rpc_plugin/commands/hmi/sdl_activate_app_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_list_of_permissions_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_status_update_response.h" #include "sdl_rpc_plugin/commands/hmi/sdl_get_user_friendly_message_response.h" -#include "application_manager/commands/response_to_hmi.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -48,8 +48,8 @@ namespace hmi_commands_test { namespace simple_response_to_hmi_test { using ::testing::_; -using ::testing::Types; using ::testing::NotNull; +using ::testing::Types; namespace commands = sdl_rpc_plugin::commands; using application_manager::commands::MessageSharedPtr; @@ -63,7 +63,8 @@ class ResponseToHMICommandsTest typedef Types<commands::SDLActivateAppResponse, commands::SDLGetListOfPermissionsResponse, commands::SDLGetStatusUpdateResponse, - commands::SDLGetUserFriendlyMessageResponse> ResponseCommandsList; + commands::SDLGetUserFriendlyMessageResponse> + ResponseCommandsList; TYPED_TEST_CASE(ResponseToHMICommandsTest, ResponseCommandsList); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc index bc9d262e6d..c7b96f1acf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_capabilities_response_test.cc @@ -32,11 +32,11 @@ #include <string> +#include "application_manager/commands/commands_test.h" +#include "application_manager/mock_hmi_capabilities.h" #include "gtest/gtest.h" #include "hmi/tts_get_capabilities_response.h" -#include "application_manager/mock_hmi_capabilities.h" #include "smart_objects/smart_object.h" -#include "application_manager/commands/commands_test.h" namespace test { namespace components { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc index 0d22500f48..c0d23cb34b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_language_response_test.cc @@ -30,13 +30,12 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/tts_get_language_response.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_event_dispatcher.h" -#include "application_manager/commands/commands_test.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" namespace test { namespace components { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc index 417b8e1898..c0f187a85f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_get_supported_languages_response_test.cc @@ -33,17 +33,17 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/response_from_hmi.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/commands/response_from_hmi.h" -#include "hmi/tts_get_supported_languages_response.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/tts_get_supported_languages_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -52,14 +52,14 @@ namespace hmi_commands_test { namespace tts_get_supported_languages_response { using ::testing::_; -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; +using am::commands::CommandImpl; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesResponse; -using am::commands::CommandImpl; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< @@ -113,7 +113,8 @@ TEST_F(TTSGetSupportedLanguageResponseTest, RUN_UNSUCCESS) { CreateCommand<TTSGetSupportedLanguagesResponse>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, - set_tts_supported_languages(supported_languages)).Times(0); + set_tts_supported_languages(supported_languages)) + .Times(0); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc index 2fae8a6819..a2f4440c86 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/tts_is_ready_response_test.cc @@ -33,18 +33,18 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/commands/response_from_hmi.h" +#include "application_manager/mock_application_manager.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/mock_application_manager.h" -#include "application_manager/commands/response_from_hmi.h" -#include "hmi/tts_is_ready_response.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/tts_is_ready_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -53,14 +53,14 @@ namespace hmi_commands_test { namespace tts_is_ready_response { using ::testing::_; -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; +using am::commands::CommandImpl; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::TTSIsReadyResponse; -using am::commands::CommandImpl; using test::components::event_engine_test::MockEventDispatcher; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc index 31e4860d4a..4683fc62c7 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc @@ -32,14 +32,14 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/commands/command_impl.h" +#include "gtest/gtest.h" #include "hmi/ui_get_capabilities_response.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -51,9 +51,9 @@ using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; namespace hmi_response = am::hmi_response; +using am::commands::CommandImpl; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::UIGetCapabilitiesResponse; -using am::commands::CommandImpl; typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< @@ -113,8 +113,9 @@ TEST_F(UIGetCapabilitiesResponseTest, SetSoftButton_SUCCESS) { ResponseFromHMIPtr command( CreateCommand<UIGetCapabilitiesResponse>(command_msg)); - smart_objects::SmartObject soft_button_capabilities_so = (*command_msg) - [strings::msg_params][hmi_response::soft_button_capabilities]; + smart_objects::SmartObject soft_button_capabilities_so = + (*command_msg)[strings::msg_params] + [hmi_response::soft_button_capabilities]; EXPECT_CALL(mock_hmi_capabilities_, set_soft_button_capabilities(soft_button_capabilities_so)); @@ -144,16 +145,48 @@ TEST_F(UIGetCapabilitiesResponseTest, SetHmiZone_SUCCESS) { TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) { MessageSharedPtr command_msg = CreateCommandMsg(); (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + smart_objects::SmartObject audio_pass_thru_capabilities_so = + (*command_msg)[strings::msg_params] + [strings::audio_pass_thru_capabilities]; + + // hmi_capabilities will receive a list of capabilities, the first element + // being audio_pass_thru_capabilities_so + smart_objects::SmartObject audio_pass_thru_capabilities_list_so = + smart_objects::SmartObject(smart_objects::SmartType_Array); + audio_pass_thru_capabilities_list_so[0] = audio_pass_thru_capabilities_so; + EXPECT_CALL( + mock_hmi_capabilities_, + set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so)); + + command->Run(); +} + +TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + + // if both audioPassThruCapabilities and audioPassThruCapabilitiesList are + // supplied, audioPassThruCapabilitiesList should be used + smart_objects::SmartObject audio_pass_thru_capabilities_so = + smart_objects::SmartObject(smart_objects::SmartType_Map); + smart_objects::SmartObject audio_pass_thru_capabilities_list_so = smart_objects::SmartObject(smart_objects::SmartType_Array); + (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] = + audio_pass_thru_capabilities_so; + (*command_msg)[strings::msg_params] + [strings::audio_pass_thru_capabilities_list] = + audio_pass_thru_capabilities_list_so; ResponseFromHMIPtr command( CreateCommand<UIGetCapabilitiesResponse>(command_msg)); - smart_objects::SmartObject audio_pass_thru_capabilities_so = (*command_msg) - [strings::msg_params][strings::audio_pass_thru_capabilities]; EXPECT_CALL( mock_hmi_capabilities_, - set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_so)); + set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so)); command->Run(); } @@ -277,7 +310,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { video_streaming_capability[strings::preferred_resolution] [strings::resolution_width] = 800; video_streaming_capability[strings::preferred_resolution] - [strings::resolution_height] = 350; + [strings::resolution_height] = 354; video_streaming_capability[strings::max_bitrate] = 10000; @@ -295,6 +328,12 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { video_streaming_capability[strings::haptic_spatial_data_supported] = true; + video_streaming_capability[strings::diagonal_screen_size] = 7.47; + + video_streaming_capability[strings::pixel_per_inch] = 117.f; + + video_streaming_capability[strings::scale] = 1.f; + ResponseFromHMIPtr command( CreateCommand<UIGetCapabilitiesResponse>(command_msg)); @@ -304,6 +343,25 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) { command->Run(); } +TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) { + MessageSharedPtr command_msg = CreateCommandMsg(); + (*command_msg)[strings::msg_params][strings::system_capabilities] = + smart_objects::SmartObject(smart_objects::SmartType_Map); + + ResponseFromHMIPtr command( + CreateCommand<UIGetCapabilitiesResponse>(command_msg)); + + const auto& display_capability_so = + (*command_msg)[strings::msg_params][strings::system_capabilities] + [strings::display_capabilities]; + + EXPECT_CALL(mock_hmi_capabilities_, + set_system_display_capabilities(display_capability_so)); + + ASSERT_TRUE(command->Init()); + command->Run(); +} + } // namespace ui_get_capabilities_response } // namespace hmi_commands_test } // namespace commands_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc index de69c5de5c..7e8040543d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_language_response_test.cc @@ -30,13 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/ui_get_language_response.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/mock_hmi_capabilities.h" -#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_application_manager.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" namespace test { namespace components { @@ -47,8 +47,8 @@ namespace ui_get_language_response { using sdl_rpc_plugin::commands::UIGetLanguageResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; -using testing::ReturnRef; using ::testing::NiceMock; +using testing::ReturnRef; namespace strings = application_manager::strings; namespace hmi_response = application_manager::hmi_response; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc index 5626e2b0ee..10cf244bcf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_supported_languages_response_test.cc @@ -33,15 +33,15 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/application.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_application_manager.h" -#include "hmi/ui_get_supported_languages_response.h" +#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/ui_get_supported_languages_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -49,8 +49,8 @@ namespace commands_test { namespace hmi_commands_test { namespace ui_get_supported_languages_response { -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; @@ -107,7 +107,8 @@ TEST_F(UIGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) { CreateCommand<UIGetSupportedLanguagesResponse>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, - set_ui_supported_languages(supported_languages)).Times(0); + set_ui_supported_languages(supported_languages)) + .Times(0); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc index 70fc80bbd1..837b8438dc 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_request_test.cc @@ -34,16 +34,16 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" +#include "application_manager/event_engine/event.h" #include "application_manager/hmi_interfaces.h" -#include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" -#include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/mock_hmi_interface.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/event_engine/event.h" +#include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -53,12 +53,12 @@ namespace ui_is_ready_request { namespace am = ::application_manager; +using am::commands::MessageSharedPtr; +using am::event_engine::Event; +using sdl_rpc_plugin::commands::UIIsReadyRequest; using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::UIIsReadyRequest; -using am::event_engine::Event; typedef std::shared_ptr<UIIsReadyRequest> UIIsReadyRequestPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc index cccdbdc44d..44b9504055 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_is_ready_response_test.cc @@ -33,12 +33,12 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" +#include "gtest/gtest.h" #include "hmi/ui_is_ready_response.h" -#include "application_manager/mock_event_dispatcher.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -46,8 +46,8 @@ namespace commands_test { namespace hmi_commands_test { namespace ui_is_ready_response { -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc index c566702998..31c03a7ed5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_device_list_request_test.cc @@ -32,20 +32,20 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "interfaces/HMI_API.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/commands/command_impl.h" #include "application_manager/application_manager.h" #include "application_manager/application_manager_impl.h" -#include "application_manager/mock_event_dispatcher.h" -#include "application_manager/mock_application.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/event_engine/event.h" -#include "application_manager/request_controller_settings.h" +#include "application_manager/mock_application.h" #include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/request_controller_settings.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/update_device_list_request.h" +#include "interfaces/HMI_API.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -53,18 +53,18 @@ namespace commands_test { namespace hmi_commands_test { namespace update_device_list_request { -using testing::_; -using testing::ReturnRef; -using testing::Return; -using test::components::event_engine_test::MockEventDispatcher; using ::test::components::application_manager_test:: MockApplicationManagerSettings; +using test::components::event_engine_test::MockEventDispatcher; +using testing::_; +using testing::Return; +using testing::ReturnRef; namespace am = ::application_manager; namespace strings = am::strings; namespace hmi_response = am::hmi_response; +using am::commands::CommandImpl; using am::event_engine::Event; using sdl_rpc_plugin::commands::UpdateDeviceListRequest; -using am::commands::CommandImpl; typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc index af3b9bebf6..96f3b38fbf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_request_test.cc @@ -33,13 +33,13 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/update_sdl_request.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -47,8 +47,8 @@ namespace commands_test { namespace hmi_commands_test { namespace update_sdl_request { -using ::testing::ReturnRef; using ::testing::NiceMock; +using ::testing::ReturnRef; namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::UpdateSDLRequest; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc index 93c49724ce..62ffc6be4d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/update_sdl_response_test.cc @@ -33,12 +33,12 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" #include "application_manager/application.h" +#include "application_manager/commands/commands_test.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" #include "hmi/update_sdl_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -48,8 +48,8 @@ namespace update_sdl_response { namespace am = ::application_manager; namespace strings = ::application_manager::strings; -using sdl_rpc_plugin::commands::UpdateSDLResponse; using am::commands::CommandImpl; +using sdl_rpc_plugin::commands::UpdateSDLResponse; typedef std::shared_ptr<UpdateSDLResponse> UpdateSDLResponsePtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc index 15d38d4ef3..21acf2bb70 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_capabilities_response_test.cc @@ -32,14 +32,14 @@ #include <stdint.h> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "interfaces/MOBILE_API.h" +#include "application_manager/commands/command_impl.h" +#include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" -#include "application_manager/commands/command_impl.h" +#include "gtest/gtest.h" #include "hmi/vr_get_capabilities_response.h" +#include "interfaces/MOBILE_API.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -51,8 +51,8 @@ using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; namespace hmi_response = am::hmi_response; -using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse; using am::commands::CommandImpl; +using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse; typedef std::shared_ptr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr; typedef NiceMock< diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc index 05ed186963..8b00b4dded 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_language_response_test.cc @@ -30,13 +30,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#include "gtest/gtest.h" #include "hmi/vr_get_language_response.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/mock_hmi_capabilities.h" -#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_application_manager.h" +#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" namespace test { namespace components { @@ -47,8 +47,8 @@ namespace vr_get_language_response { using sdl_rpc_plugin::commands::VRGetLanguageResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; -using testing::ReturnRef; using ::testing::NiceMock; +using testing::ReturnRef; namespace strings = application_manager::strings; namespace hmi_response = application_manager::hmi_response; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc index 56b11ad440..b81823624c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_get_supported_languages_response_test.cc @@ -33,15 +33,15 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/application.h" #include "application_manager/commands/commands_test.h" -#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_application_manager.h" -#include "hmi/vr_get_supported_languages_response.h" +#include "application_manager/mock_hmi_capabilities.h" #include "application_manager/policies/mock_policy_handler_interface.h" +#include "application_manager/smart_object_keys.h" +#include "gtest/gtest.h" +#include "hmi/vr_get_supported_languages_response.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -49,8 +49,8 @@ namespace commands_test { namespace hmi_commands_test { namespace vr_get_supported_languages_response { -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; @@ -107,7 +107,8 @@ TEST_F(VRGetSupportedLanguagesResponseTest, RUN_UNSUCCESS) { CreateCommand<VRGetSupportedLanguagesResponse>(command_msg)); EXPECT_CALL(mock_hmi_capabilities_, - set_vr_supported_languages(supported_languages)).Times(0); + set_vr_supported_languages(supported_languages)) + .Times(0); command->Run(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc index 259fd0b92b..9bb8e4c2d5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_request_test.cc @@ -34,15 +34,15 @@ #include "gtest/gtest.h" -#include "smart_objects/smart_object.h" -#include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" -#include "application_manager/mock_application_manager.h" +#include "application_manager/event_engine/event.h" #include "application_manager/hmi_interfaces.h" -#include "application_manager/mock_hmi_interface.h" +#include "application_manager/mock_application_manager.h" #include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/mock_hmi_interface.h" #include "application_manager/mock_message_helper.h" -#include "application_manager/event_engine/event.h" +#include "application_manager/smart_object_keys.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -54,8 +54,8 @@ using ::testing::_; using ::testing::ReturnRef; namespace am = ::application_manager; using am::commands::MessageSharedPtr; -using sdl_rpc_plugin::commands::VRIsReadyRequest; using am::event_engine::Event; +using sdl_rpc_plugin::commands::VRIsReadyRequest; typedef std::shared_ptr<VRIsReadyRequest> VRIsReadyRequestPtr; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc index 0e56f5b483..8b7b0a94f4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/vr_is_ready_response_test.cc @@ -33,12 +33,12 @@ #include <stdint.h> #include <string> -#include "gtest/gtest.h" -#include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" +#include "application_manager/mock_event_dispatcher.h" #include "application_manager/mock_hmi_capabilities.h" +#include "gtest/gtest.h" #include "hmi/vr_is_ready_response.h" -#include "application_manager/mock_event_dispatcher.h" +#include "smart_objects/smart_object.h" namespace test { namespace components { @@ -46,8 +46,8 @@ namespace commands_test { namespace hmi_commands_test { namespace vr_is_ready_response { -using ::testing::Return; using ::testing::NiceMock; +using ::testing::Return; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; |