From bbb1d7b1106089e76ec7dc75965d6e6c18fca911 Mon Sep 17 00:00:00 2001 From: theresalech Date: Fri, 26 Oct 2018 09:32:17 -0400 Subject: add link to best practices --- .github/ISSUE_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 1b58b20e86..d62fd997a0 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,4 +1,4 @@ -[Delete any non-applicable sections, but we may ask for more information.] +[Delete any non-applicable sections, but we may ask for more information. Please reference the [SmartDeviceLink GitHub Best Practices](https://d83tozu1c8tt6.cloudfront.net/media/resources/SDL_GitHub_BestPractices.pdf) for further instructions on how to enter an issue.] ### Bug Report [Summary] @@ -20,4 +20,4 @@ * Testing Against: [What you tested with to observe this behavior. Proxy, App, HMI etc.] ##### Test Case, Sample Code, and / or Example App -[Paste a link to a PR, gist, or other code that exemplifies this behavior] \ No newline at end of file +[Paste a link to a PR, gist, or other code that exemplifies this behavior] -- cgit v1.2.1 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 6328bb42cc8699f018be74b15544cfeb6c4100e7 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sat, 16 Mar 2019 13:12:07 -0400 Subject: Delete write_thread_ --- .../transport_manager/src/cloud/websocket_client_connection.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc index 5c9553a970..8944bd74b6 100644 --- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc +++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc @@ -267,6 +267,7 @@ void WebsocketClientConnection::Shutdown() { thread_delegate_->SetShutdown(); write_thread_->join(); delete thread_delegate_; + threads::DeleteThread(write_thread_); } if (buffer_.size()) { buffer_.consume(buffer_.size()); -- cgit v1.2.1 From 9d408169f2898ecf8935c2bbc7eec227ac3ed120 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sat, 16 Mar 2019 13:29:48 -0400 Subject: Set deleted pointers to null --- .../transport_manager/src/cloud/websocket_client_connection.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/transport_manager/src/cloud/websocket_client_connection.cc b/src/components/transport_manager/src/cloud/websocket_client_connection.cc index 8944bd74b6..057e3d7208 100644 --- a/src/components/transport_manager/src/cloud/websocket_client_connection.cc +++ b/src/components/transport_manager/src/cloud/websocket_client_connection.cc @@ -267,7 +267,9 @@ void WebsocketClientConnection::Shutdown() { thread_delegate_->SetShutdown(); write_thread_->join(); delete thread_delegate_; + thread_delegate_ = NULL; threads::DeleteThread(write_thread_); + write_thread_ = NULL; } if (buffer_.size()) { buffer_.consume(buffer_.size()); -- cgit v1.2.1 From a40f522db248338912f4bc702cee8577e8498d27 Mon Sep 17 00:00:00 2001 From: JackLivio Date: Sat, 16 Mar 2019 14:17:41 -0400 Subject: Remove pending cloud apps at shutdown --- .../src/application_manager_impl.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 701bb339a1..b4a0d442f0 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -933,6 +933,9 @@ void ApplicationManagerImpl::DisconnectCloudApp(ApplicationSharedPtr app) { void ApplicationManagerImpl::RefreshCloudAppInformation() { LOG4CXX_AUTO_TRACE(logger_); + if (is_stopping()) { + return; + } std::vector enabled_apps; GetPolicyHandler().GetEnabledCloudApps(enabled_apps); std::vector::iterator enabled_it = enabled_apps.begin(); @@ -2824,6 +2827,21 @@ void ApplicationManagerImpl::UnregisterAllApplications() { it = accessor.GetData().begin(); } } + + bool send_pending_update_app_list = false; + { + sync_primitives::AutoLock auto_lock(apps_to_register_list_lock_ptr_); + if (!apps_to_register_.empty()) { + send_pending_update_app_list = true; + apps_to_register_.clear(); + } + } + + // Only send update app list if pending apps were removed. + if (send_pending_update_app_list) { + SendUpdateAppList(); + } + if (is_ignition_off) { resume_controller().OnIgnitionOff(); } -- 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 From 95dc54877f2238c2ad6599204c17fd83ba7d3aa3 Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sat, 16 Mar 2019 18:58:07 -0400 Subject: Address comments and fix CI failures --- .../test/app_service_manager_test.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc index 406f6fe0ce..960e8e31f6 100644 --- a/src/components/application_manager/test/app_service_manager_test.cc +++ b/src/components/application_manager/test/app_service_manager_test.cc @@ -197,7 +197,6 @@ TEST_F(AppServiceManagerTest, PublishAppService_Mobile_SUCCESS) { smart_objects::SmartObject manifest = GenerateMediaManifest(true); Json::Value empty_json; - // dict[kAppServiceSection][kDefaults][kServiceType] = kPolicyAppId; EXPECT_CALL(mock_last_state_, get_dictionary()) .WillOnce(ReturnRef(empty_json)); @@ -221,8 +220,8 @@ TEST_F(AppServiceManagerTest, PublishAppService_Mobile_SUCCESS) { // Check final record std::string service_id = record[am::strings::service_id].asString(); EXPECT_EQ(manifest, record[am::strings::service_manifest]); - EXPECT_EQ(true, record[am::strings::service_published].asBool()); - EXPECT_EQ(true, record[am::strings::service_active].asBool()); + EXPECT_TRUE(record[am::strings::service_published].asBool()); + EXPECT_TRUE(record[am::strings::service_active].asBool()); // Check first capability update CheckCapabilityUpdate(syscap_update_published, @@ -267,8 +266,8 @@ TEST_F(AppServiceManagerTest, PublishAppService_HMI_SUCCESS) { // Check final record std::string service_id = record[am::strings::service_id].asString(); EXPECT_EQ(manifest, record[am::strings::service_manifest]); - EXPECT_EQ(true, record[am::strings::service_published].asBool()); - EXPECT_EQ(true, record[am::strings::service_active].asBool()); + EXPECT_TRUE(record[am::strings::service_published].asBool()); + EXPECT_TRUE(record[am::strings::service_active].asBool()); // Check first capability update CheckCapabilityUpdate(syscap_update_published, @@ -390,7 +389,7 @@ TEST_F(AppServiceManagerTest, ActiveServiceForType_SUCCESS) { ASSERT_FALSE(service == NULL); EXPECT_EQ(record, service->record); EXPECT_EQ(kConnectionKey, service->connection_key); - EXPECT_EQ(true, service->mobile_service); + EXPECT_TRUE(service->mobile_service); } TEST_F(AppServiceManagerTest, EmbeddedServiceForType_SUCCESS) { @@ -400,7 +399,7 @@ TEST_F(AppServiceManagerTest, EmbeddedServiceForType_SUCCESS) { ASSERT_FALSE(service == NULL); EXPECT_EQ(record, service->record); - EXPECT_EQ(false, service->mobile_service); + EXPECT_FALSE(service->mobile_service); } TEST_F(AppServiceManagerTest, FindServiceByID_SUCCESS) { @@ -412,7 +411,7 @@ TEST_F(AppServiceManagerTest, FindServiceByID_SUCCESS) { ASSERT_FALSE(service == NULL); EXPECT_EQ(record, service->record); EXPECT_EQ(kConnectionKey, service->connection_key); - EXPECT_EQ(true, service->mobile_service); + EXPECT_TRUE(service->mobile_service); } TEST_F(AppServiceManagerTest, GetAllServiceRecords_OneService_SUCCESS) { @@ -432,7 +431,7 @@ TEST_F(AppServiceManagerTest, GetActiveServices_OneService_SUCCESS) { ASSERT_EQ(1u, services.size()); EXPECT_EQ(record, services[0].record); EXPECT_EQ(kConnectionKey, services[0].connection_key); - EXPECT_EQ(true, services[0].mobile_service); + EXPECT_TRUE(services[0].mobile_service); } } // namespace application_manager_test -- cgit v1.2.1 From 57c4c45dc343217c25b6fd0985516d35326363af Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sun, 17 Mar 2019 09:48:58 -0400 Subject: Fix build failure after merge --- .../rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) 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 index 63b52da062..97d2efaf07 100644 --- 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 @@ -30,6 +30,7 @@ set(LIBRARIES MOBILE_API connectionHandler app_service_rpc_plugin + sdl_rpc_plugin jsoncpp Policy ) -- cgit v1.2.1 From 14b83db71c0fd4249f5753134a33e4e36f6a775f Mon Sep 17 00:00:00 2001 From: jacobkeeler Date: Sun, 17 Mar 2019 10:50:10 -0400 Subject: Add null check for app in HandleSubscribe --- .../src/commands/mobile/get_app_service_data_request.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc index 7b29160692..7c2e62abe2 100644 --- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc +++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/get_app_service_data_request.cc @@ -68,11 +68,10 @@ void GetAppServiceDataRequest::Run() { void GetAppServiceDataRequest::HandleSubscribe() { std::string service_type = (*message_)[strings::msg_params][strings::service_type].asString(); - if ((*message_)[strings::msg_params].keyExists(strings::subscribe)) { + ApplicationSharedPtr app = application_manager_.application(connection_key()); + if (app && (*message_)[strings::msg_params].keyExists(strings::subscribe)) { bool subscribe = (*message_)[strings::msg_params][strings::subscribe].asBool(); - ApplicationSharedPtr app = - application_manager_.application(connection_key()); auto& ext = AppServiceAppExtension::ExtractASExtension(*app); if (subscribe) { ext.SubscribeToAppService(service_type); -- cgit v1.2.1