/* * 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 "application_manager/commands/command_request_test.h" #include #include #include #include "gtest/gtest.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/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/on_allow_sdl_functionality_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_audio_data_streaming_notification.h" #include "hmi/on_video_data_streaming_notification.h" #include "hmi/on_sdl_consent_needed_notification.h" #include "hmi/on_exit_all_applications_notification.h" #include "hmi/on_exit_application_notification.h" #include "hmi/on_put_file_notification.h" #include "hmi/on_resume_audio_source_notification.h" #include "hmi/on_ignition_cycle_over_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/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_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_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_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_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/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_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_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/ui_set_icon_request.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application_manager_settings.h" #include "application_manager/mock_event_dispatcher.h" namespace am = application_manager; namespace test { namespace components { namespace commands_test { namespace hmi_commands_test { namespace dummy_hmi_commands_test { namespace commands = sdl_rpc_plugin::commands; using ::testing::_; using ::testing::NotNull; using ::testing::Types; using application_manager::commands::MessageSharedPtr; using ::test::components::event_engine_test::MockEventDispatcher; 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; template class HMICommandsTest : public components::commands_test::CommandRequestTest< CommandsTestMocks::kIsNice> { public: typedef Command CommandType; void InitCommand(const uint32_t& timeout) OVERRIDE { stream_retry_.first = 0; stream_retry_.second = 0; EXPECT_CALL(app_mngr_settings_, default_timeout()) .WillOnce(ReturnRef(timeout)); ON_CALL(app_mngr_, event_dispatcher()) .WillByDefault(ReturnRef(event_dispatcher_)); ON_CALL(app_mngr_, get_settings()) .WillByDefault(ReturnRef(app_mngr_settings_)); ON_CALL(app_mngr_settings_, start_stream_retry_amount()) .WillByDefault(ReturnRef(stream_retry_)); } protected: std::pair stream_retry_; }; template class HMICommandsTestFirst : public HMICommandsTest { public: using typename HMICommandsTest::CommandType; }; template class HMICommandsTestSecond : public HMICommandsTest { public: using typename HMICommandsTest::CommandType; }; template class HMICommandsTestThird : public HMICommandsTest { public: using typename HMICommandsTest::CommandType; }; template class HMICommandsTestFourth : public HMICommandsTest { public: using typename HMICommandsTest::CommandType; }; template class HMICommandsTestFifth : public HMICommandsTest { public: using typename HMICommandsTest::CommandType; }; /* macro TYPED_TEST_CASE takes max 50 args. That is why there are few * TYPED_TEST_CASE for HMI and mobile commands */ typedef Types HMICommandsListFirst; typedef Types HMICommandsListSecond; typedef Types HMICommandsListThird; typedef Types HMICommandsListFourth; typedef Types HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond); TYPED_TEST_CASE(HMICommandsTestThird, HMICommandsListThird); TYPED_TEST_CASE(HMICommandsTestFourth, HMICommandsListFourth); TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth); TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { utils::SharedPtr command = this->template CreateCommand(); UNUSED(command); } TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) { utils::SharedPtr command = this->template CreateCommand(); UNUSED(command); } TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) { utils::SharedPtr command = this->template CreateCommand(); UNUSED(command); } TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) { utils::SharedPtr command = this->template CreateCommand(); UNUSED(command); } TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) { utils::SharedPtr command = this->template CreateCommand(); UNUSED(command); } } // namespace dummy_hmi_commands_test } // namespace hmi_commands_test } // namespace commands_test } // namespace components } // namespace test