From cea6922fa666b86dcf71ec95b0f6a28ac73c97d3 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Fri, 15 Mar 2019 11:31:58 -0400 Subject: Fix weatherIcon definition --- src/components/interfaces/HMI_API.xml | 2 +- src/components/interfaces/MOBILE_API.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml index bbb173044a..e0ca4d6d18 100644 --- a/src/components/interfaces/HMI_API.xml +++ b/src/components/interfaces/HMI_API.xml @@ -3555,7 +3555,7 @@ In km - + diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index 3b9614ab76..a0345ada29 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -3899,7 +3899,7 @@ In km - + -- cgit v1.2.1 From 04edfb6b21232dffb3598feca80e2f8e2bf7783c Mon Sep 17 00:00:00 2001 From: Shobhit Adlakha Date: Sat, 16 Mar 2019 17:40:17 -0400 Subject: App service mobile and hmi command creation unit tests (#2843) * Created dummy_command_tests for app_service_rpc_plugin and added other App Service related RPCs * Set expectation that shared_ptr for command was succesfully created in dummy_command_tests --- .../app_service_rpc_plugin/CMakeLists.txt | 2 +- .../app_service_rpc_plugin/test/CMakeLists.txt | 37 +++++ .../test/commands/hmi/dummy_hmi_commands_test.cc | 151 +++++++++++++++++++++ .../commands/mobile/dummy_mobile_commands_test.cc | 135 ++++++++++++++++++ .../test/commands/hmi/dummy_hmi_commands_test.cc | 16 ++- .../commands/mobile/dummy_mobile_commands_test.cc | 30 ++-- 6 files changed, 352 insertions(+), 19 deletions(-) create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc create mode 100644 src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt index 2bdc150906..1e23aac8ee 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt @@ -80,5 +80,5 @@ install(TARGETS app_service_rpc_plugin ) if(BUILD_TESTS) - # add_subdirectory(test) + add_subdirectory(test) endif() diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt new file mode 100644 index 0000000000..63b52da062 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt @@ -0,0 +1,37 @@ +include(${CMAKE_SOURCE_DIR}/tools/cmake/helpers/sources.cmake) + +include_directories( + ${GMOCK_INCLUDE_DIRECTORY} + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include + ${COMPONENTS_DIR}/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/ + ${COMPONENTS_DIR}/application_manager/test/include/ + ${POLICY_MOCK_INCLUDE_PATH}/ + ${CMAKE_SOURCE_DIR}/src +) + + +set(COMMANDS_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/commands) + +file(GLOB SOURCES + ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc + ${COMPONENTS_DIR}/application_manager/test/mock_application_helper.cc + ${COMPONENTS_DIR}/application_manager/src/smart_object_keys.cc + ${COMMANDS_TEST_DIR}/hmi/* + ${COMMANDS_TEST_DIR}/mobile/* + ${COMPONENTS_DIR}/application_manager/src/message.cc + ${COMPONENTS_DIR}/application_manager/src/event_engine/* +) + +set(LIBRARIES + gmock + Utils + SmartObjects + HMI_API + MOBILE_API + connectionHandler + app_service_rpc_plugin + jsoncpp + Policy +) + +create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" ) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc new file mode 100644 index 0000000000..8ef87b6de9 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc @@ -0,0 +1,151 @@ +/* + * 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/as_app_service_activation_request.h" +#include "hmi/as_app_service_activation_response.h" +#include "hmi/as_get_active_service_consent_request.h" +#include "hmi/as_get_active_service_consent_response.h" +#include "hmi/as_get_app_service_data_request_from_hmi.h" +#include "hmi/as_get_app_service_data_request_to_hmi.h" +#include "hmi/as_get_app_service_data_response_from_hmi.h" +#include "hmi/as_get_app_service_data_response_to_hmi.h" +#include "hmi/as_get_app_service_records_request.h" +#include "hmi/as_get_app_service_records_response.h" +#include "hmi/as_perform_app_service_interaction_request_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_request_to_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_from_hmi.h" +#include "hmi/as_perform_app_service_interaction_response_to_hmi.h" +#include "hmi/as_publish_app_service_request.h" +#include "hmi/as_publish_app_service_response.h" +#include "hmi/on_as_app_service_data_notification.h" +#include "hmi/on_as_app_service_data_notification_from_hmi.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 = app_service_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; +}; + +/* 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; + +TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); + +TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr command = + this->template CreateCommand(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_hmi_commands_test +} // namespace hmi_commands_test +} // namespace commands_test +} // namespace components +} // namespace test diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc new file mode 100644 index 0000000000..3c8a780128 --- /dev/null +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -0,0 +1,135 @@ +/* + * 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 "mobile/get_app_service_data_request.h" +#include "mobile/get_app_service_data_request_to_mobile.h" +#include "mobile/get_app_service_data_response.h" +#include "mobile/get_app_service_data_response_from_mobile.h" +#include "mobile/on_app_service_data_notification.h" +#include "mobile/on_app_service_data_notification_from_mobile.h" +#include "mobile/perform_app_service_interaction_request.h" +#include "mobile/perform_app_service_interaction_request_to_mobile.h" +#include "mobile/perform_app_service_interaction_response.h" +#include "mobile/perform_app_service_interaction_response_from_mobile.h" +#include "mobile/publish_app_service_request.h" +#include "mobile/publish_app_service_response.h" + +#include "application_manager/mock_application.h" +#include "application_manager/mock_application_manager.h" +#include "test/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 mobile_commands_test { +namespace dummy_mobile_commands_test { + +namespace commands = app_service_rpc_plugin::commands; +using ::testing::_; +using ::testing::NotNull; +using ::testing::Types; +using am::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; + +namespace { +const std::string kEmptyString_ = ""; +} // namespace + +template +class MobileCommandsTest : public components::commands_test::CommandRequestTest< + CommandsTestMocks::kIsNice> { + public: + typedef Command CommandType; + + void InitCommand(const uint32_t& timeout) OVERRIDE { + 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_, app_icons_folder()) + .WillByDefault(ReturnRef(kEmptyString_)); + } +}; + +template +class MobileCommandsTestFirst : public MobileCommandsTest { + public: + using typename MobileCommandsTest::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 MobileCommandsListFirst; + +TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst); + +TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { + std::shared_ptr command = + this->template CreateCommand(); + EXPECT_NE(command.use_count(), 0); +} + +} // namespace dummy_mobile_commands_test +} // namespace mobile_commands_test +} // namespace commands_test +} // namespace components +} // namespace test 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 a6497ca6e1..874d27b4b0 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 @@ -223,6 +223,8 @@ #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" @@ -496,7 +498,9 @@ typedef Types HMICommandsListFifth; + commands::AllowAppResponse, + commands::BCGetFilePathRequest, + commands::BCGetFilePathResponse> HMICommandsListFifth; TYPED_TEST_CASE(HMICommandsTestFirst, HMICommandsListFirst); TYPED_TEST_CASE(HMICommandsTestSecond, HMICommandsListSecond); @@ -507,30 +511,30 @@ TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth); TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_hmi_commands_test diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc index 8589cbb6be..9c20143c39 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc @@ -62,6 +62,8 @@ #include "mobile/end_audio_pass_thru_request.h" #include "mobile/end_audio_pass_thru_response.h" #include "mobile/generic_response.h" +#include "mobile/get_file_request.h" +#include "mobile/get_file_response.h" #include "mobile/get_way_points_request.h" #include "mobile/get_way_points_response.h" #include "mobile/list_files_request.h" @@ -78,6 +80,7 @@ #include "mobile/on_keyboard_input_notification.h" #include "mobile/on_language_change_notification.h" #include "mobile/on_permissions_change_notification.h" +#include "mobile/on_system_capability_updated_notification.h" #include "mobile/on_system_request_notification.h" #include "mobile/on_tbt_client_state_notification.h" #include "mobile/on_touch_event_notification.h" @@ -220,6 +223,8 @@ typedef Types + commands::mobile::OnSystemCapabilityUpdatedNotification> MobileCommandsListFirst; -typedef Types MobileCommandsListSecond; + commands::UnregisterAppInterfaceRequest> MobileCommandsListSecond; -typedef Types MobileCommandsListThird; @@ -294,18 +300,18 @@ TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird); TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) { std::shared_ptr command = this->template CreateCommand(); - UNUSED(command); + EXPECT_NE(command.use_count(), 0); } } // namespace dummy_mobile_commands_test -- cgit v1.2.1