diff options
412 files changed, 2112 insertions, 3227 deletions
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc index b9623d080a..370a2a7d13 100644 --- a/src/appMain/life_cycle.cc +++ b/src/appMain/life_cycle.cc @@ -32,7 +32,7 @@ #include "life_cycle.h" #include "utils/signals.h" -#include "utils/make_shared.h" + #include "config_profile/profile.h" #include "application_manager/system_time/system_time_handler_impl.h" #include "resumption/last_state_impl.h" @@ -122,7 +122,7 @@ bool LifeCycle::StartComponents() { security_manager_ = new security_manager::SecurityManagerImpl(std::move(system_time_handler)); crypto_manager_ = new security_manager::CryptoManagerImpl( - utils::MakeShared<security_manager::CryptoManagerSettingsImpl>( + std::make_shared<security_manager::CryptoManagerSettingsImpl>( profile_, app_manager_->GetPolicyHandler().RetrieveCertificate())); protocol_handler_->AddProtocolObserver(security_manager_); protocol_handler_->set_security_manager(security_manager_); diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h index 0ac2f4047b..4f61191d02 100644 --- a/src/appMain/life_cycle.h +++ b/src/appMain/life_cycle.h @@ -35,7 +35,7 @@ #include <thread> #include <unistd.h> #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "config_profile/profile.h" #include "hmi_message_handler/hmi_message_handler_impl.h" diff --git a/src/components/application_manager/include/application_manager/app_extension.h b/src/components/application_manager/include/application_manager/app_extension.h index ee7eca190c..5f193bf331 100644 --- a/src/components/application_manager/include/application_manager/app_extension.h +++ b/src/components/application_manager/include/application_manager/app_extension.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_EXTENSION_H_ -#include "utils/shared_ptr.h" + namespace NsSmartDeviceLink { namespace NsSmartObjects { @@ -74,7 +74,7 @@ class AppExtension { const AppExtensionUID kUid_; }; -typedef utils::SharedPtr<AppExtension> AppExtensionPtr; +typedef std::shared_ptr<AppExtension> AppExtensionPtr; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h index 9fc85db38c..a10963ad82 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl.h @@ -33,11 +33,11 @@ #ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APP_LAUNCH_APP_LAUNCH_CTRL_H_ #include <string> -#include "utils/shared_ptr.h" +#include <memory> namespace application_manager { class Application; -typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr; +typedef std::shared_ptr<const Application> ApplicationConstSharedPtr; } // namespace application_manager namespace app_launch { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h index 1f508eebe5..61f3480f77 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_ctrl_impl.h @@ -49,7 +49,7 @@ class ResumeCtrl; namespace app_launch { // TODO(AK) Use unique pointer -typedef utils::SharedPtr<timer::Timer> TimerPtr; +typedef std::shared_ptr<timer::Timer> TimerPtr; class MultipleAppsLauncherFactoryImpl; class AppLaunchCtrlImpl : public AppLaunchCtrl { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h index 0d52384018..73e9623b62 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data.h @@ -36,7 +36,7 @@ #include <stdint.h> #include <vector> #include <string> -#include "utils/shared_ptr.h" +#include <memory> namespace app_launch { @@ -59,7 +59,7 @@ struct ApplicationData { bundle_id_ == app_data.bundle_id_ && device_mac_ == device_mac_; } }; -typedef utils::SharedPtr<ApplicationData> ApplicationDataPtr; +typedef std::shared_ptr<ApplicationData> ApplicationDataPtr; /** * @brief class contains interfaces to AppLaunchDataDB and AppLaunchDataJson diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h index 111ff25ab2..a2b8630bcc 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_impl.h @@ -35,6 +35,8 @@ #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/app_launch_settings.h" +#include "utils/macro.h" +#include <memory> namespace app_launch { diff --git a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h index 61117e552b..e9166439f8 100644 --- a/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h +++ b/src/components/application_manager/include/application_manager/app_launch/app_launch_data_json.h @@ -38,6 +38,7 @@ #include "resumption/last_state.h" #include "utils/lock.h" #include "utils/macro.h" +#include <memory> namespace app_launch { diff --git a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h index 751e04bada..6285514be9 100644 --- a/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h +++ b/src/components/application_manager/include/application_manager/app_launch/apps_launcher.h @@ -3,6 +3,7 @@ #include "application_manager/app_launch/app_launch_data.h" #include "connection_handler/connection_handler.h" #include "utils/timer.h" +#include <memory> namespace app_launch { class AppLaunchCtrlImpl; @@ -69,7 +70,7 @@ class AppsLauncher { connection_handler::ConnectionHandler& connection_handler_; AppsLauncher& parent_; }; - typedef utils::SharedPtr<Launcher> LauncherPtr; + typedef std::shared_ptr<Launcher> LauncherPtr; typedef std::vector<LauncherPtr> AppLaunchers; private: diff --git a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h index 2a6cdb0745..f156654215 100644 --- a/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h +++ b/src/components/application_manager/include/application_manager/app_launch/device_apps_launcher.h @@ -29,7 +29,7 @@ class DeviceAppsLauncherImpl { struct LauncherFinder { LauncherFinder(const std::string& device_mac) : device_mac_(device_mac) {} - bool operator()(const utils::SharedPtr<Launcher>& launcher) const; + bool operator()(const std::shared_ptr<Launcher>& launcher) const; std::string device_mac_; }; @@ -38,8 +38,8 @@ class DeviceAppsLauncherImpl { private: sync_primitives::Lock launchers_lock_; - std::vector<utils::SharedPtr<Launcher> > free_launchers_; - std::vector<utils::SharedPtr<Launcher> > works_launchers_; + std::vector<std::shared_ptr<Launcher> > free_launchers_; + std::vector<std::shared_ptr<Launcher> > works_launchers_; DeviceAppsLauncher& interface_; }; diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h index cfc3c03a5b..844b08071b 100644 --- a/src/components/application_manager/include/application_manager/application.h +++ b/src/components/application_manager/include/application_manager/application.h @@ -38,7 +38,8 @@ #include <set> #include <list> #include <vector> -#include "utils/shared_ptr.h" +#include <memory> + #include "utils/data_accessor.h" #include "interfaces/MOBILE_API.h" #include "connection_handler/device.h" @@ -948,8 +949,8 @@ class Application : public virtual InitialApplicationData, bool is_greyed_out_; }; -typedef utils::SharedPtr<Application> ApplicationSharedPtr; -typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr; +typedef std::shared_ptr<Application> ApplicationSharedPtr; +typedef std::shared_ptr<const Application> ApplicationConstSharedPtr; typedef uint32_t ApplicationId; } // namespace application_manager diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h index 46706fad4f..ee0d0cb5ab 100644 --- a/src/components/application_manager/include/application_manager/application_impl.h +++ b/src/components/application_manager/include/application_manager/application_impl.h @@ -91,7 +91,7 @@ class ApplicationImpl : public virtual Application, const std::string& mac_address, const connection_handler::DeviceHandle device_id, const custom_str::CustomString& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager); DEPRECATED ApplicationImpl( @@ -99,7 +99,7 @@ class ApplicationImpl : public virtual Application, const std::string& policy_app_id, const std::string& mac_address, const custom_str::CustomString& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager); ~ApplicationImpl(); diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index 399b710286..2b83c2fccd 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -86,7 +86,7 @@ #endif // TELEMETRY_MONITOR #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "utils/message_queue.h" #include "utils/prioritized_queue.h" #include "utils/threads/thread.h" @@ -118,7 +118,7 @@ typedef std::map<std::string, hmi_apis::Common_TransportType::eType> DeviceTypes; CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") -typedef utils::SharedPtr<timer::Timer> TimerSPtr; +typedef std::shared_ptr<timer::Timer> TimerSPtr; class ApplicationManagerImpl : public ApplicationManager, @@ -186,7 +186,7 @@ class ApplicationManagerImpl mobile_apis::HMILevel::eType to) OVERRIDE; void SendHMIStatusNotification( - const utils::SharedPtr<Application> app) OVERRIDE; + const std::shared_ptr<Application> app) OVERRIDE; void SendDriverDistractionState(ApplicationSharedPtr application); @@ -321,7 +321,7 @@ class ApplicationManagerImpl void SetTelemetryObserver(AMTelemetryObserver* observer) OVERRIDE; #endif // TELEMETRY_MONITOR - ApplicationSharedPtr RegisterApplication(const utils::SharedPtr< + ApplicationSharedPtr RegisterApplication(const std::shared_ptr< smart_objects::SmartObject>& request_for_registration) OVERRIDE; /* * @brief Closes application by id @@ -475,7 +475,7 @@ class ApplicationManagerImpl * @return new regular HMI state */ HmiStatePtr CreateRegularState( - utils::SharedPtr<Application> app, + std::shared_ptr<Application> app, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::VideoStreamingState::eType video_state, @@ -1190,7 +1190,7 @@ class ApplicationManagerImpl uint32_t app_count = NULL == app_array ? 0 : app_array->size(); typename ApplicationList::const_iterator it; for (it = app_list.begin(); it != app_list.end(); ++it) { - if (!it->valid()) { + if (it->use_count() == 0) { LOG4CXX_ERROR(logger_, "Application not found "); continue; } diff --git a/src/components/application_manager/include/application_manager/command_factory.h b/src/components/application_manager/include/application_manager/command_factory.h index ce2706f9a0..b8267ed438 100644 --- a/src/components/application_manager/include/application_manager/command_factory.h +++ b/src/components/application_manager/include/application_manager/command_factory.h @@ -42,7 +42,7 @@ namespace application_manager { using rpc_service::RPCService; using policy::PolicyHandlerInterface; -typedef utils::SharedPtr<commands::Command> CommandSharedPtr; +typedef std::shared_ptr<commands::Command> CommandSharedPtr; /** * @brief Factory class for command creation diff --git a/src/components/application_manager/include/application_manager/command_holder.h b/src/components/application_manager/include/application_manager/command_holder.h index d3171aedbb..3551a13707 100644 --- a/src/components/application_manager/include/application_manager/command_holder.h +++ b/src/components/application_manager/include/application_manager/command_holder.h @@ -36,7 +36,7 @@ #include <string> #include "application_manager/application.h" #include "smart_objects/smart_object.h" -#include "utils/shared_ptr.h" + namespace application_manager { /** diff --git a/src/components/application_manager/include/application_manager/command_holder_impl.h b/src/components/application_manager/include/application_manager/command_holder_impl.h index c15506ac75..18a1de7526 100644 --- a/src/components/application_manager/include/application_manager/command_holder_impl.h +++ b/src/components/application_manager/include/application_manager/command_holder_impl.h @@ -42,7 +42,7 @@ #include "application_manager/rpc_service.h" #include "smart_objects/smart_object.h" #include "utils/lock.h" -#include "utils/shared_ptr.h" + #include "utils/macro.h" namespace application_manager { @@ -99,7 +99,7 @@ class CommandHolderImpl : public CommandHolder { using AppCommands = std::map<ApplicationSharedPtr, - std::vector<utils::SharedPtr<smart_objects::SmartObject> > >; + std::vector<std::shared_ptr<smart_objects::SmartObject> > >; ApplicationManager& app_manager_; sync_primitives::Lock commands_lock_; diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h index 6524799f45..1bd6441c76 100644 --- a/src/components/application_manager/include/application_manager/commands/command.h +++ b/src/components/application_manager/include/application_manager/commands/command.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_ #include <stdint.h> #include "smart_objects/smart_object.h" -#include "utils/shared_ptr.h" + namespace application_manager { diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h index a22d32920a..e333cb9bbc 100644 --- a/src/components/application_manager/include/application_manager/hmi_state.h +++ b/src/components/application_manager/include/application_manager/hmi_state.h @@ -35,8 +35,8 @@ #include <iosfwd> #include <list> +#include <memory> #include "interfaces/MOBILE_API.h" -#include "utils/shared_ptr.h" #include "utils/macro.h" namespace application_manager { @@ -45,7 +45,7 @@ class HmiState; class ApplicationManager; class Application; -typedef utils::SharedPtr<HmiState> HmiStatePtr; +typedef std::shared_ptr<HmiState> HmiStatePtr; /** * @brief The HmiState class @@ -81,7 +81,7 @@ class HmiState { * @param app Application pointer * @param app_mngr Application manager */ - HmiState(utils::SharedPtr<Application> app, + HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); /** @@ -90,7 +90,7 @@ class HmiState { * @param app_mngr Application manager * @param state_id HMI state to assign */ - HmiState(utils::SharedPtr<Application> app, + HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr, StateID state_id); @@ -226,7 +226,7 @@ class HmiState { } protected: - utils::SharedPtr<Application> app_; + std::shared_ptr<Application> app_; StateID state_id_; const ApplicationManager& app_mngr_; HmiStatePtr parent_; @@ -272,7 +272,7 @@ class VRHmiState : public HmiState { public: virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const OVERRIDE; - VRHmiState(utils::SharedPtr<Application> app, + VRHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr); @@ -283,7 +283,7 @@ class VRHmiState : public HmiState { */ class TTSHmiState : public HmiState { public: - TTSHmiState(utils::SharedPtr<Application> app, + TTSHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED TTSHmiState(uint32_t app_id, const ApplicationManager& app_mngr); @@ -298,7 +298,7 @@ class TTSHmiState : public HmiState { */ class VideoStreamingHmiState : public HmiState { public: - VideoStreamingHmiState(utils::SharedPtr<Application> app, + VideoStreamingHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); mobile_apis::VideoStreamingState::eType video_streaming_state() @@ -311,7 +311,7 @@ class VideoStreamingHmiState : public HmiState { */ class NaviStreamingHmiState : public VideoStreamingHmiState { public: - NaviStreamingHmiState(utils::SharedPtr<Application> app, + NaviStreamingHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); mobile_apis::AudioStreamingState::eType audio_streaming_state() @@ -324,7 +324,7 @@ class NaviStreamingHmiState : public VideoStreamingHmiState { */ class PhoneCallHmiState : public HmiState { public: - PhoneCallHmiState(utils::SharedPtr<Application> app, + PhoneCallHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED PhoneCallHmiState(uint32_t app_id, @@ -343,7 +343,7 @@ class PhoneCallHmiState : public HmiState { */ class SafetyModeHmiState : public HmiState { public: - SafetyModeHmiState(utils::SharedPtr<Application> app, + SafetyModeHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED SafetyModeHmiState(uint32_t app_id, @@ -365,7 +365,7 @@ class SafetyModeHmiState : public HmiState { */ class DeactivateHMI : public HmiState { public: - DeactivateHMI(utils::SharedPtr<Application> app, + DeactivateHMI(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED DeactivateHMI(uint32_t app_id, const ApplicationManager& app_mngr); @@ -387,7 +387,7 @@ class DeactivateHMI : public HmiState { */ class AudioSource : public HmiState { public: - AudioSource(utils::SharedPtr<Application> app, + AudioSource(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED AudioSource(uint32_t app_id, const ApplicationManager& app_mngr); @@ -410,7 +410,7 @@ class AudioSource : public HmiState { */ class EmbeddedNavi : public HmiState { public: - EmbeddedNavi(utils::SharedPtr<Application> app, + EmbeddedNavi(std::shared_ptr<Application> app, const ApplicationManager& app_mngr); DEPRECATED EmbeddedNavi(uint32_t app_id, const ApplicationManager& app_mngr); diff --git a/src/components/application_manager/include/application_manager/message.h b/src/components/application_manager/include/application_manager/message.h index 7ca3e59f09..908305015b 100644 --- a/src/components/application_manager/include/application_manager/message.h +++ b/src/components/application_manager/include/application_manager/message.h @@ -36,7 +36,7 @@ #include <string> #include <vector> -#include "utils/shared_ptr.h" + #include "protocol/message_priority.h" #include "protocol/rpc_type.h" #include "protocol/common.h" @@ -126,8 +126,8 @@ class Message { protocol_handler::MajorProtocolVersion version_; }; -typedef utils::SharedPtr<application_manager::Message> MobileMessage; -typedef utils::SharedPtr<application_manager::Message> MessagePtr; +typedef std::shared_ptr<application_manager::Message> MobileMessage; +typedef std::shared_ptr<application_manager::Message> MessagePtr; } // namespace application_manager #endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_H_ diff --git a/src/components/application_manager/include/application_manager/mobile_message_handler.h b/src/components/application_manager/include/application_manager/mobile_message_handler.h index ad660d0b66..b2ad963f46 100644 --- a/src/components/application_manager/include/application_manager/mobile_message_handler.h +++ b/src/components/application_manager/include/application_manager/mobile_message_handler.h @@ -38,7 +38,7 @@ #include "application_manager/message.h" namespace application_manager { -typedef utils::SharedPtr<application_manager::Message> MobileMessage; +typedef std::shared_ptr<application_manager::Message> MobileMessage; class MobileMessageHandler { public: static application_manager::Message* HandleIncomingMessageProtocol( diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index 8d019784fc..14e2841eb5 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -206,7 +206,7 @@ class PolicyHandler : public PolicyHandlerInterface, void add_listener(PolicyHandlerObserver* listener) OVERRIDE; void remove_listener(PolicyHandlerObserver* listener) OVERRIDE; - utils::SharedPtr<usage_statistics::StatisticsManager> GetStatisticManager() + std::shared_ptr<usage_statistics::StatisticsManager> GetStatisticManager() const OVERRIDE; /** @@ -552,7 +552,7 @@ class PolicyHandler : public PolicyHandlerInterface, int32_t timespan_seconds) OVERRIDE; #ifdef BUILD_TESTS - void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) { + void SetPolicyManager(std::shared_ptr<PolicyManager> pm) { policy_manager_ = pm; } #endif // BUILD_TESTS @@ -732,9 +732,9 @@ class PolicyHandler : public PolicyHandlerInterface, private: mutable sync_primitives::RWLock policy_manager_lock_; - utils::SharedPtr<PolicyManager> policy_manager_; + std::shared_ptr<PolicyManager> policy_manager_; void* dl_handle_; - utils::SharedPtr<PolicyEventObserver> event_observer_; + std::shared_ptr<PolicyEventObserver> event_observer_; uint32_t last_activated_app_id_; /** @@ -758,7 +758,7 @@ class PolicyHandler : public PolicyHandlerInterface, // Lock for app to device list sync_primitives::Lock app_to_device_link_lock_; - utils::SharedPtr<StatisticManagerImpl> statistic_manager_impl_; + std::shared_ptr<StatisticManagerImpl> statistic_manager_impl_; const PolicySettings& settings_; application_manager::ApplicationManager& application_manager_; friend class AppPermissionDelegate; diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h index c0bae1aac8..ea8d95a92a 100644 --- a/src/components/application_manager/include/application_manager/request_controller.h +++ b/src/components/application_manager/include/application_manager/request_controller.h @@ -38,7 +38,7 @@ #include <list> #include "utils/lock.h" -#include "utils/shared_ptr.h" + #include "utils/threads/thread.h" #include "utils/conditional_variable.h" #include "utils/threads/thread_delegate.h" diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h index 95585279ca..db6409bbde 100644 --- a/src/components/application_manager/include/application_manager/request_info.h +++ b/src/components/application_manager/include/application_manager/request_info.h @@ -52,7 +52,7 @@ namespace request_controller { * @brief Typedef for active mobile request * */ -typedef utils::SharedPtr<commands::Command> RequestPtr; +typedef std::shared_ptr<commands::Command> RequestPtr; struct RequestInfo { enum RequestType { RequestNone, MobileRequest, HMIRequest }; @@ -136,7 +136,7 @@ struct RequestInfo { uint32_t correlation_id_; }; -typedef utils::SharedPtr<RequestInfo> RequestInfoPtr; +typedef std::shared_ptr<RequestInfo> RequestInfoPtr; struct MobileRequestInfo : public RequestInfo { MobileRequestInfo(RequestPtr request, const uint64_t timeout_msec); @@ -276,7 +276,7 @@ struct TimeScale { : start_(start), end_(end), app_id_(app_id) {} bool operator()(RequestInfoPtr setEntry) { - if (!setEntry.valid()) { + if (setEntry.use_count() == 0) { return false; } diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h index 6d26b6a617..90c6c5c208 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h @@ -34,14 +34,14 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUME_CTRL_H_ #include <stdint.h> -#include "utils/shared_ptr.h" + #include "application_manager/resumption/resumption_data.h" namespace application_manager { class ApplicationManager; class Application; -typedef utils::SharedPtr<Application> ApplicationSharedPtr; -typedef utils::SharedPtr<const Application> ApplicationConstSharedPtr; +typedef std::shared_ptr<Application> ApplicationSharedPtr; +typedef std::shared_ptr<const Application> ApplicationConstSharedPtr; } namespace app_mngr = application_manager; @@ -270,7 +270,7 @@ class ResumeCtrl { #ifdef BUILD_TESTS virtual void set_resumption_storage( - utils::SharedPtr<ResumptionData> mock_storage) = 0; + std::shared_ptr<ResumptionData> mock_storage) = 0; virtual bool get_resumption_active() const = 0; #endif // BUILD_TESTS diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h index 9e084af66b..17aabb6d60 100644 --- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h +++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h @@ -304,7 +304,7 @@ class ResumeCtrlImpl : public ResumeCtrl, #ifdef BUILD_TESTS void set_resumption_storage( - utils::SharedPtr<ResumptionData> mock_storage) OVERRIDE; + std::shared_ptr<ResumptionData> mock_storage) OVERRIDE; bool get_resumption_active() const OVERRIDE; #endif // BUILD_TESTS @@ -535,7 +535,7 @@ class ResumeCtrlImpl : public ResumeCtrl, bool is_data_saved_; bool is_suspended_; time_t launch_time_; - utils::SharedPtr<ResumptionData> resumption_storage_; + std::shared_ptr<ResumptionData> resumption_storage_; application_manager::ApplicationManager& application_manager_; }; diff --git a/src/components/application_manager/include/application_manager/rpc_handler_impl.h b/src/components/application_manager/include/application_manager/rpc_handler_impl.h index 5e891608c6..515e289400 100644 --- a/src/components/application_manager/include/application_manager/rpc_handler_impl.h +++ b/src/components/application_manager/include/application_manager/rpc_handler_impl.h @@ -57,26 +57,26 @@ #include "interfaces/v4_protocol_v1_2_no_extra_schema.h" #include "utils/threads/message_loop_thread.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + namespace application_manager { namespace rpc_handler { namespace impl { -struct MessageFromMobile : public utils::SharedPtr<Message> { +struct MessageFromMobile : public std::shared_ptr<Message> { MessageFromMobile() {} - explicit MessageFromMobile(const utils::SharedPtr<Message>& message) - : utils::SharedPtr<Message>(message) {} + explicit MessageFromMobile(const std::shared_ptr<Message>& message) + : std::shared_ptr<Message>(message) {} // PrioritizedQueue requires this method to decide which priority to assign size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); } }; -struct MessageFromHmi : public utils::SharedPtr<Message> { +struct MessageFromHmi : public std::shared_ptr<Message> { MessageFromHmi() {} - explicit MessageFromHmi(const utils::SharedPtr<Message>& message) - : utils::SharedPtr<Message>(message) {} + explicit MessageFromHmi(const std::shared_ptr<Message>& message) + : std::shared_ptr<Message>(message) {} // PrioritizedQueue requires this method to decide which priority to assign size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); @@ -145,11 +145,11 @@ class RPCHandlerImpl : public RPCHandler, #endif // TELEMETRY_MONITOR private: - void ProcessMessageFromMobile(const utils::SharedPtr<Message> message); - void ProcessMessageFromHMI(const utils::SharedPtr<Message> message); + void ProcessMessageFromMobile(const std::shared_ptr<Message> message); + void ProcessMessageFromHMI(const std::shared_ptr<Message> message); bool ConvertMessageToSO(const Message& message, smart_objects::SmartObject& output); - utils::SharedPtr<Message> ConvertRawMsgToMessage( + std::shared_ptr<Message> ConvertRawMsgToMessage( const ::protocol_handler::RawMessagePtr message); hmi_apis::HMI_API& hmi_so_factory(); mobile_apis::MOBILE_API& mobile_so_factory(); diff --git a/src/components/application_manager/include/application_manager/rpc_service_impl.h b/src/components/application_manager/include/application_manager/rpc_service_impl.h index 6f39e11592..1eaeb46255 100644 --- a/src/components/application_manager/include/application_manager/rpc_service_impl.h +++ b/src/components/application_manager/include/application_manager/rpc_service_impl.h @@ -58,11 +58,11 @@ namespace rpc_service { namespace impl { -struct MessageToMobile : public utils::SharedPtr<Message> { +struct MessageToMobile : public std::shared_ptr<Message> { MessageToMobile() : is_final(false) {} - explicit MessageToMobile(const utils::SharedPtr<Message>& message, + explicit MessageToMobile(const std::shared_ptr<Message>& message, bool final_message) - : utils::SharedPtr<Message>(message), is_final(final_message) {} + : std::shared_ptr<Message>(message), is_final(final_message) {} // PrioritizedQueue requires this method to decide which priority to assign size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); @@ -71,10 +71,10 @@ struct MessageToMobile : public utils::SharedPtr<Message> { bool is_final; }; -struct MessageToHmi : public utils::SharedPtr<Message> { +struct MessageToHmi : public std::shared_ptr<Message> { MessageToHmi() {} - explicit MessageToHmi(const utils::SharedPtr<Message>& message) - : utils::SharedPtr<Message>(message) {} + explicit MessageToHmi(const std::shared_ptr<Message>& message) + : std::shared_ptr<Message>(message) {} // PrioritizedQueue requires this method to decide which priority to assign size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h index 58747fdd6e..99113d6d00 100644 --- a/src/components/application_manager/include/application_manager/state_controller_impl.h +++ b/src/components/application_manager/include/application_manager/state_controller_impl.h @@ -420,7 +420,7 @@ class StateControllerImpl : public event_engine::EventObserver, * @param state_id state id * @return */ - HmiStatePtr CreateHmiState(utils::SharedPtr<Application> app, + HmiStatePtr CreateHmiState(std::shared_ptr<Application> app, HmiState::StateID state_id) const; /** diff --git a/src/components/application_manager/include/application_manager/telemetry_observer.h b/src/components/application_manager/include/application_manager/telemetry_observer.h index 20b3aaca5a..62169e8185 100644 --- a/src/components/application_manager/include/application_manager/telemetry_observer.h +++ b/src/components/application_manager/include/application_manager/telemetry_observer.h @@ -36,7 +36,7 @@ #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "json/json.h" -#include "utils/shared_ptr.h" + #include "utils/date_time.h" namespace application_manager { @@ -46,9 +46,9 @@ class AMTelemetryObserver { struct MessageMetric { TimevalStruct begin; TimevalStruct end; - utils::SharedPtr<smart_objects::SmartObject> message; + std::shared_ptr<smart_objects::SmartObject> message; }; - typedef utils::SharedPtr<MessageMetric> MessageMetricSharedPtr; + typedef std::shared_ptr<MessageMetric> MessageMetricSharedPtr; virtual void OnMessage(MessageMetricSharedPtr) = 0; virtual ~AMTelemetryObserver() {} diff --git a/src/components/application_manager/include/application_manager/usage_statistics.h b/src/components/application_manager/include/application_manager/usage_statistics.h index aa07e41cad..6d0b5cd6bd 100644 --- a/src/components/application_manager/include/application_manager/usage_statistics.h +++ b/src/components/application_manager/include/application_manager/usage_statistics.h @@ -38,7 +38,7 @@ #include "policy/usage_statistics/counter.h" #include "policy/usage_statistics/app_stopwatch.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "interfaces/MOBILE_API.h" namespace application_manager { @@ -47,10 +47,10 @@ class UsageStatistics { public: UsageStatistics( const std::string& app_id, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager); + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager); UsageStatistics( const std::string& app_id, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, usage_statistics::AppStopwatch* time_in_hmi_state_ptr); void RecordHmiStateChanged(mobile_apis::HMILevel::eType new_hmi_level); void RecordAppRegistrationGuiLanguage( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h index 05994492c2..72f29c7de1 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_app_extension.h @@ -35,6 +35,8 @@ #include <string> #include <set> +#include <memory> +#include "utils/macro.h" #include "application_manager/app_extension.h" namespace rc_rpc_plugin { @@ -78,7 +80,7 @@ class RCAppExtension : public application_manager::AppExtension { resumption_data) OVERRIDE; }; -typedef utils::SharedPtr<RCAppExtension> RCAppExtensionPtr; +typedef std::shared_ptr<RCAppExtension> RCAppExtensionPtr; } // namespace rc_rpc_plugin diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h index 20bd438494..91d1b09fca 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/resource_allocation_manager.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_REMOTE_CONTROL_INCLUDE_REMOTE_CONTROL_RESOURCE_ALLOCATION_H #include <string> #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "interfaces/HMI_API.h" #include "application_manager/plugin_manager/rpc_plugin.h" #include "rc_rpc_plugin/rc_app_extension.h" diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc index ca96b1cf97..7bc72faced 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/hmi/rc_on_remote_control_settings_notification.cc @@ -105,7 +105,7 @@ void RCOnRemoteControlSettingsNotification::DisallowRCFunctionality() { app->app_id(), mobile_apis::HMILevel::eType::HMI_NONE); const RCAppExtensionPtr extension = - application_manager::AppExtensionPtr::static_pointer_cast< + std::static_pointer_cast< RCAppExtension>(app->QueryInterface(RCRPCPlugin::kRCPluginID)); if (extension) { UnsubscribeFromInteriorVehicleDataForAllModules(extension); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc index dfe2feb622..8238e9a943 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc @@ -71,7 +71,7 @@ void OnInteriorVehicleDataNotification::Run() { application_manager::Application& app = **it; RCAppExtensionPtr extension = - application_manager::AppExtensionPtr::static_pointer_cast< + std::static_pointer_cast< RCAppExtension>(app.QueryInterface(RCRPCPlugin::kRCPluginID)); DCHECK(extension); LOG4CXX_TRACE(logger_, diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc index 4378f1ea48..a562e45b1d 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc @@ -35,6 +35,7 @@ #include "rc_rpc_plugin/rc_app_extension.h" #include "rc_rpc_plugin/resource_allocation_manager_impl.h" #include "utils/helpers.h" +#include <memory> namespace rc_rpc_plugin { namespace plugins = application_manager::plugin_manager; @@ -90,7 +91,7 @@ void RCRPCPlugin::OnApplicationEvent( } switch (event) { case plugins::kApplicationRegistered: { - application->AddExtension(new RCAppExtension(kRCPluginID)); + application->AddExtension(std::shared_ptr<RCAppExtension>(new RCAppExtension(kRCPluginID))); resource_allocation_manager_->SendOnRCStatusNotifications( NotificationTrigger::APP_REGISTRATION, application); break; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc index 450bf79fe7..01c2e3a7c6 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc @@ -41,7 +41,7 @@ #include "rc_rpc_plugin/rc_module_constants.h" #include "json/json.h" #include "utils/helpers.h" -#include "utils/make_shared.h" + namespace rc_rpc_plugin { @@ -178,7 +178,7 @@ void ResourceAllocationManagerImpl::ProcessApplicationPolicyUpdate() { if (!disallowed_modules.empty()) { SendOnRCStatusNotifications( NotificationTrigger::MODULE_ALLOCATION, - utils::SharedPtr<application_manager::Application>()); + std::shared_ptr<application_manager::Application>()); } } } @@ -198,7 +198,7 @@ RCAppExtensionPtr ResourceAllocationManagerImpl::GetApplicationExtention( } rc_app_extension = - application_manager::AppExtensionPtr::static_pointer_cast<RCAppExtension>( + std::static_pointer_cast<RCAppExtension>( app_extension); return rc_app_extension; @@ -307,7 +307,7 @@ void ResourceAllocationManagerImpl::SetResourceAquired( allocated_resources_[module_type] = app_id; SendOnRCStatusNotifications( NotificationTrigger::MODULE_ALLOCATION, - utils::SharedPtr<application_manager::Application>()); + std::shared_ptr<application_manager::Application>()); } void ResourceAllocationManagerImpl::SendOnRCStatusNotifications( @@ -343,7 +343,7 @@ void ResourceAllocationManagerImpl::set_rc_enabled(const bool value) { is_rc_enabled_ = value; SendOnRCStatusNotifications( NotificationTrigger::RC_STATE_CHANGING, - utils::SharedPtr<application_manager::Application>()); + std::shared_ptr<application_manager::Application>()); } void ResourceAllocationManagerImpl::SetResourceFree( @@ -511,7 +511,7 @@ void ResourceAllocationManagerImpl::OnApplicationEvent( if (!acquired_modules.empty()) { SendOnRCStatusNotifications( NotificationTrigger::MODULE_ALLOCATION, - utils::SharedPtr<application_manager::Application>()); + std::shared_ptr<application_manager::Application>()); } Apps app_list; app_list.push_back(application); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc index 7ab4819002..329f4de5a6 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/button_press_request_test.cc @@ -41,8 +41,8 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/commands/command_request_test.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -78,9 +78,9 @@ class ButtonPressRequestTest public: ButtonPressRequestTest() : rc_capabilities_(smart_objects::SmartType_Map) - , mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + , mock_app_(std::make_shared<NiceMock<MockApplication> >()) , rc_app_extention_( - utils::MakeShared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {} + std::make_shared<rc_rpc_plugin::RCAppExtension>(kModuleId)) {} smart_objects::SmartObject ButtonCapability( const mobile_apis::ButtonName::eType button_name) { @@ -147,10 +147,10 @@ class ButtonPressRequestTest } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -160,8 +160,8 @@ class ButtonPressRequestTest protected: smart_objects::SmartObject rc_capabilities_; - utils::SharedPtr<MockApplication> mock_app_; - utils::SharedPtr<rc_rpc_plugin::RCAppExtension> rc_app_extention_; + std::shared_ptr<MockApplication> mock_app_; + std::shared_ptr<rc_rpc_plugin::RCAppExtension> rc_app_extention_; test::components::policy_test::MockPolicyHandlerInterface mock_policy_handler_; testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager> @@ -195,7 +195,7 @@ TEST_F(ButtonPressRequestTest, .WillOnce(Return(true)); // Act - application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest> + std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>( mobile_message); ASSERT_TRUE(command->Init()); @@ -234,7 +234,7 @@ TEST_F( .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true))); // Act - application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest> + std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>( mobile_message); ASSERT_TRUE(command->Init()); @@ -273,7 +273,7 @@ TEST_F(ButtonPressRequestTest, OnEvent_ExpectSuccessfullResponseSentToMobile) { application_manager::event_engine::Event event( hmi_apis::FunctionID::Buttons_ButtonPress); event.set_smart_object(*hmi_message); - application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest> + std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>( mobile_message); command->on_event(event); @@ -312,7 +312,7 @@ TEST_F(ButtonPressRequestTest, application_manager::event_engine::Event event( hmi_apis::FunctionID::Buttons_ButtonPress); event.set_smart_object(*hmi_message); - application_manager::SharedPtr<rc_rpc_plugin::commands::ButtonPressRequest> + std::shared_ptr<rc_rpc_plugin::commands::ButtonPressRequest> command = CreateRCCommand<rc_rpc_plugin::commands::ButtonPressRequest>( mobile_message); command->on_event(event); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc index 685bc1fd42..8f69b29275 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc @@ -40,8 +40,8 @@ #include "application_manager/event_engine/event_dispatcher.h" #include "application_manager/commands/command_request_test.h" #include "rc_rpc_plugin/mock/mock_resource_allocation_manager.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + using ::testing::_; using ::testing::Mock; @@ -76,8 +76,8 @@ class GetInteriorVehicleDataRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: GetInteriorVehicleDataRequestTest() - : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) - , rc_app_extention_(utils::MakeShared<RCAppExtension>(kModuleId)) { + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) + , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId)) { ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); ON_CALL(app_mngr_, hmi_interfaces()) .WillByDefault(ReturnRef(mock_hmi_interfaces_)); @@ -116,10 +116,10 @@ class GetInteriorVehicleDataRequestTest return message; } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -129,8 +129,8 @@ class GetInteriorVehicleDataRequestTest protected: smart_objects::SmartObject rc_capabilities_; - utils::SharedPtr<MockApplication> mock_app_; - utils::SharedPtr<RCAppExtension> rc_app_extention_; + std::shared_ptr<MockApplication> mock_app_; + std::shared_ptr<RCAppExtension> rc_app_extention_; testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager> mock_allocation_manager_; }; @@ -145,7 +145,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, hmi_apis::FunctionID::RC_GetInteriorVehicleData))) .WillOnce(Return(true)); MessageSharedPtr mobile_message = CreateBasicMessage(); - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); @@ -170,7 +170,7 @@ TEST_F( ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), _)) .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true))); - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); @@ -201,7 +201,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, application_manager::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); event.set_smart_object(*hmi_message); - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); @@ -231,7 +231,7 @@ TEST_F(GetInteriorVehicleDataRequestTest, application_manager::event_engine::Event event( hmi_apis::FunctionID::RC_GetInteriorVehicleData); event.set_smart_object(*hmi_message); - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::GetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>( mobile_message); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc index 78d20c6b13..690586d0e1 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_interior_vehicle_data_notification_test.cc @@ -66,7 +66,7 @@ class OnInteriorVehicleDataNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: OnInteriorVehicleDataNotificationTest() - : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) {} + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) {} MessageSharedPtr CreateBasicMessage() { MessageSharedPtr message = CreateMessage(); @@ -85,10 +85,10 @@ class OnInteriorVehicleDataNotificationTest } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -97,7 +97,7 @@ class OnInteriorVehicleDataNotificationTest } protected: - utils::SharedPtr<MockApplication> mock_app_; + std::shared_ptr<MockApplication> mock_app_; testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager> mock_allocation_manager_; }; @@ -115,7 +115,7 @@ TEST_F(OnInteriorVehicleDataNotificationTest, EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); rc_extention_ptr->SubscribeToInteriorVehicleData(enums_value::kClimate); ON_CALL(*mock_app_, QueryInterface(_)) @@ -126,14 +126,14 @@ TEST_F(OnInteriorVehicleDataNotificationTest, EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, false)) .WillOnce(SaveArg<0>(&message)); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::OnInteriorVehicleDataNotification> command = CreateRCCommand< rc_rpc_plugin::commands::OnInteriorVehicleDataNotification>( mobile_message); command->Run(); // Assertions - ASSERT_TRUE(message); + ASSERT_TRUE((bool)message); Mock::VerifyAndClearExpectations(&app_mngr_); } diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc index f3ac768a4e..907292f150 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/on_remote_control_settings_test.cc @@ -67,7 +67,7 @@ class RCOnRemoteControlSettingsNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { public: RCOnRemoteControlSettingsNotificationTest() - : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) {} + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) {} MessageSharedPtr CreateBasicMessage() { MessageSharedPtr message = CreateMessage(); (*message)[application_manager::strings::params] @@ -85,10 +85,10 @@ class RCOnRemoteControlSettingsNotificationTest } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -97,7 +97,7 @@ class RCOnRemoteControlSettingsNotificationTest } protected: - utils::SharedPtr<MockApplication> mock_app_; + std::shared_ptr<MockApplication> mock_app_; testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager> mock_allocation_manager_; }; @@ -116,7 +116,7 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest, EXPECT_CALL(mock_allocation_manager_, SetAccessMode(hmi_apis::Common_RCAccessMode::ASK_DRIVER)); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> command = CreateRCCommand< rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>( @@ -141,7 +141,7 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest, EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); rc_extention_ptr->SubscribeToInteriorVehicleData(enums_value::kClimate); ON_CALL(*mock_app_, QueryInterface(_)) @@ -150,7 +150,7 @@ TEST_F(RCOnRemoteControlSettingsNotificationTest, EXPECT_CALL(mock_allocation_manager_, ResetAllAllocations()); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification> command = CreateRCCommand< rc_rpc_plugin::commands::RCOnRemoteControlSettingsNotification>( diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc index c5a8e54c6d..a1fff199ee 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/rc_get_interior_vehicle_data_consent_test.cc @@ -53,7 +53,7 @@ #include "interfaces/MOBILE_API.h" #include "include/test/protocol_handler/mock_protocol_handler.h" #include "test/application_manager/mock_application_manager_settings.h" -#include "utils/make_shared.h" + using ::testing::_; using ::testing::Return; @@ -62,7 +62,7 @@ using ::testing::NiceMock; using ::testing::SaveArg; using ::testing::Mock; using ::testing::NiceMock; -using ::utils::SharedPtr; + namespace am = ::application_manager; using am::ApplicationSet; using am::commands::MessageSharedPtr; @@ -99,7 +99,7 @@ class RCGetInteriorVehicleDataConsentTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: RCGetInteriorVehicleDataConsentTest() - : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) , command_holder(app_mngr_) , request_controller(mock_request_controler) , rpc_service(app_mngr_, @@ -107,9 +107,9 @@ class RCGetInteriorVehicleDataConsentTest &mock_protocol_handler, &mock_hmi_handler, command_holder) - , rc_app_extention_(utils::MakeShared<RCAppExtension>(kPluginID)) + , rc_app_extention_(std::make_shared<RCAppExtension>(kPluginID)) , mock_rpc_plugin_manager( - utils::MakeShared<NiceMock<MockRPCPluginManager> >()) + std::make_shared<NiceMock<MockRPCPluginManager> >()) , rpc_plugin(mock_rpc_plugin) , optional_mock_rpc_plugin(mock_rpc_plugin) { ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId)); @@ -146,10 +146,10 @@ class RCGetInteriorVehicleDataConsentTest } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, rpc_service, mock_hmi_capabilities_, @@ -170,7 +170,7 @@ class RCGetInteriorVehicleDataConsentTest } protected: - utils::SharedPtr<MockApplication> mock_app_; + std::shared_ptr<MockApplication> mock_app_; MockRequestControlerSettings mock_request_controler; MockProtocolHandler mock_protocol_handler; MockHMIMessageHandler mock_hmi_handler; @@ -182,8 +182,8 @@ class RCGetInteriorVehicleDataConsentTest MockCommandFactory mock_command_factory; am::request_controller::RequestController request_controller; am::rpc_service::RPCServiceImpl rpc_service; - utils::SharedPtr<RCAppExtension> rc_app_extention_; - utils::SharedPtr<am::plugin_manager::MockRPCPluginManager> + std::shared_ptr<RCAppExtension> rc_app_extention_; + std::shared_ptr<am::plugin_manager::MockRPCPluginManager> mock_rpc_plugin_manager; utils::Optional<RPCPlugin> rpc_plugin; utils::Optional<MockRPCPlugin> optional_mock_rpc_plugin; diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc index 1d5e63e2df..fdee55a30c 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc @@ -64,8 +64,8 @@ class SetInteriorVehicleDataRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { public: SetInteriorVehicleDataRequestTest() - : mock_app_(utils::MakeShared<NiceMock<MockApplication> >()) - , rc_app_extention_(utils::MakeShared<RCAppExtension>(kModuleId)) {} + : mock_app_(std::make_shared<NiceMock<MockApplication> >()) + , rc_app_extention_(std::make_shared<RCAppExtension>(kModuleId)) {} void SetUp() OVERRIDE { ON_CALL(app_mngr_, hmi_interfaces()) @@ -106,10 +106,10 @@ class SetInteriorVehicleDataRequestTest } template <class Command> - application_manager::SharedPtr<Command> CreateRCCommand( + std::shared_ptr<Command> CreateRCCommand( MessageSharedPtr& msg) { InitCommand(kDefaultTimeout_); - return ::utils::MakeShared<Command>(msg ? msg : msg = CreateMessage(), + return std::make_shared<Command>(msg ? msg : msg = CreateMessage(), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -120,8 +120,8 @@ class SetInteriorVehicleDataRequestTest protected: testing::NiceMock<rc_rpc_plugin_test::MockResourceAllocationManager> mock_allocation_manager_; - utils::SharedPtr<MockApplication> mock_app_; - utils::SharedPtr<RCAppExtension> rc_app_extention_; + std::shared_ptr<MockApplication> mock_app_; + std::shared_ptr<RCAppExtension> rc_app_extention_; }; TEST_F(SetInteriorVehicleDataRequestTest, @@ -147,7 +147,7 @@ TEST_F(SetInteriorVehicleDataRequestTest, mobile_apis::Result::READ_ONLY), application_manager::commands::Command::SOURCE_SDL)); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); @@ -186,7 +186,7 @@ TEST_F( application_manager::commands::Command::SOURCE_SDL)); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); @@ -217,7 +217,7 @@ TEST_F( application_manager::commands::Command::SOURCE_SDL)); // Act - application_manager::SharedPtr< + std::shared_ptr< rc_rpc_plugin::commands::SetInteriorVehicleDataRequest> command = CreateRCCommand<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>( mobile_message); diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc index 28142f0b4e..3842814f84 100644 --- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc +++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc @@ -39,8 +39,8 @@ #include "application_manager/mock_application_manager.h" #include "application_manager/mock_rpc_service.h" #include "application_manager/policies/mock_policy_handler_interface.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -83,16 +83,16 @@ using namespace rc_rpc_plugin; class RAManagerTest : public ::testing::Test { public: RAManagerTest() - : message_(utils::MakeShared<Message>(MessagePriority::FromServiceType( + : message_(std::make_shared<Message>(MessagePriority::FromServiceType( protocol_handler::ServiceType::kRpc))) - , mock_app_1_(utils::MakeShared<NiceMock<MockApplication> >()) - , mock_app_2_(utils::MakeShared<NiceMock<MockApplication> >()) + , mock_app_1_(std::make_shared<NiceMock<MockApplication> >()) + , mock_app_2_(std::make_shared<NiceMock<MockApplication> >()) , apps_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , apps_da_(apps_, apps_lock_ptr_) { ON_CALL(mock_app_mngr_, GetPolicyHandler()) .WillByDefault(ReturnRef(mock_policy_handler_)); auto plugin_id = rc_rpc_plugin::RCRPCPlugin::kRCPluginID; - app_ext_ptr_ = utils::MakeShared<rc_rpc_plugin::RCAppExtension>(plugin_id); + app_ext_ptr_ = std::make_shared<rc_rpc_plugin::RCAppExtension>(plugin_id); ON_CALL(*mock_app_1_, app_id()).WillByDefault(Return(kAppId1)); OnRCStatusNotificationExpectations(); @@ -114,8 +114,8 @@ class RAManagerTest : public ::testing::Test { application_manager::MessagePtr message_; application_manager::AppExtensionPtr app_ext_ptr_; - utils::SharedPtr<NiceMock<MockApplication> > mock_app_1_; - utils::SharedPtr<NiceMock<MockApplication> > mock_app_2_; + std::shared_ptr<NiceMock<MockApplication> > mock_app_1_; + std::shared_ptr<NiceMock<MockApplication> > mock_app_2_; application_manager::ApplicationSet apps_; std::shared_ptr<sync_primitives::Lock> apps_lock_ptr_; DataAccessor<application_manager::ApplicationSet> apps_da_; @@ -301,7 +301,7 @@ TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) { .WillRepeatedly(Return(mock_app_2_)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); EXPECT_CALL(*mock_app_2_, QueryInterface(_)) @@ -327,7 +327,7 @@ TEST_F(RAManagerTest, AppUnregistered_ReleaseResource) { ra_manager.SetAccessMode(hmi_apis::Common_RCAccessMode::eType::AUTO_DENY); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED, @@ -361,7 +361,7 @@ TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) { .WillRepeatedly(Return(mock_app_2_)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); EXPECT_CALL(*mock_app_2_, QueryInterface(_)) @@ -404,7 +404,7 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) { EXPECT_CALL(mock_app_mngr_, applications()).WillRepeatedly(Return(apps_da)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<RCAppExtension>(application_manager::AppExtensionUID( + std::make_shared<RCAppExtension>(application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); EXPECT_CALL(*mock_app_1_, QueryInterface(RCRPCPlugin::kRCPluginID)) @@ -434,7 +434,7 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) { .WillRepeatedly(Return(mock_app_1_)); RCAppExtensionPtr rc_extention_ptr = - utils::MakeShared<rc_rpc_plugin::RCAppExtension>( + std::make_shared<rc_rpc_plugin::RCAppExtension>( application_manager::AppExtensionUID( rc_rpc_plugin::RCRPCPlugin::kRCPluginID)); @@ -659,7 +659,7 @@ TEST_F(RAManagerTest, OnRCStatus_ModuleAllocation) { // Act ra_manager.SendOnRCStatusNotifications( NotificationTrigger::MODULE_ALLOCATION, - utils::SharedPtr<application_manager::Application>()); + std::shared_ptr<application_manager::Application>()); auto msg_to_mob_params = (*message_to_mob)[application_manager::strings::msg_params]; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc index 52b95d3fa3..ae375e4087 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/get_urls.cc @@ -188,7 +188,7 @@ void GetUrls::ProcessPolicyServiceURLs(const policy::EndpointUrls& endpoints) { ApplicationSharedPtr app = application_manager_.application(app_id_to_send_to); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "There is no registered application with " "connection key '" diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc index 839c16ca08..ae8806c4eb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_app_permission_consent_notification.cc @@ -40,7 +40,7 @@ #include <string> #include "policy/policy_types.h" #include "smart_objects/smart_object.h" -#include "utils/make_shared.h" + namespace { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc index 16ca48a2d4..32dd8caefd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc @@ -37,7 +37,7 @@ #include "application_manager/message_helper.h" #include "interfaces/MOBILE_API.h" #include "interfaces/HMI_API.h" -#include "utils/make_shared.h" + namespace sdl_rpc_plugin { using namespace application_manager; @@ -115,7 +115,7 @@ void OnDriverDistractionNotification::Run() { application_manager_.set_driver_distraction_state(state); smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); if (!on_driver_distraction) { LOG4CXX_ERROR(logger_, "NULL pointer"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc index 9131bf7392..1ba092a446 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_all_applications_notification.cc @@ -109,7 +109,7 @@ void OnExitAllApplicationsNotification::SendOnSDLPersistenceComplete() { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_OnSDLPersistenceComplete; (*message)[strings::params][strings::message_type] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc index d2a149bf94..681390fbf4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc @@ -67,7 +67,7 @@ void OnExitApplicationNotification::Run() { uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt(); ApplicationSharedPtr app_impl = application_manager_.application(app_id); - if (!(app_impl.valid())) { + if (app_impl.use_count() == 0) { LOG4CXX_ERROR(logger_, "Application does not exist"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc index cfb860a1c7..d795896764 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_request_notification.cc @@ -91,7 +91,7 @@ void OnSystemRequestNotification::Run() { app = application_manager_.application(selected_app_id); } - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "No valid application found to forward OnSystemRequest."); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc index 4b3d303089..d538878dc8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/rc_is_ready_request.cc @@ -97,7 +97,7 @@ void RCIsReadyRequest::onTimeOut() { } void RCIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + std::shared_ptr<smart_objects::SmartObject> get_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::RC_GetCapabilities, application_manager_)); rpc_service_.ManageHMICommand(get_capabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc index 32d3cba48a..c7e2c0c4cb 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/tts_is_ready_request.cc @@ -94,18 +94,18 @@ void TTSIsReadyRequest::onTimeOut() { } void TTSIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( + std::shared_ptr<smart_objects::SmartObject> get_language( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_GetLanguage, application_manager_)); HMICapabilities& hmi_capabilities = hmi_capabilities_; hmi_capabilities.set_handle_response_for(*get_language); rpc_service_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + std::shared_ptr<smart_objects::SmartObject> get_all_languages( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::TTS_GetSupportedLanguages, application_manager_)); rpc_service_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + std::shared_ptr<smart_objects::SmartObject> get_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::TTS_GetCapabilities, application_manager_)); rpc_service_.ManageHMICommand(get_capabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc index 3b2c77f16e..2eab211690 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_is_ready_request.cc @@ -93,18 +93,18 @@ void UIIsReadyRequest::onTimeOut() { } void UIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( + std::shared_ptr<smart_objects::SmartObject> get_language( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_GetLanguage, application_manager_)); HMICapabilities& hmi_capabilities = hmi_capabilities_; hmi_capabilities.set_handle_response_for(*get_language); rpc_service_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + std::shared_ptr<smart_objects::SmartObject> get_all_languages( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::UI_GetSupportedLanguages, application_manager_)); rpc_service_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + std::shared_ptr<smart_objects::SmartObject> get_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::UI_GetCapabilities, application_manager_)); rpc_service_.ManageHMICommand(get_capabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc index dcf7f35e90..22afb03945 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/vr_is_ready_request.cc @@ -93,18 +93,18 @@ void VRIsReadyRequest::onTimeOut() { } void VRIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_language( + std::shared_ptr<smart_objects::SmartObject> get_language( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, application_manager_)); HMICapabilities& hmi_capabilities = hmi_capabilities_; hmi_capabilities.set_handle_response_for(*get_language); rpc_service_.ManageHMICommand(get_language); - utils::SharedPtr<smart_objects::SmartObject> get_all_languages( + std::shared_ptr<smart_objects::SmartObject> get_all_languages( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VR_GetSupportedLanguages, application_manager_)); rpc_service_.ManageHMICommand(get_all_languages); - utils::SharedPtr<smart_objects::SmartObject> get_capabilities( + std::shared_ptr<smart_objects::SmartObject> get_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VR_GetCapabilities, application_manager_)); rpc_service_.ManageHMICommand(get_capabilities); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc index 1da9fc497f..fc836aae5f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc @@ -592,7 +592,7 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() { void AddCommandRequest::RemoveCommand() { LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "No application associated with session key"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc index 0dda8b3277..40debbcd4d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc @@ -149,7 +149,7 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) { } smart_objects::SmartObjectSPtr on_btn_event = - new smart_objects::SmartObject(); + std::make_shared<smart_objects::SmartObject>(); if (!on_btn_event) { LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc index 06ff29134c..faf6ffe38b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc @@ -138,7 +138,7 @@ void OnButtonPressNotification::Run() { } // if "appID" is present, send it to named app only if its FULL or // LIMITED - if (app.valid()) { + if (app.use_count() != 0) { if (app->app_id() == subscribed_app->app_id()) { SendButtonPress(subscribed_app); } @@ -156,7 +156,7 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) { } smart_objects::SmartObjectSPtr on_btn_press = - new smart_objects::SmartObject(); + std::make_shared<smart_objects::SmartObject>(); if (!on_btn_press) { LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer"); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc index 9422bec478..6b5838e40a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification.cc @@ -61,7 +61,7 @@ void OnHMIStatusNotification::Run() { (*message_)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "OnHMIStatusNotification application doesn't exist"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc index 45caedfc2e..c4ee22afed 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_hmi_status_notification_from_mobile.cc @@ -60,7 +60,7 @@ void OnHMIStatusNotificationFromMobile::Run() { static_cast<int32_t>(application_manager::MessageType::kNotification); ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR( logger_, "OnHMIStatusNotificationFromMobile application doesn't exist"); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc index 2065c0b52d..04b52f29e1 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc @@ -82,7 +82,7 @@ void OnKeyBoardInputNotification::Run() { } } - if (app_to_notify.valid()) { + if (app_to_notify.use_count() != 0) { (*message_)[strings::params][strings::connection_key] = app_to_notify->app_id(); SendNotification(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index 419024f9b0..b78e541f17 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -68,7 +68,7 @@ void OnSystemRequestNotification::Run() { ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Application with connection key " << connection_key() << " is not registered."); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc index 18fe00b54a..92d44d4fe8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc @@ -301,7 +301,7 @@ void PutFileRequest::Run() { void PutFileRequest::SendOnPutFileNotification() { LOG4CXX_INFO(logger_, "SendOnPutFileNotification"); smart_objects::SmartObjectSPtr notification = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc index 4706f9742f..78a92d360a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc @@ -38,7 +38,6 @@ #include <map> #include <string.h> -#include <utils/make_shared.h> #include "application_manager/application_manager.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/application_impl.h" @@ -419,7 +418,7 @@ RegisterAppInterfaceRequest::GetLockScreenIconUrlNotification( const uint32_t connection_key, ApplicationSharedPtr app) { DCHECK_OR_RETURN(app.get(), smart_objects::SmartObjectSPtr()); smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnSystemRequestID; @@ -838,7 +837,7 @@ void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI( bool resumption, bool need_restore_vr) { using namespace smart_objects; - SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr notification = std::make_shared<SmartObject>(SmartType_Map); if (!notification) { LOG4CXX_ERROR(logger_, "Failed to create smart object"); return; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc index 3cb57c90e8..e6332d85c8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_app_icon_request.cc @@ -259,7 +259,7 @@ void SetAppIconRequest::on_event(const event_engine::Event& event) { ApplicationSharedPtr app = application_manager_.application(connection_key()); - if (!message_.valid() || !app.valid()) { + if ((message_.use_count() == 0) || (app.use_count() == 0)) { LOG4CXX_ERROR(logger_, "NULL pointer."); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc index 92c72d7f66..b4b4e84f49 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc @@ -284,7 +284,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { ui_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, ui_response_info_); - if (application.valid()) { + if (application.use_count() != 0) { auto& help_prompt_manager = application->help_prompt_manager(); help_prompt_manager.OnSetGlobalPropertiesReceived(message, true); } @@ -297,7 +297,7 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) { tts_result_ = static_cast<hmi_apis::Common_Result::eType>( message[strings::params][hmi_response::code].asInt()); GetInfo(message, tts_response_info_); - if (application.valid()) { + if (application.use_count() != 0) { auto& help_prompt_manager = application->help_prompt_manager(); help_prompt_manager.OnSetGlobalPropertiesReceived(message, true); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc index 80a28b288c..0fdf6d83cf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc @@ -276,7 +276,7 @@ void ShowRequest::Run() { SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true); app_mngr::commands::MessageSharedPtr persistentData = - new smart_objects::SmartObject(msg_params); + std::make_shared<smart_objects::SmartObject>(msg_params); app->set_show_command(*persistentData); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc index 62eb2d59c5..78de02b527 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc @@ -452,7 +452,7 @@ void SystemRequest::Run() { ApplicationSharedPtr application = application_manager_.application(connection_key()); - if (!(application.valid())) { + if (application.use_count() == 0) { LOG4CXX_ERROR(logger_, "NULL pointer"); SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED); return; @@ -655,7 +655,7 @@ void SystemRequest::on_event(const event_engine::Event& event) { ApplicationSharedPtr application = application_manager_.application(connection_key()); - if (!(application.valid())) { + if (application.use_count() == 0) { LOG4CXX_ERROR(logger_, "NULL pointer"); return; } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc index d27161ff77..32113228f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc @@ -125,7 +125,7 @@ #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_request.h" #include "sdl_rpc_plugin/commands/mobile/send_haptic_data_response.h" #include "interfaces/MOBILE_API.h" -#include "utils/make_shared.h" + CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager") namespace sdl_rpc_plugin { 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 8cb5e97891..20298c7d33 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 @@ -32,7 +32,7 @@ #include "gtest/gtest.h" #include "hmi/activate_app_request.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/command_impl.h" #include "application_manager/commands/commands_test.h" @@ -45,7 +45,7 @@ namespace hmi_commands_test { namespace activate_app_request { using ::testing::_; -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using am::commands::MessageSharedPtr; @@ -54,8 +54,8 @@ using am::commands::CommandImpl; using ::test::components::application_manager_test::MockApplication; -typedef SharedPtr<MockApplication> MockAppPtr; -typedef ::utils::SharedPtr<ActivateAppRequest> ActivateAppRequestPtr; +typedef std::shared_ptr<MockApplication> MockAppPtr; +typedef std::shared_ptr<ActivateAppRequest> ActivateAppRequestPtr; MATCHER_P(CheckMessage, level, "") { return level == 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 d43d70b5ca..a5707488dd 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 @@ -32,7 +32,7 @@ #include "gtest/gtest.h" #include "hmi/add_statistics_info_notification.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -58,7 +58,7 @@ using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -typedef ::utils::SharedPtr<AddStatisticsInfoNotification> NotificationPtr; +typedef std::shared_ptr<AddStatisticsInfoNotification> NotificationPtr; namespace { const uint32_t kStatisticType = 1u; 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 4b7fb0fc09..a2fcf8f605 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 @@ -32,7 +32,7 @@ #include "gtest/gtest.h" #include "hmi/allow_all_apps_response.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/command_impl.h" #include "application_manager/commands/commands_test.h" @@ -49,7 +49,7 @@ using sdl_rpc_plugin::commands::AllowAllAppsResponse; namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; -typedef ::utils::SharedPtr<AllowAllAppsResponse> ResponsePtr; +typedef std::shared_ptr<AllowAllAppsResponse> ResponsePtr; namespace { const bool kResponseIsAllowed = true; 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 3681bf01b6..2ce400542a 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 @@ -32,7 +32,7 @@ #include "gtest/gtest.h" #include "hmi/allow_app_response.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -55,7 +55,7 @@ const uint32_t kConnectionKey = 1u; const bool kIsResponseAllowed = true; } -typedef ::utils::SharedPtr<AllowAppResponse> ResponsePtr; +typedef std::shared_ptr<AllowAppResponse> ResponsePtr; class AllowAppResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> {}; 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 78fec997e9..a3f0ab6933 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 @@ -33,7 +33,7 @@ #include "hmi/basic_communication_get_system_time_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/command_request_test.h" #include "protocol_handler/mock_protocol_handler.h" 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 930e024b4b..6ed15bebeb 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 @@ -32,7 +32,7 @@ #include "gtest/gtest.h" #include "hmi/button_get_capabilities_response.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -51,7 +51,7 @@ using ::testing::NiceMock; namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; -typedef ::utils::SharedPtr<ButtonGetCapabilitiesResponse> ResponsePtr; +typedef std::shared_ptr<ButtonGetCapabilitiesResponse> ResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> 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 1bae77bb30..775f3b653f 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" @@ -49,13 +49,13 @@ namespace commands_test { namespace hmi_commands_test { namespace close_popup_response { -using ::utils::SharedPtr; + namespace am = ::application_manager; using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::ClosePopupResponse; using am::commands::CommandImpl; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; class ClosePopupResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> { }; 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 b8b84f13c9..0f02deded0 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 @@ -506,30 +506,30 @@ TYPED_TEST_CASE(HMICommandsTestFourth, HMICommandsListFourth); TYPED_TEST_CASE(HMICommandsTestFifth, HMICommandsListFifth); TYPED_TEST(HMICommandsTestFirst, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(HMICommandsTestSecond, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(HMICommandsTestThird, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(HMICommandsTestFourth, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(HMICommandsTestFifth, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } 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 6262e1dd8a..ee576aedb6 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -49,14 +49,14 @@ namespace commands_test { namespace hmi_commands_test { namespace get_system_info_request { -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using am::commands::RequestToHMI; using sdl_rpc_plugin::commands::GetSystemInfoRequest; using am::commands::CommandImpl; -typedef SharedPtr<RequestToHMI> RequestToHMIPtr; +typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr; namespace { const uint32_t kConnectionKey = 2u; 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 3a68264e2a..0333102370 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/application.h" @@ -52,7 +52,7 @@ namespace hmi_commands_test { namespace get_system_info_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -62,7 +62,7 @@ using sdl_rpc_plugin::commands::GetSystemInfoResponse; using sdl_rpc_plugin::commands::SystemInfo; using am::commands::CommandImpl; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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/get_urls_response_test.cc index 05169e5067..bef49826ce 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/get_urls_response_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" @@ -52,14 +52,14 @@ namespace get_urls_response { using ::testing::_; using ::testing::Return; -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::GetUrlsResponse; using am::commands::ResponseToHMI; using am::commands::CommandImpl; -typedef SharedPtr<ResponseToHMI> ResponseToHMIPtr; +typedef std::shared_ptr<ResponseToHMI> ResponseToHMIPtr; namespace { const uint32_t kConnectionKey = 2u; 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 index 7788cb2ebe..8d785c8a69 100644 --- 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/message.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -58,7 +58,7 @@ namespace get_urls { using namespace hmi_apis; using namespace policy; -using ::utils::SharedPtr; + using ::testing::NiceMock; using ::testing::_; using ::testing::SetArgReferee; @@ -71,7 +71,7 @@ using am::commands::CommandImpl; using policy::PolicyHandler; using policy_test::MockPolicyHandlerInterface; -typedef SharedPtr<RequestFromHMI> RequestFromHMIPtr; +typedef std::shared_ptr<RequestFromHMI> RequestFromHMIPtr; namespace { const uint32_t kInvalidAppId_ = 0u; 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 245bb72860..bdbf2db216 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 @@ -90,8 +90,8 @@ #include "utils/lock.h" #include "utils/data_accessor.h" #include "utils/signals.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/file_system.h" #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -126,7 +126,7 @@ using ::testing::Return; using ::testing::ReturnRef; using ::testing::NiceMock; using ::testing::InSequence; -using ::utils::SharedPtr; + using ::smart_objects::SmartObject; using ::application_manager::commands::MessageSharedPtr; using ::test::components::application_manager_test::MockApplicationManager; @@ -139,7 +139,7 @@ using ::application_manager::MockMessageHelper; using namespace sdl_rpc_plugin::commands; using namespace am::commands; -typedef SharedPtr<MockApplication> MockAppPtr; +typedef std::shared_ptr<MockApplication> MockAppPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; @@ -348,7 +348,7 @@ TYPED_TEST_CASE(HMIOnNotificationsEventDispatcher, TYPED_TEST(HMIOnNotificationsListToHMI, CommandsSendNotificationToHmi) { MessageSharedPtr message = commands_test::CommandsTest<kIsNice>::CreateMessage(); - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(message); EXPECT_CALL(commands_test::CommandsTest<kIsNice>::mock_rpc_service_, SendMessageToHMI(_)); @@ -366,7 +366,7 @@ TYPED_TEST(HMIOnNotificationsEventDispatcher, int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = commands_test::CommandsTest<kIsNice>::CreateMessage(); - utils::SharedPtr<typename TestFixture::CommandType::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType::CommandType> command = this->template CreateCommand< typename TestFixture::CommandType::CommandType>(message); EXPECT_CALL(commands_test::CommandsTest<kIsNice>::app_mngr_, @@ -381,7 +381,7 @@ TYPED_TEST(HMIOnNotificationsEventDispatcher, // notifications(SendNotificationToMobile) TEST_F(HMICommandsNotificationsTest, OnButtonEventSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnButtonEventNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -394,7 +394,7 @@ TEST_F(HMICommandsNotificationsTest, OnButtonEventSendNotificationToMobile) { TEST_F(HMICommandsNotificationsTest, OnNaviTBTClientSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnNaviTBTClientStateNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -408,7 +408,7 @@ TEST_F(HMICommandsNotificationsTest, OnNaviTBTClientSendNotificationToMobile) { TEST_F(HMICommandsNotificationsTest, OnNaviWayPointChangeSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnNaviWayPointChangeNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -421,7 +421,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnUICommandSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnUICommandNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -438,7 +438,7 @@ TEST_F(HMICommandsNotificationsTest, OnUICommandSendNotificationToMobile) { TEST_F(HMICommandsNotificationsTest, OnUIKeyBoardInputSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnUIKeyBoardInputNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -451,7 +451,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnUITouchEventSendNotificationToMobile) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnUITouchEventNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -466,7 +466,7 @@ TEST_F(HMICommandsNotificationsTest, OnAppRegisteredNotificationSendNotificationToHmi) { int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppRegisteredNotification>(message); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)); EXPECT_CALL(app_mngr_, event_dispatcher()); @@ -488,7 +488,7 @@ TEST_F(HMICommandsNotificationsTest, OnAppUnregisteredNotificationEventDispatcher) { int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppUnregisteredNotification>(message); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)); EXPECT_CALL(app_mngr_, event_dispatcher()); @@ -509,7 +509,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) { int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnButtonPressNotification>(message); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL)); @@ -526,7 +526,7 @@ TEST_F(HMICommandsNotificationsTest, OnButtonPressNotificationEventDispatcher) { TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) { int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnReadyNotification>(message); EXPECT_CALL(app_mngr_, OnHMIStartedCooperation()); @@ -541,7 +541,7 @@ TEST_F(HMICommandsNotificationsTest, OnReadyNotificationEventDispatcher) { TEST_F(HMICommandsNotificationsTest, OnIgnitionCycleOverNotificationPolicyHandler) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnIgnitionCycleOverNotification>(message); EXPECT_CALL(mock_policy_handler_, OnIgnitionCycleOver()); @@ -550,7 +550,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnPolicyUpdateNotificationPolicyHandler) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = CreateCommand<OnPolicyUpdate>(message); + std::shared_ptr<Command> command = CreateCommand<OnPolicyUpdate>(message); EXPECT_CALL(mock_policy_handler_, OnPTExchangeNeeded()); command->Run(); @@ -567,7 +567,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(smart_objects::SmartType_String); (*message)[am::strings::msg_params][am::hmi_notification::policyfile] = kFile; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnReceivedPolicyUpdate>(message); EXPECT_CALL(mock_policy_handler_, ReceiveMessageFromSDK(kFile, data)); @@ -579,7 +579,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnReceivePolicyUpdateNotification_UNSUCCESS) { MessageSharedPtr message = CreateMessage(smart_objects::SmartType_String); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnReceivedPolicyUpdate>(message); EXPECT_CALL(mock_policy_handler_, ReceiveMessageFromSDK(_, _)).Times(0); @@ -597,7 +597,7 @@ TEST_F(HMICommandsNotificationsTest, smart_objects::SmartObject hmi_application_temp(smart_objects::SmartType_Map); applications[0] = hmi_application_temp; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppPermissionConsentNotification>(message); int32_t connection_id = -1; @@ -619,11 +619,11 @@ TEST_F(HMICommandsNotificationsTest, smart_objects::SmartObject(smart_objects::SmartType_Array); smart_objects::SmartObjectSPtr consented_function = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*message)[am::strings::msg_params]["consentedFunctions"][0] = *consented_function; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppPermissionConsentNotification>(message); int32_t connection_id = -1; @@ -653,14 +653,14 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params]["source"] = "test_content_source"; smart_objects::SmartObjectSPtr consented_function = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*consented_function)["allowed"] = true; (*consented_function)[am::strings::id] = 999; (*consented_function)[am::strings::name] = "test_group_alias"; (*message)[am::strings::msg_params]["consentedFunctions"][0] = *consented_function; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppPermissionConsentNotification>(message); int32_t connection_id = -1; @@ -694,14 +694,14 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params]["source"] = "test_content_source"; smart_objects::SmartObjectSPtr consented_function = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*consented_function)["allowed"] = false; (*consented_function)[am::strings::id] = 999; (*consented_function)[am::strings::name] = "test_group_alias"; (*message)[am::strings::msg_params]["consentedFunctions"][0] = *consented_function; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAppPermissionConsentNotification>(message); int32_t connection_id = -1; @@ -732,7 +732,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::hmi_notification::error] = hmi_apis::Common_SystemError::SYNC_REBOOTED; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemErrorNotification>(message); int32_t code = hmi_apis::Common_SystemError::INVALID_ENUM; @@ -748,7 +748,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLangCode; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemInfoChangedNotification>(message); EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_)); @@ -761,7 +761,7 @@ TEST_F(HMICommandsNotificationsTest, const std::string kDeviceId = ""; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_response::allowed] = true; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAllowSDLFunctionalityNotification>(message); bool value = false; @@ -779,7 +779,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_response::allowed] = true; (*message)[am::strings::msg_params]["device"]["id"] = kDeviceId; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnAllowSDLFunctionalityNotification>(message); bool value; @@ -796,7 +796,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params]["deviceState"] = hmi_apis::Common_DeviceState::INVALID_ENUM; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceStateChangedNotification>(message); EXPECT_CALL(mock_policy_handler_, RemoveDevice(_)).Times(0); @@ -812,7 +812,7 @@ TEST_F(HMICommandsNotificationsTest, hmi_apis::Common_DeviceState::UNPAIRED; (*message)[am::strings::msg_params]["deviceInternalId"] = device_id; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceStateChangedNotification>(message); EXPECT_CALL(mock_policy_handler_, RemoveDevice(_)); @@ -827,7 +827,7 @@ TEST_F(HMICommandsNotificationsTest, hmi_apis::Common_DeviceState::UNPAIRED; (*message)[am::strings::msg_params]["deviceInternalId"] = empty_device_id; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceStateChangedNotification>(message); std::string device_id = "default_id"; @@ -847,7 +847,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params]["deviceInternalId"] = empty_device_id; (*message)[am::strings::msg_params]["deviceId"]["id"] = id; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceStateChangedNotification>(message); std::string device_id = "default_id"; @@ -864,7 +864,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::hmi_request::reason] = hmi_apis::Common_ApplicationsCloseReason::IGNITION_OFF; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitAllApplicationsNotification>(message); #if defined(OS_POSIX) am::mobile_api::AppInterfaceUnregisteredReason::eType mob_reason; @@ -906,7 +906,7 @@ TEST_F(HMICommandsNotificationsTest, for (; it_reason != reason_list.end(); ++it_reason, ++it_mob_reason) { (*message)[am::strings::msg_params][am::hmi_request::reason] = *it_reason; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitAllApplicationsNotification>(message); #if defined(OS_POSIX) am::mobile_api::AppInterfaceUnregisteredReason::eType mob_reason = @@ -928,7 +928,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::hmi_request::reason] = hmi_apis::Common_ApplicationsCloseReason::SUSPEND; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitAllApplicationsNotification>(message); MessageSharedPtr ethalon_message = @@ -970,7 +970,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::hmi_request::reason] = hmi_apis::Common_ApplicationsCloseReason::INVALID_ENUM; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitAllApplicationsNotification>(message); EXPECT_CALL(app_mngr_, SetUnregisterAllApplicationsReason(_)).Times(0); @@ -985,7 +985,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*notification)[am::strings::params][am::strings::function_id] = static_cast<int32_t>( mobile_apis::FunctionID::OnAppInterfaceUnregisteredID); @@ -1013,7 +1013,7 @@ TEST_F(HMICommandsNotificationsTest, for (; it_reason != reason_list.end(); ++it_reason, ++it_mobile_reason) { (*message)[am::strings::msg_params][am::strings::reason] = *it_reason; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitApplicationNotification>(message); (*notification)[am::strings::msg_params][am::strings::reason] = @@ -1044,7 +1044,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::strings::reason] = hmi_apis::Common_ApplicationExitReason::INVALID_ENUM; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitApplicationNotification>(message); am::plugin_manager::MockRPCPluginManager mock_rpc_plugin_manager_; @@ -1064,7 +1064,7 @@ TEST_F(HMICommandsNotificationsTest, OnExitApplicationNotificationInvalidApp) { MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitApplicationNotification>(message); am::ApplicationSharedPtr invalid_app; @@ -1082,7 +1082,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; (*message)[am::strings::msg_params][am::strings::reason] = hmi_apis::Common_ApplicationExitReason::DRIVER_DISTRACTION_VIOLATION; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitApplicationNotification>(message); EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_)); @@ -1104,7 +1104,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; (*message)[am::strings::msg_params][am::strings::reason] = hmi_apis::Common_ApplicationExitReason::USER_EXIT; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnExitApplicationNotification>(message); am::plugin_manager::MockRPCPluginManager mock_rpc_plugin_manager_; EXPECT_CALL(app_mngr_, GetPluginManager()) @@ -1131,7 +1131,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::cmd_id] = cmd_id; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app_)); @@ -1153,7 +1153,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); am::ApplicationSharedPtr invalid_app; @@ -1172,7 +1172,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); EXPECT_CALL(app_mngr_, application(_)).Times(0); @@ -1189,7 +1189,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); am::ApplicationSharedPtr invalid_app; @@ -1210,7 +1210,7 @@ TEST_F(HMICommandsNotificationsTest, int32_t event_id = hmi_apis::FunctionID::INVALID_ENUM; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); @@ -1236,7 +1236,7 @@ TEST_F(HMICommandsNotificationsTest, (*message)[am::strings::msg_params][am::strings::cmd_id] = kCmdId; (*message)[am::strings::msg_params][am::strings::function_id] = mobile_apis::FunctionID::eType::OnCommandID; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRCommandNotification>(message); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); @@ -1263,7 +1263,7 @@ TEST_F(HMICommandsNotificationsTest, OnVRLanguageChangeNotificationEmptyData) { const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRLanguageChangeNotification>(message); EXPECT_CALL(mock_hmi_capabilities_, active_ui_language()) @@ -1281,7 +1281,7 @@ TEST_F(HMICommandsNotificationsTest, const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRLanguageChangeNotification>(message); application_set_.insert(app_); @@ -1314,12 +1314,12 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = mobile_apis::Language::EN_US; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnVRLanguageChangeNotification>(message); application_set_.insert(app_); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*notification)[am::strings::params][am::strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); (*notification)[am::strings::params][am::strings::message_type] = @@ -1367,7 +1367,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnStartDeviceDiscoveryRun) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnStartDeviceDiscovery>(message); EXPECT_CALL(app_mngr_, StartDevicesDiscovery()); command->Run(); @@ -1378,7 +1378,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::device_info] [am::strings::id] = "2014"; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceChosenNotification>(message); EXPECT_CALL(app_mngr_, ConnectToDevice( @@ -1390,7 +1390,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnDeviceChosenNotificationDeviceInfoNotExists) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnDeviceChosenNotification>(message); EXPECT_CALL(app_mngr_, ConnectToDevice(_)).Times(0); command->Run(); @@ -1411,7 +1411,7 @@ TEST_F(HMICommandsNotificationsTest, for (; it != system_context_list.end(); ++it) { (*message)[am::strings::msg_params][am::hmi_notification::system_context] = *it; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemContextNotification>(message); EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(app_)); EXPECT_CALL(app_mngr_, state_controller()) @@ -1426,7 +1426,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::system_context] = am::mobile_api::SystemContext::SYSCTXT_VRSESSION; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemContextNotification>(message); ApplicationSharedPtr invalid_app; EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(invalid_app)); @@ -1439,7 +1439,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::system_context] = am::mobile_api::SystemContext::INVALID_ENUM; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemContextNotification>(message); EXPECT_CALL(app_mngr_, active_application()).Times(0); EXPECT_CALL(app_mngr_, application(_)).Times(0); @@ -1460,7 +1460,7 @@ TEST_F(HMICommandsNotificationsTest, for (; it != system_context_list.end(); ++it) { (*message)[am::strings::msg_params][am::hmi_notification::system_context] = *it; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemContextNotification>(message); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_)); EXPECT_CALL(app_mngr_, state_controller()) @@ -1475,7 +1475,7 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::system_context] = am::mobile_api::SystemContext::SYSCTXT_ALERT; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemContextNotification>(message); EXPECT_CALL(app_mngr_, application(_)).Times(0); EXPECT_CALL(app_mngr_, state_controller()).Times(0); @@ -1486,7 +1486,7 @@ TEST_F(HMICommandsNotificationsTest, OnSystemRequestNotificationAppIdExistsAndValidApp) { MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemRequestNotification>(message); EXPECT_CALL(app_mngr_, application(kAppId_)).WillOnce(Return(app_)); @@ -1520,7 +1520,7 @@ TEST_F(HMICommandsNotificationsTest, OnSystemRequestNotificationAppIdExistsAndInvalidApp) { MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::app_id] = kAppId_; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemRequestNotification>(message); ApplicationSharedPtr invalid_app; EXPECT_CALL(app_mngr_, application(kAppId_)).WillOnce(Return(invalid_app)); @@ -1535,7 +1535,7 @@ TEST_F(HMICommandsNotificationsTest, TEST_F(HMICommandsNotificationsTest, OnSystemRequestNotificationAppIdDoesntExistsAndValidApp) { MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemRequestNotification>(message); EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) @@ -1571,7 +1571,7 @@ TEST_F(HMICommandsNotificationsTest, OnSystemRequestNotificationAppIdDoesntExistsAndNullAppId) { const uint32_t kNullApppId = 0u; MessageSharedPtr message = CreateMessage(); - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnSystemRequestNotification>(message); EXPECT_CALL(mock_policy_handler_, GetAppIdForSending()) @@ -1585,7 +1585,7 @@ TEST_F(HMICommandsNotificationsTest, OnTTSLanguageChangeNotificationEmptyData) { const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnTTSLanguageChangeNotification>(message); EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(_)); @@ -1604,7 +1604,7 @@ TEST_F(HMICommandsNotificationsTest, const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnTTSLanguageChangeNotification>(message); application_set_.insert(app_); @@ -1638,12 +1638,12 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = mobile_apis::Language::EN_US; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnTTSLanguageChangeNotification>(message); application_set_.insert(app_); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*notification)[am::strings::params][am::strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); (*notification)[am::strings::params][am::strings::message_type] = @@ -1690,7 +1690,7 @@ TEST_F(HMICommandsNotificationsTest, OnUILanguageChangeNotificationEmptyData) { const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnUILanguageChangeNotification>(message); EXPECT_CALL(mock_hmi_capabilities_, set_active_ui_language(_)); @@ -1708,7 +1708,7 @@ TEST_F(HMICommandsNotificationsTest, const mobile_apis::Language::eType& kLang = mobile_apis::Language::EN_GB; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = kLang; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnUILanguageChangeNotification>(message); application_set_.insert(app_); @@ -1741,12 +1741,12 @@ TEST_F(HMICommandsNotificationsTest, MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::strings::language] = mobile_apis::Language::EN_US; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<OnUILanguageChangeNotification>(message); application_set_.insert(app_); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*notification)[am::strings::params][am::strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::OnLanguageChangeID); (*notification)[am::strings::params][am::strings::message_type] = @@ -1793,7 +1793,7 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) { hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::state] = state; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); EXPECT_CALL(app_mngr_, set_driver_distraction_state(state)); @@ -1809,7 +1809,7 @@ TEST_F(HMICommandsNotificationsTest, hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::hmi_notification::state] = state; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); ApplicationSharedPtr invalid_app; @@ -1825,7 +1825,7 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) { hmi_apis::Common_DriverDistractionState::DD_ON; MessageSharedPtr message = CreateMessage(); (*message)[am::strings::msg_params][am::mobile_notification::state] = state; - utils::SharedPtr<Command> command = + std::shared_ptr<Command> command = CreateCommand<hmi::OnDriverDistractionNotification>(message); application_set_.insert(app_); 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 7759dace96..8892fa3809 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -50,14 +50,14 @@ namespace mixing_audio_supported_request { using ::testing::_; using ::testing::Return; -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using am::commands::RequestToHMI; using sdl_rpc_plugin::commands::MixingAudioSupportedRequest; using am::commands::CommandImpl; -typedef SharedPtr<RequestToHMI> RequestToHMIPtr; +typedef std::shared_ptr<RequestToHMI> RequestToHMIPtr; namespace { const uint32_t kConnectionKey = 2u; 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 9c8c30f493..60b86cf2bd 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" @@ -56,7 +56,7 @@ namespace mixing_audio_supported_response { using ::testing::Return; using ::testing::ReturnRef; using ::testing::NiceMock; -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::MixingAudioSupportedResponse; @@ -65,7 +65,7 @@ using am::commands::CommandImpl; using am::HMICapabilities; namespace hmi_response = ::application_manager::hmi_response; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 69cb04f073..d8454bb98e 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 @@ -35,7 +35,7 @@ #include "hmi/navi_audio_start_stream_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -76,7 +76,7 @@ class AudioStartStreamRequestTest std::pair<uint32_t, int32_t> start_stream_retry_amount_; MessageSharedPtr msg_; - SharedPtr<AudioStartStreamRequest> command_; + std::shared_ptr<AudioStartStreamRequest> command_; }; TEST_F(AudioStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) { 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 49145d1644..1a03ecf523 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 @@ -33,7 +33,7 @@ #include "hmi/navi_is_ready_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -62,7 +62,7 @@ const hmi_apis::FunctionID::eType kEventID = hmi_apis::FunctionID::Navigation_IsReady; } // namespace -typedef SharedPtr<NaviIsReadyRequest> NaviIsReadyRequestPtr; +typedef std::shared_ptr<NaviIsReadyRequest> NaviIsReadyRequestPtr; class NaviIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { 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 3bcea20be7..715d788100 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 @@ -51,11 +51,11 @@ namespace am = ::application_manager; namespace commands = sdl_rpc_plugin::commands; using ::testing::ReturnRef; -using ::utils::SharedPtr; + using application_manager::commands::ResponseFromHMI; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; class NaviIsReadyResponseTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; 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 c7287c024a..3110a11fd8 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 @@ -35,7 +35,7 @@ #include "hmi/navi_set_video_config_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -65,7 +65,7 @@ const hmi_apis::FunctionID::eType kEventID = hmi_apis::FunctionID::Navigation_SetVideoConfig; } // namespace -typedef SharedPtr<NaviSetVideoConfigRequest> NaviSetVideoConfigRequestPtr; +typedef std::shared_ptr<NaviSetVideoConfigRequest> NaviSetVideoConfigRequestPtr; class NaviSetVideoConfigRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { 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 6469966ca2..4140d18110 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 @@ -44,7 +44,7 @@ namespace commands_test { namespace hmi_commands_test { namespace navi_set_video_config_response { -using utils::SharedPtr; + using sdl_rpc_plugin::commands::NaviSetVideoConfigResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; @@ -61,7 +61,7 @@ class NaviSetVideoConfigResponseTest TEST_F(NaviSetVideoConfigResponseTest, RUN_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<NaviSetVideoConfigResponse> command( + std::shared_ptr<NaviSetVideoConfigResponse> command( CreateCommand<NaviSetVideoConfigResponse>(msg)); MockEventDispatcher mock_event_dispatcher; 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 6700aa68ab..a7f50504fb 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 @@ -35,7 +35,7 @@ #include "hmi/navi_start_stream_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -75,7 +75,7 @@ class NaviStartStreamRequestTest std::pair<uint32_t, int32_t> start_stream_retry_amount_; MessageSharedPtr msg_; - SharedPtr<NaviStartStreamRequest> command_; + std::shared_ptr<NaviStartStreamRequest> command_; }; TEST_F(NaviStartStreamRequestTest, Run_HmiInterfaceNotAvailable_NoRequest) { 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 0ef903224b..e4a79997fd 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 @@ -34,7 +34,7 @@ #include "hmi/navi_audio_stop_stream_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -72,7 +72,7 @@ class NaviStopStreamRequestsTest } MessageSharedPtr msg_; - SharedPtr<Command> command_; + std::shared_ptr<Command> command_; }; typedef testing::Types<commands::AudioStopStreamRequest, 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 60a7b01612..1ec04c68ae 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 @@ -36,9 +36,9 @@ #include "gtest/gtest.h" #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" -#include "utils/shared_ptr.h" + #include "utils/lock.h" -#include "utils/make_shared.h" + #include "utils/data_accessor.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application.h" @@ -56,14 +56,14 @@ namespace on_driver_distraction_notification { using ::testing::_; using ::testing::Return; using ::testing::Eq; -using ::utils::SharedPtr; + namespace am = ::application_manager; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification; using namespace am::commands; -typedef ::utils::SharedPtr<OnDriverDistractionNotification> NotificationPtr; +typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr; class HMIOnDriverDistractionNotificationTest : public CommandsTest<CommandsTestMocks::kIsNice> { 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 bbd5920f9f..d62a2897f8 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 @@ -33,7 +33,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "interfaces/MOBILE_API.h" #include "application_manager/mock_hmi_capabilities.h" @@ -48,7 +48,7 @@ namespace commands_test { namespace hmi_commands_test { namespace rc_get_capabilities_response { -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; @@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::RCGetCapabilitiesResponse; using am::commands::CommandImpl; -typedef SharedPtr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr; +typedef std::shared_ptr<RCGetCapabilitiesResponse> RCGetCapabilitiesResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 41acf67116..030db2f424 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 @@ -33,7 +33,7 @@ #include "hmi/rc_is_ready_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -57,7 +57,7 @@ using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::RCIsReadyRequest; using am::event_engine::Event; -typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr; +typedef std::shared_ptr<RCIsReadyRequest> RCIsReadyRequestPtr; class RCIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { 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 e07a0c1538..a1a8c1c87e 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" @@ -48,7 +48,7 @@ namespace hmi_commands_test { namespace rc_is_ready_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::RCIsReadyResponse; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<RCIsReadyResponse> RCIsReadyResponsePtr; +typedef std::shared_ptr<RCIsReadyResponse> RCIsReadyResponsePtr; class RCIsReadyResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> { }; 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 c5b0c2ba24..3e084bd6cc 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 @@ -33,7 +33,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/test/include/application_manager/commands/commands_test.h" @@ -51,13 +51,13 @@ using ::testing::Return; using ::testing::SaveArg; using ::testing::DoAll; -using ::utils::SharedPtr; + using ::test::components::event_engine_test::MockEventDispatcher; namespace am = ::application_manager; using application_manager::commands::ResponseFromHMI; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; class ResponseFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {}; @@ -97,7 +97,7 @@ TEST_F(ResponseFromHMITest, CreateHMIRequest_SUCCESS) { MessageSharedPtr dummy_msg_params = CreateMessage(); command->CreateHMIRequest(posted_function_id, *dummy_msg_params); - ASSERT_TRUE(result_msg); + ASSERT_TRUE((bool)result_msg); const application_manager::MessageType received_message_tipe = static_cast<application_manager::MessageType>( 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 c21791e913..38cbc7b069 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 @@ -134,7 +134,7 @@ TEST_F(SDLActivateAppRequestTest, Run_ActivateApp_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); EXPECT_CALL(app_mngr_, state_controller()) @@ -154,7 +154,7 @@ TEST_F(SDLActivateAppRequestTest, DISABLED_Run_DactivateApp_REJECTED) { (*msg)[strings::msg_params][strings::function_id] = hmi_apis::FunctionID::SDL_ActivateApp; - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); EXPECT_CALL(app_mngr_, state_controller()) @@ -176,7 +176,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -222,7 +222,7 @@ TEST_F(SDLActivateAppRequestTest, AppIdNotFound_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); EXPECT_CALL(app_mngr_, application(kAppID)) @@ -237,7 +237,7 @@ TEST_F(SDLActivateAppRequestTest, DevicesAppsEmpty_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -263,7 +263,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -301,7 +301,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActive_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -322,7 +322,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -362,7 +362,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -395,7 +395,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MockAppPtr mock_app(CreateMockApp()); @@ -431,7 +431,7 @@ TEST_F(SDLActivateAppRequestTest, OnTimeout_SUCCESS) { MessageSharedPtr msg = CreateMessage(); SetCorrelationAndAppID(msg); - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); ON_CALL(mock_event_dispatcher_, remove_observer(_, _)); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).WillOnce(Return(true)); @@ -443,7 +443,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidEventId_UNSUCCESS) { MessageSharedPtr event_msg = CreateMessage(); (*event_msg)[strings::params][strings::correlation_id] = kCorrelationID; - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>()); Event event(hmi_apis::FunctionID::INVALID_ENUM); @@ -458,7 +458,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidAppId_UNSUCCESS) { (*event_msg)[strings::msg_params][strings::application][strings::app_id] = kAppID; - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>()); Event event(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered); @@ -474,7 +474,7 @@ TEST_F(SDLActivateAppRequestTest, OnEvent_InvalidAppId_UNSUCCESS) { TEST_F(SDLActivateAppRequestTest, OnEvent_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::correlation_id] = kCorrelationID; - SharedPtr<SDLActivateAppRequest> command( + std::shared_ptr<SDLActivateAppRequest> command( CreateCommand<SDLActivateAppRequest>(msg)); MessageSharedPtr event_msg = CreateMessage(); 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 716c818269..1dc41e1486 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -47,13 +47,13 @@ namespace commands_test { namespace hmi_commands_test { namespace sdl_activate_app_response { -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::SDLActivateAppResponse; using am::commands::CommandImpl; -typedef SharedPtr<SDLActivateAppResponse> SDLActivateAppResponsePtr; +typedef std::shared_ptr<SDLActivateAppResponse> SDLActivateAppResponsePtr; namespace { const uint32_t kConnectionKey = 2u; 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 e5f9845b74..262ac5fc7d 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 @@ -82,7 +82,7 @@ TEST_F(SDLGetListOfPermissionsRequestTest, Run_SUCCESS) { EXPECT_CALL(app_mngr_, application_by_hmi_app(kAppID)) .WillOnce(Return(mock_app_)); - SharedPtr<SDLGetListOfPermissionsRequest> command( + std::shared_ptr<SDLGetListOfPermissionsRequest> command( CreateCommand<SDLGetListOfPermissionsRequest>(msg)); EXPECT_CALL(mock_policy_handler_, @@ -95,7 +95,7 @@ TEST_F(SDLGetListOfPermissionsRequestTest, Run_KeyDoesntExist_SUCCESS) { MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Binary); (*msg)[strings::params][strings::correlation_id] = kCorrelationID; - SharedPtr<SDLGetListOfPermissionsRequest> command( + std::shared_ptr<SDLGetListOfPermissionsRequest> command( CreateCommand<SDLGetListOfPermissionsRequest>(msg)); EXPECT_CALL(mock_policy_handler_, 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 7cfd7e49e2..fca8ed840f 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 @@ -64,7 +64,7 @@ TEST_F(SDLGetStatusUpdateRequestTest, Run_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::correlation_id] = kCorrelationID; - SharedPtr<SDLGetStatusUpdateRequest> command( + std::shared_ptr<SDLGetStatusUpdateRequest> command( CreateCommand<SDLGetStatusUpdateRequest>(msg)); EXPECT_CALL(mock_policy_handler_, OnGetStatusUpdate(kCorrelationID)); 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 0ec40f896a..b040f8ea40 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 @@ -99,7 +99,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageSet_SUCCESS) { (*msg)[strings::msg_params][strings::language] = kLanguage; - SharedPtr<SDLGetUserFriendlyMessageRequest> command( + std::shared_ptr<SDLGetUserFriendlyMessageRequest> command( CreateCommand<SDLGetUserFriendlyMessageRequest>(msg)); EXPECT_CALL(mock_message_helper_, CommonLanguageToString(kLanguage)) @@ -123,7 +123,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageNotSet_SUCCESS) { (*msg)[strings::msg_params][kMessageCodes][0] = SmartObject(kLanguageDe); (*msg)[strings::msg_params][kMessageCodes][1] = SmartObject(kLanguageEn); - SharedPtr<SDLGetUserFriendlyMessageRequest> command( + std::shared_ptr<SDLGetUserFriendlyMessageRequest> command( CreateCommand<SDLGetUserFriendlyMessageRequest>(msg)); EXPECT_CALL(mock_hmi_capabilities_, active_ui_language()) @@ -144,7 +144,7 @@ TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_NoMsgCodes_Canceled) { (*msg)[strings::params][strings::correlation_id] = kCorrelationID; (*msg)[strings::msg_params][strings::app_id] = kAppID; - SharedPtr<SDLGetUserFriendlyMessageRequest> command( + std::shared_ptr<SDLGetUserFriendlyMessageRequest> command( CreateCommand<SDLGetUserFriendlyMessageRequest>(msg)); EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_)).Times(0); 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 d25c9b41e8..e610628416 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 @@ -62,7 +62,7 @@ TYPED_TEST_CASE(SimpleNotificationsTest, CommandsList); TYPED_TEST(SimpleNotificationsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); // Current implementation always return `true` EXPECT_TRUE(command->Init()); 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 e47009583f..028054c626 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 @@ -31,7 +31,7 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -51,7 +51,7 @@ using ::testing::Types; using ::testing::NotNull; using ::testing::NiceMock; -using ::utils::SharedPtr; + namespace commands = ::application_manager::commands; using commands::MessageSharedPtr; using ::application_manager::event_engine::EventObserver; @@ -67,7 +67,7 @@ class RequestFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> { }; TEST_F(RequestFromHMITest, BasicMethodsOverloads_SUCCESS) { - SharedPtr<commands::RequestFromHMI> command( + std::shared_ptr<commands::RequestFromHMI> command( CreateCommand<commands::RequestFromHMI>()); application_manager::event_engine::Event event( hmi_apis::FunctionID::BasicCommunication_ActivateApp); @@ -79,7 +79,7 @@ TEST_F(RequestFromHMITest, BasicMethodsOverloads_SUCCESS) { } TEST_F(RequestFromHMITest, SendResponse_SUCCESS) { - SharedPtr<commands::RequestFromHMI> command( + std::shared_ptr<commands::RequestFromHMI> command( CreateCommand<commands::RequestFromHMI>()); const bool success = false; 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 c24cfc48db..42b1b9a182 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 @@ -31,7 +31,7 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -120,7 +120,7 @@ using ::testing::_; using ::testing::Types; using ::testing::NotNull; -using ::utils::SharedPtr; + namespace am_commands = application_manager::commands; using am_commands::MessageSharedPtr; @@ -129,7 +129,7 @@ using event_engine_test::MockEventDispatcher; class RequestToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { - SharedPtr<am_commands::RequestToHMI> command( + std::shared_ptr<am_commands::RequestToHMI> command( CreateCommand<am_commands::RequestToHMI>()); // Current implementation always return `true` @@ -139,7 +139,7 @@ TEST_F(RequestToHMITest, BasicMethodsOverloads_SUCCESS) { } TEST_F(RequestToHMITest, SendRequest_SUCCESS) { - SharedPtr<am_commands::RequestToHMI> command( + std::shared_ptr<am_commands::RequestToHMI> command( CreateCommand<am_commands::RequestToHMI>()); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -235,7 +235,7 @@ TYPED_TEST_CASE(RequestToHMICommandsTest3, RequestCommandsList3); TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); @@ -245,7 +245,7 @@ TYPED_TEST(RequestToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); command->Run(); @@ -254,7 +254,7 @@ TYPED_TEST(RequestToHMICommandsTest2, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(RequestToHMICommandsTest3, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); command->Run(); 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 229f48b5e1..c3b9809814 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 @@ -33,7 +33,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -109,7 +109,7 @@ using ::testing::ReturnRef; using ::testing::Types; using ::testing::Eq; -using ::utils::SharedPtr; + using ::test::components::event_engine_test::MockEventDispatcher; namespace am = ::application_manager; @@ -244,7 +244,7 @@ TYPED_TEST(ResponseFromHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandData CommandData; typedef typename CommandData::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->event_dispatcher_, raise_event(EventIdIsEqualTo(CommandData::kEventId))); @@ -255,7 +255,7 @@ TYPED_TEST(ResponseFromHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { TYPED_TEST(EmptyResponseFromHMICommandsTest, Run_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); command->Run(); } @@ -277,7 +277,7 @@ class NotificationFromHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(NotificationFromHMITest, BasicMethodsOverloads_SUCCESS) { - SharedPtr<application_manager::commands::NotificationFromHMI> command( + std::shared_ptr<application_manager::commands::NotificationFromHMI> command( CreateCommand<application_manager::commands::NotificationFromHMI>()); // Current implementation always return `true` EXPECT_TRUE(command->Init()); @@ -290,7 +290,7 @@ TEST_F(NotificationFromHMITest, SendNotificationToMobile_SUCCESS) { (*command_msg)[am::strings::params][am::strings::message_type] = static_cast<int32_t>(am::MessageType::kNotification); - SharedPtr<application_manager::commands::NotificationFromHMI> command( + std::shared_ptr<application_manager::commands::NotificationFromHMI> command( CreateCommand<application_manager::commands::NotificationFromHMI>()); EXPECT_CALL( mock_rpc_service_, @@ -303,7 +303,7 @@ TEST_F(NotificationFromHMITest, SendNotificationToMobile_SUCCESS) { TEST_F(NotificationFromHMITest, CreateHMIRequest_UNSUCCESS) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); (*command_msg)[am::strings::msg_params] = 0; - SharedPtr<application_manager::commands::NotificationFromHMI> command( + std::shared_ptr<application_manager::commands::NotificationFromHMI> command( CreateCommand<application_manager::commands::NotificationFromHMI>( command_msg)); 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 ef8978c34c..2a52601a44 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 @@ -31,7 +31,7 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command.h" @@ -51,7 +51,7 @@ namespace simple_response_to_hmi_test { using ::testing::_; using ::testing::Types; using ::testing::NotNull; -using ::utils::SharedPtr; + namespace commands = sdl_rpc_plugin::commands; using application_manager::commands::MessageSharedPtr; @@ -73,7 +73,7 @@ TYPED_TEST_CASE(ResponseToHMICommandsTest, ResponseCommandsList); TYPED_TEST(ResponseToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { typedef typename TestFixture::CommandType CommandType; - SharedPtr<CommandType> command = this->template CreateCommand<CommandType>(); + std::shared_ptr<CommandType> command = this->template CreateCommand<CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToHMI(NotNull())); command->Run(); @@ -82,7 +82,7 @@ TYPED_TEST(ResponseToHMICommandsTest, Run_SendMessageToHMI_SUCCESS) { class ResponseToHMITest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(ResponseToHMITest, BasicMethodsOverloads_SUCCESS) { - SharedPtr<application_manager::commands::ResponseToHMI> command( + std::shared_ptr<application_manager::commands::ResponseToHMI> command( CreateCommand<application_manager::commands::ResponseToHMI>()); // Current implementation always return `true` @@ -91,7 +91,7 @@ TEST_F(ResponseToHMITest, BasicMethodsOverloads_SUCCESS) { } TEST_F(ResponseToHMITest, Run_SUCCESS) { - SharedPtr<application_manager::commands::ResponseToHMI> command( + std::shared_ptr<application_manager::commands::ResponseToHMI> command( CreateCommand<application_manager::commands::ResponseToHMI>()); EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(NotNull())); 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 afc18114de..bc9d262e6d 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 @@ -47,7 +47,7 @@ namespace tts_get_capabilities_response { using application_manager::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::TTSGetCapabilitiesResponse; using test::components::application_manager_test::MockHMICapabilities; -using utils::SharedPtr; + using testing::_; namespace strings = ::application_manager::strings; @@ -71,7 +71,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_BothExist_SUCCESS) { EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(SmartObject(kText))); - SharedPtr<TTSGetCapabilitiesResponse> command( + std::shared_ptr<TTSGetCapabilitiesResponse> command( CreateCommand<TTSGetCapabilitiesResponse>(msg)); command->Run(); @@ -85,7 +85,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlySpeech_SUCCESS) { set_speech_capabilities(SmartObject(kText))); EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0); - SharedPtr<TTSGetCapabilitiesResponse> command( + std::shared_ptr<TTSGetCapabilitiesResponse> command( CreateCommand<TTSGetCapabilitiesResponse>(msg)); command->Run(); @@ -100,7 +100,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_OnlyPrerecorded_SUCCESS) { EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(SmartObject(kText))); - SharedPtr<TTSGetCapabilitiesResponse> command( + std::shared_ptr<TTSGetCapabilitiesResponse> command( CreateCommand<TTSGetCapabilitiesResponse>(msg)); command->Run(); @@ -112,7 +112,7 @@ TEST_F(TTSGetCapabilitiesResponseTest, Run_Nothing_SUCCESS) { EXPECT_CALL(mock_hmi_capabilities_, set_speech_capabilities(_)).Times(0); EXPECT_CALL(mock_hmi_capabilities_, set_prerecorded_speech(_)).Times(0); - SharedPtr<TTSGetCapabilitiesResponse> command( + std::shared_ptr<TTSGetCapabilitiesResponse> command( CreateCommand<TTSGetCapabilitiesResponse>(msg)); command->Run(); 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 5f2fe1beda..b67976cc07 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 @@ -44,7 +44,7 @@ namespace commands_test { namespace hmi_commands_test { namespace tts_get_language_response { -using utils::SharedPtr; + using sdl_rpc_plugin::commands::TTSGetLanguageResponse; using test::components::application_manager_test::MockHMICapabilities; using test::components::event_engine_test::MockEventDispatcher; @@ -66,7 +66,7 @@ TEST_F(TTSGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::msg_params][hmi_response::language] = kLanguage; - SharedPtr<TTSGetLanguageResponse> command( + std::shared_ptr<TTSGetLanguageResponse> command( CreateCommand<TTSGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, set_active_tts_language(kLanguage)); @@ -82,7 +82,7 @@ TEST_F(TTSGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { TEST_F(TTSGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<TTSGetLanguageResponse> command( + std::shared_ptr<TTSGetLanguageResponse> command( CreateCommand<TTSGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, 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 2672062aab..6495229a2e 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -54,7 +54,7 @@ namespace tts_get_supported_languages_response { using ::testing::_; using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -63,7 +63,7 @@ using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::TTSGetSupportedLanguagesResponse; using am::commands::CommandImpl; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 d6d74d18bd..24a5c57a23 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -55,7 +55,7 @@ namespace tts_is_ready_response { using ::testing::_; using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -65,7 +65,7 @@ using sdl_rpc_plugin::commands::TTSIsReadyResponse; using am::commands::CommandImpl; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 8dbc09fc4f..36581ba665 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 @@ -33,8 +33,8 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "smart_objects/smart_object.h" #include "interfaces/MOBILE_API.h" #include "application_manager/mock_hmi_capabilities.h" @@ -49,7 +49,7 @@ namespace commands_test { namespace hmi_commands_test { namespace ui_get_capabilities_response { -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; @@ -58,7 +58,7 @@ using application_manager::commands::ResponseFromHMI; using sdl_rpc_plugin::commands::UIGetCapabilitiesResponse; using am::commands::CommandImpl; -typedef SharedPtr<ResponseFromHMI> ResponseFromHMIPtr; +typedef std::shared_ptr<ResponseFromHMI> ResponseFromHMIPtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 285024ed40..01a7ae41f4 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 @@ -44,7 +44,7 @@ namespace commands_test { namespace hmi_commands_test { namespace ui_get_language_response { -using utils::SharedPtr; + using sdl_rpc_plugin::commands::UIGetLanguageResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; @@ -70,7 +70,7 @@ TEST_F(UIGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::msg_params][hmi_response::language] = kLanguage; - SharedPtr<UIGetLanguageResponse> command( + std::shared_ptr<UIGetLanguageResponse> command( CreateCommand<UIGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, set_active_ui_language(kLanguage)); @@ -86,7 +86,7 @@ TEST_F(UIGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { TEST_F(UIGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<UIGetLanguageResponse> command( + std::shared_ptr<UIGetLanguageResponse> command( CreateCommand<UIGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, 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 021ef4fdb6..d7fa03cdc0 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/application.h" @@ -51,14 +51,14 @@ namespace hmi_commands_test { namespace ui_get_supported_languages_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::UIGetSupportedLanguagesResponse; -typedef SharedPtr<UIGetSupportedLanguagesResponse> +typedef std::shared_ptr<UIGetSupportedLanguagesResponse> UIGetSupportedLanguagesResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> 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 b8fc839f12..fe0d8a8470 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 @@ -33,7 +33,7 @@ #include "hmi/ui_is_ready_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -60,7 +60,7 @@ using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::UIIsReadyRequest; using am::event_engine::Event; -typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr; +typedef std::shared_ptr<UIIsReadyRequest> UIIsReadyRequestPtr; class UIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { 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 6817c5ef0e..f7e13f06ed 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" @@ -48,7 +48,7 @@ namespace hmi_commands_test { namespace ui_is_ready_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::UIIsReadyResponse; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<UIIsReadyResponse> UIIsReadyResponsePtr; +typedef std::shared_ptr<UIIsReadyResponse> UIIsReadyResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 2ce7d9e8f0..b29a0fde57 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 @@ -33,7 +33,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "interfaces/HMI_API.h" #include "application_manager/smart_object_keys.h" @@ -54,7 +54,7 @@ namespace commands_test { namespace hmi_commands_test { namespace update_device_list_request { -using ::utils::SharedPtr; + using testing::_; using testing::ReturnRef; using testing::Return; @@ -68,7 +68,7 @@ using am::event_engine::Event; using sdl_rpc_plugin::commands::UpdateDeviceListRequest; using am::commands::CommandImpl; -typedef SharedPtr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr; +typedef std::shared_ptr<UpdateDeviceListRequest> UpdateDeviceListRequestPtr; namespace { const uint32_t kConnectionKey = 2u; 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 2b079a21e0..b22dba73e5 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -48,14 +48,14 @@ namespace commands_test { namespace hmi_commands_test { namespace update_sdl_request { -using ::utils::SharedPtr; + using ::testing::ReturnRef; using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::UpdateSDLRequest; -typedef SharedPtr<UpdateSDLRequest> UpdateSDLRequestPtr; +typedef std::shared_ptr<UpdateSDLRequest> UpdateSDLRequestPtr; namespace { const uint32_t kConnectionKey = 2u; 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 0035637605..3e09ce29fd 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -47,13 +47,13 @@ namespace commands_test { namespace hmi_commands_test { namespace update_sdl_response { -using ::utils::SharedPtr; + namespace am = ::application_manager; namespace strings = ::application_manager::strings; using sdl_rpc_plugin::commands::UpdateSDLResponse; using am::commands::CommandImpl; -typedef SharedPtr<UpdateSDLResponse> UpdateSDLResponsePtr; +typedef std::shared_ptr<UpdateSDLResponse> UpdateSDLResponsePtr; namespace { const uint32_t kConnectionKey = 2u; 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 0163fdd1d1..954925731c 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 @@ -33,7 +33,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "interfaces/MOBILE_API.h" #include "application_manager/mock_hmi_capabilities.h" @@ -48,7 +48,7 @@ namespace commands_test { namespace hmi_commands_test { namespace vr_get_capabilities_response { -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = am::strings; @@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::VRGetCapabilitiesResponse; using am::commands::CommandImpl; -typedef SharedPtr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr; +typedef std::shared_ptr<VRGetCapabilitiesResponse> VRGetCapabilitiesResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; 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 845324925f..287ea3b7f3 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 @@ -44,7 +44,7 @@ namespace commands_test { namespace hmi_commands_test { namespace vr_get_language_response { -using utils::SharedPtr; + using sdl_rpc_plugin::commands::VRGetLanguageResponse; using test::components::event_engine_test::MockEventDispatcher; using testing::_; @@ -70,7 +70,7 @@ TEST_F(VRGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::msg_params][hmi_response::language] = kLanguage; - SharedPtr<VRGetLanguageResponse> command( + std::shared_ptr<VRGetLanguageResponse> command( CreateCommand<VRGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, set_active_vr_language(kLanguage)); @@ -86,7 +86,7 @@ TEST_F(VRGetLanguageResponseTest, Run_LanguageSet_SUCCESS) { TEST_F(VRGetLanguageResponseTest, Run_LanguageNotSet_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<VRGetLanguageResponse> command( + std::shared_ptr<VRGetLanguageResponse> command( CreateCommand<VRGetLanguageResponse>(msg)); EXPECT_CALL(mock_hmi_capabilities_, 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 0ac0d8e118..1baf777e69 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/application.h" @@ -51,14 +51,14 @@ namespace hmi_commands_test { namespace vr_get_supported_languages_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::VRGetSupportedLanguagesResponse; -typedef SharedPtr<VRGetSupportedLanguagesResponse> +typedef std::shared_ptr<VRGetSupportedLanguagesResponse> VRGetSupportedLanguagesResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> 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 1ec0adb5e0..5aa00e0264 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 @@ -33,7 +33,7 @@ #include "hmi/vr_is_ready_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -57,7 +57,7 @@ using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::VRIsReadyRequest; using am::event_engine::Event; -typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr; +typedef std::shared_ptr<VRIsReadyRequest> VRIsReadyRequestPtr; class VRIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { 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 452679e189..2f70995d83 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 @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/mock_hmi_capabilities.h" @@ -48,7 +48,7 @@ namespace hmi_commands_test { namespace vr_is_ready_response { using ::testing::Return; -using ::utils::SharedPtr; + using ::testing::NiceMock; namespace am = ::application_manager; namespace strings = ::application_manager::strings; @@ -56,7 +56,7 @@ namespace hmi_response = am::hmi_response; using sdl_rpc_plugin::commands::VRIsReadyResponse; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<VRIsReadyResponse> VRIsReadyResponsePtr; +typedef std::shared_ptr<VRIsReadyResponse> VRIsReadyResponsePtr; class VRIsReadyResponseTest : public CommandsTest<CommandsTestMocks::kIsNice> { }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc index 9f60053eb3..ea1a0fafed 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc @@ -37,9 +37,9 @@ #include "mobile/add_command_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/commands/command_request_test.h" @@ -64,7 +64,7 @@ using am::ApplicationManager; using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using ::testing::_; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::InSequence; using sdl_rpc_plugin::commands::AddCommandRequest; @@ -182,7 +182,7 @@ class AddCommandRequestTest EXPECT_CALL(*mock_app_, commands_map()) .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>( commands_map, lock_ptr_))); - so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map); + so_ptr_ = std::make_shared<SmartObject>(SmartType_Map); EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId)) .WillOnce(Return(so_ptr_.get())); { @@ -198,7 +198,7 @@ class AddCommandRequestTest .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); Event event(incoming_cmd); @@ -210,7 +210,7 @@ class AddCommandRequestTest ManageHMICommand(HMIResultCodeIs(cmd_to_delete))) .WillOnce(Return(true)); - SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map); (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, @@ -221,8 +221,8 @@ class AddCommandRequestTest mock_rpc_service_, ManageMobileCommand(response, am::commands::Command::CommandSource::SOURCE_SDL)); - utils::SharedPtr<CommandRequestImpl> base_class_request = - static_cast<utils::SharedPtr<CommandRequestImpl> >(request_ptr); + std::shared_ptr<CommandRequestImpl> base_class_request = + static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr); base_class_request->onTimeOut(); } @@ -243,7 +243,7 @@ TEST_F(AddCommandRequestTest, Run_AppNotExisted_EXPECT_AppNotRegistered) { mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -258,7 +258,7 @@ TEST_F(AddCommandRequestTest, Run_ImageVerificationFailed_EXPECT_INVALID_DATA) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -284,7 +284,7 @@ TEST_F(AddCommandRequestTest, Run_MenuNameHasSyntaxError_EXPECT_INVALID_DATA) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -303,7 +303,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -329,7 +329,7 @@ TEST_F(AddCommandRequestTest, Run_CMDIconHasError_EXPECT_INVALID_DATA) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg); request_ptr->Run(); } @@ -340,13 +340,13 @@ TEST_F(AddCommandRequestTest, Run_CommandIDAlreadyExists_EXPECT_INVALID_ID) { SmartObject& image = msg_params[cmd_icon]; EXPECT_CALL(mock_message_helper_, VerifyImage(image, _, _)) .WillOnce(Return(mobile_apis::Result::SUCCESS)); - so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map); + so_ptr_ = std::make_shared<SmartObject>(SmartType_Map); EXPECT_CALL(*mock_app_, FindCommand(kCmdId)).WillOnce(Return(so_ptr_.get())); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_ID), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -371,7 +371,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::DUPLICATE_NAME), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -398,7 +398,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_ID), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -421,14 +421,14 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(*mock_app_, commands_map()) .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>( commands_map, lock_ptr_))); - so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map); + so_ptr_ = std::make_shared<SmartObject>(SmartType_Map); EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId)) .WillOnce(Return(so_ptr_.get())); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::DUPLICATE_NAME), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -444,7 +444,7 @@ TEST_F(AddCommandRequestTest, Run_MsgDataEmpty_EXPECT_INVALID_DATA) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg); request_ptr->Run(); } @@ -466,7 +466,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(*mock_app_, commands_map()) .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>( commands_map, lock_ptr_))); - so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map); + so_ptr_ = std::make_shared<SmartObject>(SmartType_Map); EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId)) .WillOnce(Return(so_ptr_.get())); { @@ -482,7 +482,7 @@ TEST_F(AddCommandRequestTest, .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -504,7 +504,7 @@ TEST_F(AddCommandRequestTest, GetRunMethods_SUCCESS) { mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) .WillOnce(Return(true)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); } @@ -535,7 +535,7 @@ TEST_F(AddCommandRequestTest, OnEvent_UI_SUCCESS) { EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); request_ptr->on_event(event); @@ -566,7 +566,7 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) { EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, (*msg_)[msg_params], false)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); request_ptr->on_event(event); @@ -597,7 +597,7 @@ TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) { EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(command_msg); request_ptr->Run(); request_ptr->on_event(event_ui); @@ -606,7 +606,7 @@ TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) { TEST_F(AddCommandRequestTest, OnEvent_UnknownEvent_UNSUCCESS) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); Event event(hmi_apis::FunctionID::INVALID_ENUM); request_ptr->on_event(event); @@ -619,7 +619,7 @@ TEST_F(AddCommandRequestTest, OnEvent_AppNotExisted_UNSUCCESS) { Event event(hmi_apis::FunctionID::UI_AddCommand); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->on_event(event); } @@ -641,7 +641,7 @@ TEST_F(AddCommandRequestTest, mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) .WillOnce(Return(true)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); @@ -687,7 +687,7 @@ TEST_F(AddCommandRequestTest, .WillOnce(ReturnRef(*mock_help_prompt_manager_)); EXPECT_CALL(*mock_help_prompt_manager_, OnVrCommandAdded(kCmdId, _, false)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); Event event_ui(hmi_apis::FunctionID::UI_AddCommand); @@ -725,7 +725,7 @@ TEST_F( } EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -770,7 +770,7 @@ TEST_F( } EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -813,7 +813,7 @@ TEST_F( ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) .WillOnce(Return(true)); } - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -862,7 +862,7 @@ TEST_F( ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) .WillOnce(Return(true)); } - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -903,7 +903,7 @@ TEST_F( mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_AddCommand))) .WillOnce(Return(true)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); EXPECT_CALL(mock_hmi_interfaces_, @@ -940,7 +940,7 @@ TEST_F( mock_rpc_service_, ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::VR_AddCommand))) .WillOnce(Return(true)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); EXPECT_CALL(mock_hmi_interfaces_, @@ -988,7 +988,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -1036,7 +1036,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::GENERIC_ERROR), _)); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); @@ -1063,7 +1063,7 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(ApplicationSharedPtr())); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(0); - SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map); (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, @@ -1072,8 +1072,8 @@ TEST_F(AddCommandRequestTest, EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - utils::SharedPtr<CommandRequestImpl> base_class_request = - static_cast<utils::SharedPtr<CommandRequestImpl> >( + std::shared_ptr<CommandRequestImpl> base_class_request = + static_cast<std::shared_ptr<CommandRequestImpl> >( CreateCommand<AddCommandRequest>(msg_)); base_class_request->onTimeOut(); } @@ -1094,7 +1094,7 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { EXPECT_CALL(*mock_app_, commands_map()) .WillRepeatedly(Return(DataAccessor<application_manager::CommandsMap>( commands_map, lock_ptr_))); - so_ptr_ = utils::MakeShared<SmartObject>(SmartType_Map); + so_ptr_ = std::make_shared<SmartObject>(SmartType_Map); EXPECT_CALL(*mock_app_, FindSubMenu(kSecondParentId)) .WillOnce(Return(so_ptr_.get())); { @@ -1109,11 +1109,11 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { .WillOnce(Return(true)); } EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); - utils::SharedPtr<AddCommandRequest> request_ptr = + std::shared_ptr<AddCommandRequest> request_ptr = CreateCommand<AddCommandRequest>(msg_); request_ptr->Run(); EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)); - SmartObjectSPtr response = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map); (*response)[strings::msg_params][strings::info] = "info"; EXPECT_CALL( mock_message_helper_, @@ -1122,8 +1122,8 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( response, am::commands::Command::CommandSource::SOURCE_SDL)); - utils::SharedPtr<CommandRequestImpl> base_class_request = - static_cast<utils::SharedPtr<CommandRequestImpl> >(request_ptr); + std::shared_ptr<CommandRequestImpl> base_class_request = + static_cast<std::shared_ptr<CommandRequestImpl> >(request_ptr); base_class_request->onTimeOut(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc index 9fad021c3e..ecaa436529 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_sub_menu_request_test.cc @@ -57,7 +57,7 @@ using am::event_engine::Event; using ::testing::_; using ::testing::Return; -typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr; +typedef std::shared_ptr<AddSubMenuRequest> AddSubMenuPtr; namespace { const uint32_t kConnectionKey = 2u; @@ -98,7 +98,7 @@ TEST_F(AddSubMenuRequestTest, Run_ImageVerificationFailed_EXPECT_INVALID_DATA) { EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::INVALID_DATA), _)); - utils::SharedPtr<AddSubMenuRequest> request_ptr = + std::shared_ptr<AddSubMenuRequest> request_ptr = CreateCommand<AddSubMenuRequest>(msg); request_ptr->Run(); @@ -110,7 +110,7 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*msg)[am::strings::msg_params][am::strings::menu_id] = menu_id; - utils::SharedPtr<AddSubMenuRequest> command = + std::shared_ptr<AddSubMenuRequest> command = CreateCommand<AddSubMenuRequest>(msg); ON_CALL(app_mngr_, application(kConnectionKey)) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc index ac870e7001..7d2dd0b2c2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_maneuver_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -64,7 +64,7 @@ using sdl_rpc_plugin::commands::AlertManeuverRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -typedef SharedPtr<AlertManeuverRequest> CommandPtr; +typedef std::shared_ptr<AlertManeuverRequest> CommandPtr; class AlertManeuverRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { @@ -80,7 +80,7 @@ class AlertManeuverRequestTest am::event_engine::Event event(hmi_apis::FunctionID::TTS_Speak); event.set_smart_object(*response); - utils::SharedPtr<AlertManeuverRequest> command = + std::shared_ptr<AlertManeuverRequest> command = CreateCommand<AlertManeuverRequest>(response); MockAppPtr mock_app(CreateMockApp()); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc index 5835cbff81..895aafa0c8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc @@ -56,14 +56,14 @@ using sdl_rpc_plugin::commands::AlertRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using ::utils::SharedPtr; + using am::event_engine::Event; using policy_test::MockPolicyHandlerInterface; using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -typedef SharedPtr<AlertRequest> CommandPtr; +typedef std::shared_ptr<AlertRequest> CommandPtr; namespace { const int32_t kCommandId = 1; @@ -192,7 +192,7 @@ TEST_F(AlertRequestTest, OnTimeout_GENERIC_ERROR) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<AlertRequest> command = CreateCommand<AlertRequest>(); + std::shared_ptr<AlertRequest> command = CreateCommand<AlertRequest>(); EXPECT_CALL( mock_message_helper_, @@ -223,7 +223,7 @@ TEST_F(AlertRequestTest, OnEvent_UI_HmiSendSuccess_UNSUPPORTED_RESOURCE) { (*command_msg)[am::strings::msg_params][am::strings::menu_params] [am::strings::menu_name] = "menu_name"; - utils::SharedPtr<AlertRequest> command = + std::shared_ptr<AlertRequest> command = CreateCommand<AlertRequest>(command_msg); MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc index 3d6a345ced..56f06890c4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/change_registration_test.cc @@ -37,9 +37,9 @@ #include "mobile/change_registration_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "utils/custom_string.h" #include "smart_objects/smart_object.h" #include "application_manager/commands/command_request_test.h" @@ -66,7 +66,7 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::ReturnRef; using ::testing::SetArgPointee; @@ -149,7 +149,7 @@ class ChangeRegistrationRequestTest hmi_apis::Common_Result::UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); - utils::SharedPtr<ChangeRegistrationRequest> command = + std::shared_ptr<ChangeRegistrationRequest> command = CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); MockAppPtr mock_app = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); @@ -279,7 +279,7 @@ typedef ChangeRegistrationRequestTest::MockHMICapabilities MockHMICapabilities; TEST_F(ChangeRegistrationRequestTest, OnEvent_VRHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); - utils::SharedPtr<ChangeRegistrationRequest> command = + std::shared_ptr<ChangeRegistrationRequest> command = CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); am::ApplicationSet application_set; @@ -367,7 +367,7 @@ TEST_F(ChangeRegistrationRequestTest, TEST_F(ChangeRegistrationRequestTest, OnEvent_TTS_UNSUPPORTED_RESOURCE_STATE_NOT_AVAILABLE_Expect_false) { MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); - utils::SharedPtr<ChangeRegistrationRequest> command = + std::shared_ptr<ChangeRegistrationRequest> command = CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); MockAppPtr mock_app = CreateMockApp(); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app)); @@ -472,7 +472,7 @@ TEST_F(ChangeRegistrationRequestTest, OnEvent_UIHmiSendSuccess_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_from_mobile = CreateMsgFromMobile(); - utils::SharedPtr<ChangeRegistrationRequest> command = + std::shared_ptr<ChangeRegistrationRequest> command = CreateCommand<ChangeRegistrationRequest>(msg_from_mobile); am::ApplicationSet application_set; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc index 10ffbded09..099dc216c8 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc @@ -38,9 +38,9 @@ #include "mobile/create_interaction_choice_set_response.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/commands/command_request_test.h" @@ -65,7 +65,7 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::ReturnRef; using ::testing::AtLeast; @@ -77,9 +77,9 @@ namespace custom_str = utils::custom_string; namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; -typedef SharedPtr<CreateInteractionChoiceSetRequest> +typedef std::shared_ptr<CreateInteractionChoiceSetRequest> CreateInteractionChoiceSetRequestPtr; -typedef SharedPtr<CreateInteractionChoiceSetResponse> +typedef std::shared_ptr<CreateInteractionChoiceSetResponse> CreateInteractionChoiceSetResponsePtr; typedef NiceMock< @@ -171,7 +171,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeout_GENERIC_ERROR) { am::mobile_api::Result::GENERIC_ERROR; (*msg_vr)[strings::msg_params][strings::success] = false; - utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr = + std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr = CreateCommand<CreateInteractionChoiceSetRequest>(); MockAppPtr mock_app = CreateMockApp(); @@ -203,7 +203,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) { (*msg_vr)[strings::msg_params][strings::choice_set][0][strings::menu_name] = "menu_name"; (*msg_vr)[strings::msg_params][strings::interaction_choice_set_id] = 11; - utils::SharedPtr<CreateInteractionChoiceSetRequest> req_vr = + std::shared_ptr<CreateInteractionChoiceSetRequest> req_vr = CreateCommand<CreateInteractionChoiceSetRequest>(msg_vr); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc index e3a4e0f381..a87d172923 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_command_request_test.cc @@ -36,7 +36,7 @@ #include "mobile/delete_command_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -64,7 +64,7 @@ using am::event_engine::Event; using am::MockMessageHelper; using am::MockHmiInterfaces; -typedef SharedPtr<DeleteCommandRequest> DeleteCommandPtr; +typedef std::shared_ptr<DeleteCommandRequest> DeleteCommandPtr; namespace { const int32_t kCommandId = 1; @@ -260,7 +260,7 @@ TEST_F(DeleteCommandRequestTest, MessageSharedPtr result_msg( CatchMobileCommandResult(CallOnEvent(*command, event_ui))); - ASSERT_TRUE(result_msg); + ASSERT_TRUE((bool)result_msg); ResultCommandExpectations(result_msg, "UI is not supported by system"); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc index 5cc9dcf543..0ed7a92fa4 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc @@ -39,7 +39,7 @@ #include "mobile/delete_file_response.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "utils/file_system.h" #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -77,8 +77,8 @@ using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockMessageHelper; -typedef SharedPtr<DeleteFileRequest> DeleteFileRequestPtr; -typedef SharedPtr<DeleteFileResponse> DeleteFileResponsePtr; +typedef std::shared_ptr<DeleteFileRequest> DeleteFileRequestPtr; +typedef std::shared_ptr<DeleteFileResponse> DeleteFileResponsePtr; typedef NiceMock< ::test::components::application_manager_test::MockHMICapabilities> MockHMICapabilities; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc index b2daef9cd2..43c30809e5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc @@ -37,7 +37,7 @@ #include "mobile/delete_interaction_choice_set_response.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -63,9 +63,9 @@ using sdl_rpc_plugin::commands::DeleteInteractionChoiceSetResponse; using am::commands::MessageSharedPtr; using am::event_engine::Event; -typedef SharedPtr<DeleteInteractionChoiceSetRequest> +typedef std::shared_ptr<DeleteInteractionChoiceSetRequest> DeleteInteractionChoiceSetRequestPtr; -typedef SharedPtr<DeleteInteractionChoiceSetResponse> +typedef std::shared_ptr<DeleteInteractionChoiceSetResponse> DeleteInteractionChoiceSetResponsePtr; MATCHER_P(CheckMessageSuccess, success, "") { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc index 5dad433d6d..f1c44f86ac 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_sub_menu_test.cc @@ -65,8 +65,8 @@ using am::MockMessageHelper; using sdl_rpc_plugin::commands::DeleteSubMenuRequest; using sdl_rpc_plugin::commands::DeleteSubMenuResponse; -typedef SharedPtr<DeleteSubMenuRequest> DeleteSubMenuRequestPtr; -typedef SharedPtr<DeleteSubMenuResponse> DeleteSubMenuResponsePtr; +typedef std::shared_ptr<DeleteSubMenuRequest> DeleteSubMenuRequestPtr; +typedef std::shared_ptr<DeleteSubMenuResponse> DeleteSubMenuResponsePtr; MATCHER_P(CheckMessageResultCode, result_code, "") { return (*arg)[am::strings::msg_params][am::strings::result_code].asInt() == @@ -123,7 +123,7 @@ TEST_F(DeleteSubMenuRequestTest, DISABLED_OnEvent_UI_UNSUPPORTED_RESOURCE) { (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*msg)[am::strings::msg_params][am::strings::menu_id] = 10u; - utils::SharedPtr<DeleteSubMenuRequest> command = + std::shared_ptr<DeleteSubMenuRequest> command = CreateCommand<DeleteSubMenuRequest>(msg); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc index bf689629b4..7052830d49 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/dial_number_request_test.cc @@ -35,7 +35,7 @@ #include <vector> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -61,7 +61,7 @@ using sdl_rpc_plugin::commands::DialNumberRequest; using am::event_engine::Event; namespace mobile_result = mobile_apis::Result; -typedef SharedPtr<DialNumberRequest> DialNumberRequestPtr; +typedef std::shared_ptr<DialNumberRequest> DialNumberRequestPtr; namespace { const uint32_t kConnectionKey = 2u; 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 a8afe4007f..c6601d6352 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 @@ -292,18 +292,18 @@ TYPED_TEST_CASE(MobileCommandsTestSecond, MobileCommandsListSecond); TYPED_TEST_CASE(MobileCommandsTestThird, MobileCommandsListThird); TYPED_TEST(MobileCommandsTestFirst, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(MobileCommandsTestSecond, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } TYPED_TEST(MobileCommandsTestThird, CtorAndDtorCall) { - utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); UNUSED(command); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc index 567f46e4ea..304cf13ffd 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/end_audio_pass_thru_request_test.cc @@ -60,7 +60,7 @@ using sdl_rpc_plugin::commands::EndAudioPassThruRequest; using am::event_engine::Event; using am::MockMessageHelper; -typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr; +typedef std::shared_ptr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr; class EndAudioPassThruRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc index 0239f3c7d7..09a3336a10 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_way_points_request_test.cc @@ -31,7 +31,7 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" #include "application_manager/application.h" @@ -58,7 +58,7 @@ using sdl_rpc_plugin::commands::GetWayPointsRequest; using application_manager::MockMessageHelper; using application_manager::MockHmiInterfaces; -typedef SharedPtr<GetWayPointsRequest> CommandPtr; +typedef std::shared_ptr<GetWayPointsRequest> CommandPtr; typedef mobile_apis::Result::eType MobileResult; typedef hmi_apis::Common_Result::eType HmiResult; @@ -75,7 +75,7 @@ class GetWayPointsRequestTest GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {} void SetUp() OVERRIDE { - message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map); + message_ = std::make_shared<SmartObject>(::smart_objects::SmartType_Map); (*message_)[am::strings::msg_params] = ::smart_objects::SmartObject(::smart_objects::SmartType_Map); @@ -85,7 +85,7 @@ class GetWayPointsRequestTest MockAppPtr mock_app_; MessageSharedPtr message_; - utils::SharedPtr<GetWayPointsRequest> command_sptr_; + std::shared_ptr<GetWayPointsRequest> command_sptr_; }; class GetWayPointsRequestOnEventTest @@ -133,7 +133,7 @@ TEST_F(GetWayPointsRequestTest, (*message_)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<am::Application> null_application_sptr; + std::shared_ptr<am::Application> null_application_sptr; EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(null_application_sptr)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc index f9fd31f99a..3fcc4225f3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -69,10 +69,10 @@ class ListFilesRequestTest }; TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) { - SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); + std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); ON_CALL(app_mngr_, application(_)) - .WillByDefault(Return(SharedPtr<am::Application>())); + .WillByDefault(Return(std::shared_ptr<am::Application>())); MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command))); EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, @@ -83,7 +83,7 @@ TEST_F(ListFilesRequestTest, Run_AppNotRegistered_UNSUCCESS) { TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) { MockAppPtr app(CreateMockApp()); - SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); + std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); ON_CALL(*app, hmi_level()) @@ -108,7 +108,7 @@ TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) { TEST_F(ListFilesRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); - SharedPtr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); + std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>()); EXPECT_CALL(app_mngr_, get_settings()) .WillRepeatedly(ReturnRef(app_mngr_settings_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc index d2e86f0103..2ea0091332 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -61,7 +61,7 @@ using ::testing::_; using ::testing::Types; using ::testing::Return; -using ::utils::SharedPtr; + using am::commands::MessageSharedPtr; namespace { @@ -131,7 +131,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = mobile_apis::ButtonName::CUSTOM_BUTTON; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); command->Run(); @@ -148,7 +148,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, mobile_apis::ButtonName::CUSTOM_BUTTON; (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); @@ -170,7 +170,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, (*notification_msg)[am::strings::msg_params] [am::hmi_response::custom_button_id] = kCustomButtonId; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); EXPECT_CALL(this->app_mngr_, application(kAppId)) @@ -192,7 +192,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, (*notification_msg)[am::strings::msg_params] [am::hmi_response::custom_button_id] = kCustomButtonId; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); @@ -216,7 +216,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) { (*notification_msg)[am::strings::msg_params] [am::hmi_response::custom_button_id] = kCustomButtonId; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); @@ -241,7 +241,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_NoSubscribedApps_UNSUCCESS) { (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = kButtonName; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); const std::vector<ApplicationSharedPtr> empty_subscribed_apps_list; @@ -260,7 +260,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) { (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = kButtonName; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); @@ -286,7 +286,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = kButtonName; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); @@ -312,7 +312,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) { (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] = kButtonName; - SharedPtr<Notification> command( + std::shared_ptr<Notification> command( this->template CreateCommand<Notification>(notification_msg)); typename TestFixture::MockAppPtr mock_app = this->CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc index 9e12303f23..2fd6f6137d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_command_notification_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -55,7 +55,7 @@ using ::testing::Return; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::OnCommandNotification; -typedef ::utils::SharedPtr<OnCommandNotification> CommandPtr; +typedef std::shared_ptr<OnCommandNotification> CommandPtr; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc index 86df3cdab6..1d6711e36f 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hash_change_notification_test.cc @@ -63,7 +63,7 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::connection_key] = kConnectionKey; - SharedPtr<OnHashChangeNotification> command = + std::shared_ptr<OnHashChangeNotification> command = CreateCommand<OnHashChangeNotification>(msg); std::string return_string = "1234"; @@ -93,7 +93,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) { MessageSharedPtr msg = CreateMessage(); (*msg)[strings::params][strings::connection_key] = kConnectionKey; - SharedPtr<OnHashChangeNotification> command = + std::shared_ptr<OnHashChangeNotification> command = CreateCommand<OnHashChangeNotification>(msg); std::string return_string; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc index 43e01c5a3d..333c204d57 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc @@ -78,7 +78,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_CurrentStateForeground_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -106,7 +106,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, TEST_F(OnHMIStatusNotificationFromMobileTest, Run_InvalidApp_NoNotification) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -132,7 +132,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_CurrentStateNotForeground_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -161,7 +161,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_ProtocolVersionKV3_NoNotification) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_BACKGROUND); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -190,7 +190,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_AppNotRequestedBeforeAndKV3_NoNotification) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -218,7 +218,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_AppNotRequestedBefore_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -249,7 +249,7 @@ TEST_F(OnHMIStatusNotificationFromMobileTest, Run_AnotherForegroundSDLApp_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotificationFromMobile> command = + std::shared_ptr<OnHMIStatusNotificationFromMobile> command = CreateCommand<OnHMIStatusNotificationFromMobile>(msg); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc index afb1574cbf..ba3b1e8f1d 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_hmi_status_notification_test.cc @@ -85,7 +85,7 @@ class OnHMIStatusNotificationTest TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotification> command = + std::shared_ptr<OnHMIStatusNotification> command = CreateCommand<OnHMIStatusNotification>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -104,7 +104,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) { TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::INVALID_ENUM); - SharedPtr<OnHMIStatusNotification> command = + std::shared_ptr<OnHMIStatusNotification> command = CreateCommand<OnHMIStatusNotification>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -121,7 +121,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_InvalidEnum_SUCCESS) { TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotification> command = + std::shared_ptr<OnHMIStatusNotification> command = CreateCommand<OnHMIStatusNotification>(msg); MockAppPtr mock_app = CreateMockApp(); @@ -143,7 +143,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_FullAndFalseProperties_SUCCESS) { TEST_F(OnHMIStatusNotificationTest, Run_FullAndTrueProperties_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(mobile_apis::HMILevel::HMI_FULL); - SharedPtr<OnHMIStatusNotification> command = + std::shared_ptr<OnHMIStatusNotification> command = CreateCommand<OnHMIStatusNotification>(msg); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc index ebfc2256ac..04f88e2b13 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc @@ -79,8 +79,8 @@ class OnKeyBoardInputNotificationTest (*msg)[strings::params][strings::protocol_version].asInt()); } - MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) { - app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set); + MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) { + app_set = (!app_set ? std::make_shared<ApplicationSet>() : app_set); MockAppPtr app(CreateMockApp()); app_set->insert(app); EXPECT_CALL(app_mngr_, applications()) @@ -88,14 +88,14 @@ class OnKeyBoardInputNotificationTest return app; } - SharedPtr<ApplicationSet> app_set_; + std::shared_ptr<ApplicationSet> app_set_; std::shared_ptr<sync_primitives::Lock> lock_; }; TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<OnKeyBoardInputNotification> command = + std::shared_ptr<OnKeyBoardInputNotification> command = CreateCommand<OnKeyBoardInputNotification>(msg); MockAppPtr mock_app(InitAppSetDataAccessor(app_set_)); @@ -119,7 +119,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) { TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<OnKeyBoardInputNotification> command = + std::shared_ptr<OnKeyBoardInputNotification> command = CreateCommand<OnKeyBoardInputNotification>(msg); MockAppPtr mock_app(InitAppSetDataAccessor(app_set_)); @@ -144,7 +144,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) { TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<OnKeyBoardInputNotification> command = + std::shared_ptr<OnKeyBoardInputNotification> command = CreateCommand<OnKeyBoardInputNotification>(msg); MockAppPtr mock_app(InitAppSetDataAccessor(app_set_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc index d6e1b2fe52..4981301e07 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc @@ -88,7 +88,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) { (*msg)[strings::params][strings::connection_key] = kConnectionKey; (*msg)[strings::msg_params][strings::request_type] = request_type; - SharedPtr<OnSystemRequestNotification> command = + std::shared_ptr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -128,7 +128,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) { (*msg)[strings::params][strings::connection_key] = kConnectionKey; (*msg)[strings::msg_params][strings::request_type] = request_type; - SharedPtr<OnSystemRequestNotification> command = + std::shared_ptr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -162,7 +162,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) { (*msg)[strings::params][strings::connection_key] = kConnectionKey; (*msg)[strings::msg_params][strings::request_type] = request_type; - SharedPtr<OnSystemRequestNotification> command = + std::shared_ptr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -185,7 +185,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) { (*msg)[strings::params][strings::connection_key] = kConnectionKey; (*msg)[strings::msg_params][strings::request_type] = request_type; - SharedPtr<OnSystemRequestNotification> command = + std::shared_ptr<OnSystemRequestNotification> command = CreateCommand<OnSystemRequestNotification>(msg); EXPECT_CALL(app_mngr_, application(kConnectionKey)) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc index 14939a433d..3d989db478 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc @@ -35,7 +35,7 @@ #include "gtest/gtest.h" #include "mobile/on_tbt_client_state_notification.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -56,7 +56,7 @@ using ::testing::Return; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::OnTBTClientStateNotification; -typedef ::utils::SharedPtr<OnTBTClientStateNotification> NotificationPtr; +typedef std::shared_ptr<OnTBTClientStateNotification> NotificationPtr; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc index 4576637d8d..f69dd5da2e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_touch_event_notification_test.cc @@ -35,7 +35,7 @@ #include "gtest/gtest.h" #include "mobile/on_touch_event_notification.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -56,7 +56,7 @@ using ::testing::Return; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::mobile::OnTouchEventNotification; -typedef ::utils::SharedPtr<OnTouchEventNotification> NotificationPtr; +typedef std::shared_ptr<OnTouchEventNotification> NotificationPtr; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc index e0b7ab3b38..97a290e792 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_way_point_change_notification_test.cc @@ -35,7 +35,7 @@ #include "gtest/gtest.h" #include "mobile/on_way_point_change_notification.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -56,7 +56,7 @@ using ::testing::Return; using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::OnWayPointChangeNotification; -typedef ::utils::SharedPtr<OnWayPointChangeNotification> NotificationPtr; +typedef std::shared_ptr<OnWayPointChangeNotification> NotificationPtr; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc index f06a642e3b..7d01dcb722 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc @@ -55,7 +55,7 @@ using sdl_rpc_plugin::commands::PerformAudioPassThruRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; @@ -80,7 +80,7 @@ class PerformAudioPassThruRequestTest public: PerformAudioPassThruRequestTest() : mock_app_(CreateMockApp()) - , message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map)) + , message_(std::make_shared<SmartObject>(::smart_objects::SmartType_Map)) , msg_params_((*message_)[am::strings::msg_params]) {} MessageSharedPtr CreateFullParamsUISO() { @@ -151,7 +151,7 @@ class PerformAudioPassThruRequestTest MockAppPtr mock_app_; MessageSharedPtr message_; ::smart_objects::SmartObject& msg_params_; - utils::SharedPtr<PerformAudioPassThruRequest> command_sptr_; + std::shared_ptr<PerformAudioPassThruRequest> command_sptr_; MockAppPtr application_sptr_; }; @@ -162,10 +162,10 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) { (*msg_ui)[am::strings::msg_params][am::strings::success] = false; MessageSharedPtr message = - utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map); + std::make_shared<SmartObject>(::smart_objects::SmartType_Map); (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<PerformAudioPassThruRequest> command = + std::shared_ptr<PerformAudioPassThruRequest> command = CreateCommand<PerformAudioPassThruRequest>(message); uint32_t app_id = kConnectionKey; @@ -209,7 +209,7 @@ TEST_F(PerformAudioPassThruRequestTest, EXPECT_CALL(*application_sptr_, hmi_level()) .WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL)); - utils::SharedPtr<PerformAudioPassThruRequest> command = + std::shared_ptr<PerformAudioPassThruRequest> command = CreateCommand<PerformAudioPassThruRequest>(mobile_request); ON_CALL(mock_hmi_interfaces_, @@ -271,7 +271,7 @@ TEST_F(PerformAudioPassThruRequestTest, TEST_F(PerformAudioPassThruRequestTest, Run_InvalidApp_ApplicationNotRegisteredResponce) { - utils::SharedPtr<am::Application> null_application_sptr; + std::shared_ptr<am::Application> null_application_sptr; EXPECT_CALL(app_mngr_, application(_)) .WillOnce(Return(null_application_sptr)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc index 2ffe9195b6..e4ed330681 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc @@ -37,9 +37,9 @@ #include "mobile/perform_interaction_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/commands/command_request_test.h" @@ -63,7 +63,7 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::ReturnRef; using sdl_rpc_plugin::commands::PerformInteractionRequest; @@ -113,7 +113,7 @@ TEST_F(PerformInteractionRequestTest, OnTimeout_VR_GENERIC_ERROR) { MessageSharedPtr request_msg = CreateMessage(smart_objects::SmartType_Map); (*request_msg)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::BOTH; - utils::SharedPtr<PerformInteractionRequest> command = + std::shared_ptr<PerformInteractionRequest> command = CreateCommand<PerformInteractionRequest>(request_msg); MockAppPtr mock_app; @@ -156,7 +156,7 @@ TEST_F(PerformInteractionRequestTest, (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey; (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::VR_ONLY; - utils::SharedPtr<PerformInteractionRequest> command = + std::shared_ptr<PerformInteractionRequest> command = CreateCommand<PerformInteractionRequest>(msg_from_mobile); command->Init(); @@ -210,7 +210,7 @@ TEST_F(PerformInteractionRequestTest, (*msg_from_mobile)[strings::params][strings::connection_key] = kConnectionKey; (*msg_from_mobile)[strings::msg_params][strings::interaction_mode] = mobile_apis::InteractionMode::VR_ONLY; - utils::SharedPtr<PerformInteractionRequest> command = + std::shared_ptr<PerformInteractionRequest> command = CreateCommand<PerformInteractionRequest>(msg_from_mobile); ON_CALL(mock_hmi_interfaces_, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc index c5feeeba25..6f151d4080 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc @@ -42,7 +42,7 @@ #include "mobile/put_file_response.h" #include "mobile/put_file_request.h" -#include "utils/make_shared.h" + #include "utils/file_system.h" #include "smart_objects/smart_object.h" #include "interfaces/MOBILE_API.h" @@ -68,8 +68,8 @@ using sdl_rpc_plugin::commands::PutFileResponse; using am::commands::MessageSharedPtr; using policy_test::MockPolicyHandlerInterface; -typedef SharedPtr<PutFileRequest> PutFileRequestPtr; -typedef SharedPtr<PutFileResponse> PutFileResponsePtr; +typedef std::shared_ptr<PutFileRequest> PutFileRequestPtr; +typedef std::shared_ptr<PutFileResponse> PutFileResponsePtr; namespace { const uint32_t kConnectionKey = 1u; @@ -131,7 +131,7 @@ class PutFileResponceTest : public CommandsTest<CommandsTestMocks::kIsNice> { } MessageSharedPtr message_; - SharedPtr<PutFileResponse> command_sptr_; + std::shared_ptr<PutFileResponse> command_sptr_; }; TEST_F(PutFileResponceTest, Run_InvalidApp_ApplicationNotRegisteredResponce) { @@ -140,7 +140,7 @@ TEST_F(PutFileResponceTest, Run_InvalidApp_ApplicationNotRegisteredResponce) { message_ref[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<am::Application> null_application_sptr; + std::shared_ptr<am::Application> null_application_sptr; EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(null_application_sptr)); EXPECT_CALL( @@ -158,8 +158,8 @@ TEST_F(PutFileResponceTest, Run_ApplicationRegistered_Success) { kConnectionKey; message_ref[am::strings::msg_params][am::strings::success] = true; - utils::SharedPtr<am::Application> application_sptr = - utils::MakeShared<MockApplication>(); + std::shared_ptr<am::Application> application_sptr = + std::make_shared<MockApplication>(); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(application_sptr)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc index a44a4a452a..807d59fac2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc @@ -36,7 +36,7 @@ #include "gtest/gtest.h" #include "mobile/register_app_interface_request.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -70,7 +70,7 @@ using ::testing::DoAll; namespace am = ::application_manager; -using ::utils::SharedPtr; + using am::commands::MessageSharedPtr; using sdl_rpc_plugin::commands::RegisterAppInterfaceRequest; @@ -220,12 +220,12 @@ class RegisterAppInterfaceRequestTest EXPECT_CALL( app_mngr_, OnApplicationSwitched( - MockAppPtr::static_pointer_cast<application_manager::Application>( + std::static_pointer_cast<application_manager::Application>( mock_app))); } MessageSharedPtr msg_; - SharedPtr<RegisterAppInterfaceRequest> command_; + std::shared_ptr<RegisterAppInterfaceRequest> command_; const utils::custom_string::CustomString app_name_; std::shared_ptr<sync_primitives::Lock> lock_ptr_; @@ -279,7 +279,7 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) { ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _)) .WillByDefault(Return(true)); policy::StatusNotifier notify_upd_manager = - utils::MakeShared<utils::CallNothing>(); + std::make_shared<utils::CallNothing>(); ON_CALL(mock_policy_handler_, AddApplication(_, _)) .WillByDefault(Return(notify_upd_manager)); @@ -377,7 +377,7 @@ TEST_F(RegisterAppInterfaceRequestTest, ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _)) .WillByDefault(Return(true)); policy::StatusNotifier notify_upd_manager = - utils::MakeShared<utils::CallNothing>(); + std::make_shared<utils::CallNothing>(); ON_CALL(mock_policy_handler_, AddApplication(_, _)) .WillByDefault(Return(notify_upd_manager)); @@ -434,7 +434,7 @@ TEST_F(RegisterAppInterfaceRequestTest, EXPECT_CALL( mock_resume_crt_, CheckApplicationHash( - MockAppPtr::static_pointer_cast<application_manager::Application>( + std::static_pointer_cast<application_manager::Application>( mock_app), request_hash_id)).WillOnce(Return(true)); @@ -469,14 +469,14 @@ TEST_F(RegisterAppInterfaceRequestTest, EXPECT_CALL( mock_resume_crt_, CheckApplicationHash( - MockAppPtr::static_pointer_cast<application_manager::Application>( + std::static_pointer_cast<application_manager::Application>( mock_app), request_hash_id)).WillOnce(Return(false)); EXPECT_CALL( mock_application_helper_, RecallApplicationData( - MockAppPtr::static_pointer_cast<application_manager::Application>( + std::static_pointer_cast<application_manager::Application>( mock_app), _)); @@ -506,7 +506,7 @@ TEST_F(RegisterAppInterfaceRequestTest, EXPECT_CALL( mock_application_helper_, RecallApplicationData( - MockAppPtr::static_pointer_cast<application_manager::Application>( + std::static_pointer_cast<application_manager::Application>( mock_app), _)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc index 4cdf4f8858..6eafae16c2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc @@ -38,8 +38,8 @@ #include "mobile/reset_global_properties_response.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "smart_objects/smart_object.h" #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" @@ -69,8 +69,8 @@ using am::commands::MessageSharedPtr; using am::event_engine::Event; using am::MockMessageHelper; -typedef SharedPtr<ResetGlobalPropertiesRequest> ResetGlobalPropertiesRequestPtr; -typedef SharedPtr<ResetGlobalPropertiesResponse> +typedef std::shared_ptr<ResetGlobalPropertiesRequest> ResetGlobalPropertiesRequestPtr; +typedef std::shared_ptr<ResetGlobalPropertiesResponse> ResetGlobalPropertiesResponsePtr; namespace { @@ -219,7 +219,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); smart_objects::SmartObjectSPtr vr_help = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); @@ -232,7 +232,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) { set_menu_title(msg_params[am::hmi_request::menu_title])); const smart_objects::SmartObjectSPtr so_help_prompt = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); EXPECT_CALL(*mock_app_, help_prompt()).WillOnce(Return(so_help_prompt.get())); EXPECT_CALL(*mock_app_, timeout_prompt()) @@ -271,7 +271,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true)); smart_objects::SmartObjectSPtr vr_help = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); @@ -310,7 +310,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); smart_objects::SmartObjectSPtr prompt = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); *prompt = "prompt"; EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); @@ -368,7 +368,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) { hmi_apis::FunctionID::UI_SetGlobalProperties))) .WillOnce(Return(true)); smart_objects::SmartObjectSPtr vr_help = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_)) .WillOnce(Return(vr_help)); @@ -406,7 +406,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); smart_objects::SmartObjectSPtr prompt = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); *prompt = "prompt"; EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); @@ -439,7 +439,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, // TTS doesn't respond, so timeout should send generic error smart_objects::SmartObjectSPtr response = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*response)[am::strings::msg_params][am::strings::result_code] = mobile_apis::Result::GENERIC_ERROR; EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) @@ -471,7 +471,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); smart_objects::SmartObjectSPtr prompt = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); *prompt = "prompt"; EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); @@ -501,7 +501,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, // UI doesn't respond, so timeout should send generic error smart_objects::SmartObjectSPtr response = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*response)[am::strings::msg_params][am::strings::result_code] = mobile_apis::Result::GENERIC_ERROR; EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) @@ -535,7 +535,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, EXPECT_CALL(*mock_app_, set_timeout_prompt(_)); smart_objects::SmartObjectSPtr prompt = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); *prompt = "prompt"; EXPECT_CALL(*mock_app_, timeout_prompt()).WillOnce(Return(prompt.get())); @@ -555,7 +555,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, // TTS and UI don't respond, so timeout should send generic error std::string info = "TTS, UI component does not respond"; smart_objects::SmartObjectSPtr response = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*response)[am::strings::msg_params][am::strings::result_code] = mobile_apis::Result::GENERIC_ERROR; EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _)) diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc index f550043414..382ccf4b0e 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/scrollable_message_test.cc @@ -61,7 +61,7 @@ using sdl_rpc_plugin::commands::ScrollableMessageRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Eq; using ::testing::Ref; @@ -116,7 +116,7 @@ class ScrollableMessageRequestTest MockAppPtr mock_app_; MessageSharedPtr msg_; - SharedPtr<ScrollableMessageRequest> command_; + std::shared_ptr<ScrollableMessageRequest> command_; }; typedef ScrollableMessageRequestTest::MockHMICapabilities MockHMICapabilities; @@ -125,7 +125,7 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_ui = CreateFullParamsUISO(); (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<ScrollableMessageRequest> command = + std::shared_ptr<ScrollableMessageRequest> command = CreateCommand<ScrollableMessageRequest>(msg_ui); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc index c0c44922e3..6c7127e48c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_haptic_data_test.cc @@ -57,8 +57,8 @@ using sdl_rpc_plugin::commands::SendHapticDataRequest; using sdl_rpc_plugin::commands::SendHapticDataResponse; using am::commands::MessageSharedPtr; -typedef SharedPtr<SendHapticDataRequest> SendHapticDataRequestPtr; -typedef SharedPtr<SendHapticDataResponse> SendHapticDataResponsePtr; +typedef std::shared_ptr<SendHapticDataRequest> SendHapticDataRequestPtr; +typedef std::shared_ptr<SendHapticDataResponse> SendHapticDataResponsePtr; namespace { const uint32_t kConnectionKey = 1u; @@ -91,7 +91,7 @@ class SendHapticDataResponseTest } MessageSharedPtr message_; - SharedPtr<SendHapticDataResponse> command_sptr_; + std::shared_ptr<SendHapticDataResponse> command_sptr_; }; TEST_F(SendHapticDataRequestTest, Run_SUCCESS) { diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc index d0072f6288..bf75e651c6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/send_location_request_test.cc @@ -36,7 +36,7 @@ #include "mobile/send_location_request.h" #include "application_manager/mock_hmi_capabilities.h" #include "application_manager/mock_message_helper.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/command_request_test.h" namespace test { @@ -50,7 +50,7 @@ using sdl_rpc_plugin::commands::SendLocationRequest; using application_manager::MockMessageHelper; using test::components::application_manager_test::MockHMICapabilities; using smart_objects::SmartObject; -using utils::SharedPtr; + using testing::_; using testing::Return; using testing::ReturnRef; @@ -95,11 +95,11 @@ class SendLocationRequestTest } }; - typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt; + typedef std::shared_ptr<UnwrappedSendLocationRequest> CommandSPrt; SendLocationRequestTest() { mock_app_ = CreateMockApp(); - disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + disp_cap_ = std::make_shared<SmartObject>(smart_objects::SmartType_Map); message_ = CreateMessage(); command_ = CreateCommand<UnwrappedSendLocationRequest>(message_); } @@ -158,7 +158,7 @@ class SendLocationRequestTest } MockAppPtr mock_app_; - SharedPtr<SmartObject> disp_cap_; + std::shared_ptr<SmartObject> disp_cap_; MessageSharedPtr message_; CommandSPrt command_; }; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc index e1612dbacb..75d3992c43 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_app_icon_test.cc @@ -60,7 +60,7 @@ using am::MockMessageHelper; using am::MockHmiInterfaces; using test::components::protocol_handler_test::MockProtocolHandler; using test::components::protocol_handler_test::MockProtocolHandlerSettings; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; @@ -110,7 +110,7 @@ TEST_F(SetAppIconRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { ON_CALL(app_mngr_settings_, app_icons_folder()) .WillByDefault(ReturnRef(dir_path)); - utils::SharedPtr<SetAppIconRequest> req_vr = + std::shared_ptr<SetAppIconRequest> req_vr = CreateCommand<SetAppIconRequest>(msg_vr); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc index 0758fb32f4..1ff65196bf 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc @@ -57,12 +57,12 @@ using sdl_rpc_plugin::commands::SetDisplayLayoutRequest; using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -typedef ::utils::SharedPtr<SetDisplayLayoutRequest> CommandPtr; +typedef std::shared_ptr<SetDisplayLayoutRequest> CommandPtr; namespace { const uint32_t kAppId = 1u; @@ -132,7 +132,7 @@ TEST_F(SetDisplayLayoutRequestTest, MessageSharedPtr msg_ui = CreateFullParamsUISO(); (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<SetDisplayLayoutRequest> command = + std::shared_ptr<SetDisplayLayoutRequest> command = CreateCommand<SetDisplayLayoutRequest>(msg_ui); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc index f39ccf7be3..e849866c1a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_global_properties_test.cc @@ -58,7 +58,7 @@ using am::commands::MessageSharedPtr; using am::MockMessageHelper; using am::CommandsMap; using utils::custom_string::CustomString; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; @@ -127,7 +127,7 @@ class SetGlobalPropertiesRequestTest } void OnEventUISetupHelper(MessageSharedPtr msg, - SharedPtr<SetGlobalPropertiesRequest> command) { + std::shared_ptr<SetGlobalPropertiesRequest> command) { SmartObject vr_help_title("yes"); SmartObject vr_help_array(smart_objects::SmartType_Array); VRArraySetupHelper(msg, vr_help_title, vr_help_array); @@ -154,7 +154,7 @@ class SetGlobalPropertiesRequestTest } void OnEventTTSSetupHelper(MessageSharedPtr msg, - SharedPtr<SetGlobalPropertiesRequest> command) { + std::shared_ptr<SetGlobalPropertiesRequest> command) { SmartObject help_prompt(smart_objects::SmartType_Array); help_prompt[0][am::strings::text] = "Help_Prompt_One"; (*msg)[am::strings::msg_params][am::strings::help_prompt] = help_prompt; @@ -275,7 +275,7 @@ TEST_F(SetGlobalPropertiesRequestTest, (*msg_vr)[am::strings::msg_params][am::strings::vr_commands][0] = "vr_command"; - utils::SharedPtr<SetGlobalPropertiesRequest> command = + std::shared_ptr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(msg_vr); EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); @@ -360,7 +360,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_SUCCESS_Expect_MessageNotSend) { am::event_engine::Event event(hmi_apis::FunctionID::TTS_SetGlobalProperties); event.set_smart_object(*response); - utils::SharedPtr<SetGlobalPropertiesRequest> command = + std::shared_ptr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); MockAppPtr mock_app(CreateMockApp()); @@ -393,7 +393,7 @@ TEST_F(SetGlobalPropertiesRequestTest, am::event_engine::Event event_ui( hmi_apis::FunctionID::UI_SetGlobalProperties); event_tts.set_smart_object(*response); - utils::SharedPtr<SetGlobalPropertiesRequest> command = + std::shared_ptr<SetGlobalPropertiesRequest> command = CreateCommand<SetGlobalPropertiesRequest>(response); EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_)) @@ -427,7 +427,7 @@ TEST_F(SetGlobalPropertiesRequestTest, TEST_F(SetGlobalPropertiesRequestTest, Run_VRNoMenuAndKeyboard_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); EXPECT_CALL( mock_hmi_interfaces_, @@ -484,7 +484,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWithMenuAndKeyboard_SUCCESS) { EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -506,7 +506,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenMenuIcon_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -528,7 +528,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRBrokenVRHelp_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -552,7 +552,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRIncorrectSyntax_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(_)).Times(0); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -573,7 +573,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRMissingTitle_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -590,7 +590,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRMissingArray_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -611,7 +611,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_VRWrongOrder_Canceled) { EXPECT_CALL(app_mngr_, RemoveAppFromTTSGlobalPropertiesList(kConnectionKey)); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -642,7 +642,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVR_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -671,7 +671,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataNoDefault_Canceled) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -699,7 +699,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoVRNoDataDefaultCreated_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -741,7 +741,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSHelpAndTimeout_SUCCESS) { EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -775,7 +775,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyHelp_SUCCESS) { .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -809,7 +809,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSOnlyTimeout_SUCCESS) { .WillOnce(ReturnRef(*mock_help_prompt_manager_.get())); EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -826,7 +826,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_TTSIncorrectSyntax_Canceled) { EXPECT_CALL(mock_message_helper_, VerifyImageVrHelpItems(_, _, _)).Times(0); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -842,7 +842,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidHelpPromptText_INVALID_DATA) { ExpectVerifyImageVrHelpUnsuccess(); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -860,7 +860,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidVrHelpText_INVALID_DATA) { ExpectVerifyImageVrHelpSuccess(vr_help); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -879,7 +879,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidImageValue_INVALID_DATA) { ExpectVerifyImageVrHelpSuccess(vr_help); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -897,7 +897,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidMenuIcon_INVALID_DATA) { ExpectVerifyImageSuccess(menu_icon); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -914,7 +914,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidMenuTitle_INVALID_DATA) { ExpectVerifyImageVrHelpUnsuccess(); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -934,7 +934,7 @@ TEST_F(SetGlobalPropertiesRequestTest, ExpectVerifyImageVrHelpUnsuccess(); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -954,7 +954,7 @@ TEST_F(SetGlobalPropertiesRequestTest, ExpectVerifyImageVrHelpUnsuccess(); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ExpectInvalidData(); @@ -968,7 +968,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_NoData_Canceled) { ExpectVerifyImageVrHelpUnsuccess(); EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -982,7 +982,7 @@ TEST_F(SetGlobalPropertiesRequestTest, Run_InvalidApp_Canceled) { EmptyExpectationsSetupHelper(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -994,7 +994,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_PendingRequest_UNSUCCESS) { hmi_apis::Common_Result::SUCCESS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); Event event(hmi_apis::FunctionID::UI_SetGlobalProperties); @@ -1022,7 +1022,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndSuccessResultCode_SUCCESS) { GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventUISetupHelper(msg, command); @@ -1050,7 +1050,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_UIAndWarningResultCode_SUCCESS) { hmi_apis::Common_Result::WARNINGS; (*msg)[am::strings::params][am::hmi_response::code] = response_code; - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); ON_CALL( mock_hmi_interfaces_, @@ -1090,7 +1090,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) { ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_UI)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventUISetupHelper(msg, command); @@ -1111,7 +1111,7 @@ TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidApp_Canceled) { TEST_F(SetGlobalPropertiesRequestTest, OnEvent_InvalidEventID_Canceled) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_)); @@ -1136,7 +1136,7 @@ TEST_F(SetGlobalPropertiesRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventTTSSetupHelper(msg, command); @@ -1170,7 +1170,7 @@ TEST_F(SetGlobalPropertiesRequestTest, ON_CALL(mock_hmi_interfaces_, GetInterfaceState(am::HmiInterfaces::HMI_INTERFACE_TTS)) .WillByDefault(Return(am::HmiInterfaces::STATE_NOT_AVAILABLE)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); OnEventTTSSetupHelper(msg, command); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc index 9d2dd996bc..e6557bdad2 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_media_clock_timer_test.cc @@ -60,7 +60,7 @@ using ::testing::ReturnRef; namespace UpdateMode = mobile_apis::UpdateMode; -typedef SharedPtr<SetMediaClockRequest> SetMediaClockRequestPtr; +typedef std::shared_ptr<SetMediaClockRequest> SetMediaClockRequestPtr; namespace { const uint32_t kConnectionKey = 2u; @@ -116,7 +116,7 @@ TEST_F(SetMediaClockRequestTest, MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<SetMediaClockRequest> command = + std::shared_ptr<SetMediaClockRequest> command = CreateCommand<SetMediaClockRequest>(msg); MessageSharedPtr ev_msg = CreateMessage(smart_objects::SmartType_Map); @@ -160,7 +160,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUp_SUCCESS) { (*msg)[am::strings::msg_params][am::strings::end_time][am::strings::seconds] = kSeconds; - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -196,7 +196,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDown_SUCCESS) { (*msg)[am::strings::msg_params][am::strings::end_time][am::strings::minutes] = kMinutes; - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -232,7 +232,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountUpWrongTime_Canceled) { (*msg)[am::strings::msg_params][am::strings::end_time][am::strings::minutes] = kMinutes; - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); ExpectationsSetupHelper(true); @@ -255,7 +255,7 @@ TEST_F(SetMediaClockRequestTest, Run_UpdateCountDownWrongTime_Canceled) { (*msg)[am::strings::msg_params][am::strings::end_time][am::strings::seconds] = kSeconds; - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -273,7 +273,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoStartTime_Canceled) { (*msg)[am::strings::msg_params][am::strings::update_mode] = UpdateMode::COUNTDOWN; - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); ExpectationsSetupHelper(true); @@ -284,7 +284,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoStartTime_Canceled) { TEST_F(SetMediaClockRequestTest, Run_NoUpdateMode_Canceled) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); ExpectationsSetupHelper(true); @@ -295,7 +295,7 @@ TEST_F(SetMediaClockRequestTest, Run_NoUpdateMode_Canceled) { TEST_F(SetMediaClockRequestTest, Run_NotMediaApp_Canceled) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); ExpectationsSetupHelper(false); @@ -306,7 +306,7 @@ TEST_F(SetMediaClockRequestTest, Run_NotMediaApp_Canceled) { TEST_F(SetMediaClockRequestTest, Run_InvalidApp_Canceled) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) @@ -332,7 +332,7 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) { Event event(hmi_apis::FunctionID::UI_SetMediaClockTimer); event.set_smart_object(*msg); - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); command->on_event(event); } @@ -340,7 +340,7 @@ TEST_F(SetMediaClockRequestTest, OnEvent_Success) { TEST_F(SetMediaClockRequestTest, OnEvent_Canceled) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<SetMediaClockRequest> command( + std::shared_ptr<SetMediaClockRequest> command( CreateCommand<SetMediaClockRequest>(msg)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); Event event(hmi_apis::FunctionID::UI_Slider); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc index 9d5497d4a7..53e803b415 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc @@ -57,7 +57,7 @@ using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; using test::components::policy_test::MockPolicyHandlerInterface; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; @@ -211,7 +211,7 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { (*msg_vr)[am::strings::msg_params][am::strings::menu_params] [am::strings::menu_name] = "menu_name"; - utils::SharedPtr<ShowRequest> command = CreateCommand<ShowRequest>(msg_vr); + std::shared_ptr<ShowRequest> command = CreateCommand<ShowRequest>(msg_vr); MockAppPtr mock_app = CreateMockApp(); ON_CALL(app_mngr_, application(kConnectionKey)) @@ -257,7 +257,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) { msg_params[am::strings::soft_buttons] = "Soft_Buttons"; (*msg)[am::strings::msg_params] = msg_params; SmartObject creation_msg_params(msg_params); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -284,7 +284,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) { SmartObject msg_params(smart_objects::SmartType_Map); msg_params[am::strings::soft_buttons] = ""; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -309,7 +309,7 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) { msg_params[am::strings::soft_buttons] = "Soft_Buttons"; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -336,7 +336,7 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) { msg_params[am::strings::graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -363,7 +363,7 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) { msg_params[am::strings::graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -386,7 +386,7 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) { msg_params[am::strings::graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -409,7 +409,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) { msg_params[am::strings::secondary_graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -435,7 +435,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) { msg_params[am::strings::secondary_graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -459,7 +459,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { msg_params[am::strings::secondary_graphic] = graphic; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -476,7 +476,7 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) { TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_1"; TestSetupHelper(msg, @@ -489,7 +489,7 @@ TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) { TEST_F(ShowRequestTest, Run_MainField1_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_1\\n"; TestSetupHelperWrongSyntax(msg, @@ -502,7 +502,7 @@ TEST_F(ShowRequestTest, Run_MainField1_WrongSyntax) { TEST_F(ShowRequestTest, Run_MainField2_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_2"; TestSetupHelper(msg, @@ -514,7 +514,7 @@ TEST_F(ShowRequestTest, Run_MainField2_SUCCESS) { TEST_F(ShowRequestTest, Run_MainField2_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_2\\n"; TestSetupHelperWrongSyntax(msg, @@ -526,7 +526,7 @@ TEST_F(ShowRequestTest, Run_MainField2_WrongSyntax) { TEST_F(ShowRequestTest, Run_MainField3_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_3"; TestSetupHelper(msg, @@ -538,7 +538,7 @@ TEST_F(ShowRequestTest, Run_MainField3_SUCCESS) { TEST_F(ShowRequestTest, Run_MainField3_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_3\\n"; TestSetupHelperWrongSyntax(msg, @@ -550,7 +550,7 @@ TEST_F(ShowRequestTest, Run_MainField3_WrongSyntax) { TEST_F(ShowRequestTest, Run_MainField4_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_4"; TestSetupHelper(msg, @@ -562,7 +562,7 @@ TEST_F(ShowRequestTest, Run_MainField4_SUCCESS) { TEST_F(ShowRequestTest, Run_MainField4_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_4\\n"; TestSetupHelperWrongSyntax(msg, @@ -574,7 +574,7 @@ TEST_F(ShowRequestTest, Run_MainField4_WrongSyntax) { TEST_F(ShowRequestTest, Run_MainField1_MetadataTag) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_1"; const size_t num_tags = 1; @@ -590,7 +590,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTag) { TEST_F(ShowRequestTest, Run_MainField1_MultipleMetadataTags) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_1"; const size_t num_tags = 5; @@ -610,7 +610,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MultipleMetadataTags) { TEST_F(ShowRequestTest, Run_MainField2_MetadataTag) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_2"; const size_t num_tags = 1; @@ -626,7 +626,7 @@ TEST_F(ShowRequestTest, Run_MainField2_MetadataTag) { TEST_F(ShowRequestTest, Run_MainField3_MetadataTag) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_3"; const size_t num_tags = 1; @@ -642,7 +642,7 @@ TEST_F(ShowRequestTest, Run_MainField3_MetadataTag) { TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_4"; const size_t num_tags = 1; @@ -658,7 +658,7 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) { TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Main_Field_1"; const size_t num_tags = 1; @@ -700,7 +700,7 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) { TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Media_Clock"; TestSetupHelper(msg, @@ -712,7 +712,7 @@ TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) { TEST_F(ShowRequestTest, Run_MediaClock_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Media_Clock\\n"; TestSetupHelperWrongSyntax(msg, @@ -724,7 +724,7 @@ TEST_F(ShowRequestTest, Run_MediaClock_WrongSyntax) { TEST_F(ShowRequestTest, Run_MediaTrack_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Media_Track"; TestSetupHelper(msg, @@ -736,7 +736,7 @@ TEST_F(ShowRequestTest, Run_MediaTrack_SUCCESS) { TEST_F(ShowRequestTest, Run_MediaTrack_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Media_Track\\n"; TestSetupHelperWrongSyntax(msg, @@ -748,7 +748,7 @@ TEST_F(ShowRequestTest, Run_MediaTrack_WrongSyntax) { TEST_F(ShowRequestTest, Run_StatusBar_SUCCESS) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Status_Bar"; TestSetupHelper( @@ -759,7 +759,7 @@ TEST_F(ShowRequestTest, Run_StatusBar_SUCCESS) { TEST_F(ShowRequestTest, Run_StatusBar_WrongSyntax) { MessageSharedPtr msg = CreateMessage(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); text_field_ = "Status_Bar\\n"; TestSetupHelperWrongSyntax( @@ -773,7 +773,7 @@ TEST_F(ShowRequestTest, Run_Alignment_SUCCESS) { msg_params[am::strings::alignment] = "Alignment"; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -797,7 +797,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_SUCCESS) { msg_params[am::strings::custom_presets] = custom_presets; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -820,7 +820,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) { msg_params[am::strings::custom_presets] = custom_presets; (*msg)[am::strings::msg_params] = msg_params; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -836,7 +836,7 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) { TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(MockAppPtr())); @@ -851,7 +851,7 @@ TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) { TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) { MessageSharedPtr msg = CreateMsgParams(); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(app_mngr_, application(kConnectionKey)) .WillOnce(Return(mock_app_)); @@ -869,7 +869,7 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) { hmi_apis::Common_Result::eType::SUCCESS; (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand( MobileResultCodeIs(mobile_apis::Result::eType::SUCCESS), _)); @@ -889,7 +889,7 @@ TEST_F(ShowRequestTest, OnEvent_WarningsResultCode_SUCCESS) { (*msg)[am::strings::params][am::hmi_response::message] = "Response Info"; (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map); - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)); Event event(hmi_apis::FunctionID::UI_Show); @@ -905,7 +905,7 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) { (*msg)[am::strings::params][am::hmi_response::code] = mobile_apis::Result::SUCCESS; - SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); + std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg)); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); Event event(hmi_apis::FunctionID::UI_Alert); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc index dcdda55b1c..d96a9d7643 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_notification_commands_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/mock_message_helper.h" @@ -85,7 +85,7 @@ MATCHER(CheckNotificationMessage, "") { TYPED_TEST_CASE(MobileNotificationCommandsTest, NotificationCommandsList); TYPED_TEST(MobileNotificationCommandsTest, Run_SendMessageToMobile_SUCCESS) { - ::utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToMobile(CheckNotificationMessage(), _)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc index cf1f7c6711..bbd39874e0 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/simple_response_commands_test.cc @@ -35,7 +35,7 @@ #include "gtest/gtest.h" #include "utils/helpers.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" #include "mobile/delete_command_response.h" @@ -125,7 +125,7 @@ typedef Types<commands::ListFilesResponse, TYPED_TEST_CASE(MobileResponseCommandsTest, ResponseCommandsList); TYPED_TEST(MobileResponseCommandsTest, Run_SendResponseToMobile_SUCCESS) { - ::utils::SharedPtr<typename TestFixture::CommandType> command = + std::shared_ptr<typename TestFixture::CommandType> command = this->template CreateCommand<typename TestFixture::CommandType>(); EXPECT_CALL(this->mock_rpc_service_, SendMessageToMobile(NotNull(), _)); command->Run(); @@ -154,7 +154,7 @@ MATCHER_P2(CheckMessageParams, success, result, "") { TEST_F(GenericResponseFromHMICommandsTest, Run_SUCCESS) { MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map)); - SharedPtr<commands::GenericResponse> command( + std::shared_ptr<commands::GenericResponse> command( CreateCommand<commands::GenericResponse>(command_msg)); EXPECT_CALL( @@ -175,7 +175,7 @@ TEST_F(ScrollableMessageResponseTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); - SharedPtr<commands::ScrollableMessageResponse> command( + std::shared_ptr<commands::ScrollableMessageResponse> command( CreateCommand<commands::ScrollableMessageResponse>(message)); EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app)); EXPECT_CALL(*app, UnsubscribeFromSoftButtons(_)); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc index a039581284..9e7d826f2a 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/slider_test.cc @@ -57,12 +57,12 @@ using am::commands::CommandImpl; using am::commands::MessageSharedPtr; using am::MockMessageHelper; using policy_test::MockPolicyHandlerInterface; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -typedef SharedPtr<SliderRequest> CommandPtr; +typedef std::shared_ptr<SliderRequest> CommandPtr; namespace { const int32_t kCommandId = 1; @@ -140,7 +140,7 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) { MessageSharedPtr msg_ui = CreateFullParamsUISO(); (*msg_ui)[am::strings::params][am::strings::connection_key] = kConnectionKey; - utils::SharedPtr<SliderRequest> command = + std::shared_ptr<SliderRequest> command = CreateCommand<SliderRequest>(msg_ui); MockAppPtr mock_app = CreateMockApp(); diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc index ab086de0e6..dfb8452003 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/speak_request_test.cc @@ -34,14 +34,14 @@ #include <string> #include "gtest/gtest.h" #include "mobile/speak_request.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" #include "interfaces/HMI_API.h" #include "interfaces/MOBILE_API.h" -#include "utils/shared_ptr.h" + #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/application.h" @@ -68,13 +68,13 @@ using am::commands::MessageSharedPtr; using am::ApplicationSharedPtr; using am::MockMessageHelper; using ::testing::_; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::ReturnRef; using sdl_rpc_plugin::commands::SpeakRequest; using ::test::components::application_manager_test::MockApplication; -typedef SharedPtr<SpeakRequest> CommandPtr; +typedef std::shared_ptr<SpeakRequest> CommandPtr; namespace { const uint32_t kAppId = 10u; @@ -92,7 +92,7 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { const mobile_apis::Result::eType mobile_response, const am::HmiInterfaces::InterfaceState state, const bool success) { - utils::SharedPtr<SpeakRequest> command = + std::shared_ptr<SpeakRequest> command = CreateCommand<SpeakRequest>(request_); (*response_)[strings::params][hmi_response::code] = hmi_response; @@ -129,7 +129,7 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { }; TEST_F(SpeakRequestTest, OnEvent_SUCCESS_Expect_true) { - utils::SharedPtr<SpeakRequest> command = + std::shared_ptr<SpeakRequest> command = CreateCommand<SpeakRequest>(request_); (*response_)[strings::params][hmi_response::code] = diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc index 17c4db36bc..bbc18504a6 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -61,7 +61,7 @@ namespace am = ::application_manager; using sdl_rpc_plugin::commands::SubscribeButtonRequest; using am::commands::MessageSharedPtr; -typedef SharedPtr<SubscribeButtonRequest> CommandPtr; +typedef std::shared_ptr<SubscribeButtonRequest> CommandPtr; class SubscribeButtonRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { @@ -78,7 +78,7 @@ TEST_F(SubscribeButtonRequestTest, Run_AppNotRegistered_UNSUCCESS) { CommandPtr command(CreateCommand<SubscribeButtonRequest>()); ON_CALL(app_mngr_, application(_)) - .WillByDefault(Return(SharedPtr<am::Application>())); + .WillByDefault(Return(std::shared_ptr<am::Application>())); MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command))); EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc index e944c3eb39..d08c13b3f3 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_way_points_request_test.cc @@ -31,7 +31,7 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -61,7 +61,7 @@ namespace am = ::application_manager; using sdl_rpc_plugin::commands::SubscribeWayPointsRequest; using am::commands::MessageSharedPtr; -typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr; +typedef std::shared_ptr<SubscribeWayPointsRequest> CommandPtr; class SubscribeWayPointsRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc index 7214e0eea4..9e6bc8f505 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc @@ -58,7 +58,7 @@ using am::MockHmiInterfaces; using am::event_engine::Event; using am::MessageType; using policy_test::MockPolicyHandlerInterface; -using ::utils::SharedPtr; + using ::testing::_; using ::testing::DoAll; using ::testing::Return; @@ -126,7 +126,7 @@ TEST_F(SystemRequestTest, Run_HTTP_FileName_no_binary_data_REJECTED) { ExpectManageMobileCommandWithResultCode(mobile_apis::Result::REJECTED); - SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); + std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); command->Run(); } @@ -163,7 +163,7 @@ TEST_F(SystemRequestTest, EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&result), Return(true))); - SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); + std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); ASSERT_TRUE(command->Init()); command->Run(); @@ -203,7 +203,7 @@ TEST_F( ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); - SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); + std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); ASSERT_TRUE(command->Init()); command->Run(); } @@ -224,7 +224,7 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) { ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_)).Times(0); - SharedPtr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); + std::shared_ptr<SystemRequest> command(CreateCommand<SystemRequest>(msg)); ASSERT_TRUE(command->Init()); command->Run(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc index 1c4df3a463..771374348b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unregister_app_interface_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_message_helper.h" @@ -54,7 +54,7 @@ using ::testing::_; using sdl_rpc_plugin::commands::UnregisterAppInterfaceRequest; using am::commands::MessageSharedPtr; -typedef ::utils::SharedPtr<UnregisterAppInterfaceRequest> CommandPtr; +typedef std::shared_ptr<UnregisterAppInterfaceRequest> CommandPtr; class UnregisterAppInterfaceRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc index 439e94b94f..e363567c64 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_button_request_test.cc @@ -2,7 +2,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_message_helper.h" @@ -23,7 +23,7 @@ using ::testing::_; using sdl_rpc_plugin::commands::UnsubscribeButtonRequest; using am::commands::MessageSharedPtr; -typedef ::utils::SharedPtr<UnsubscribeButtonRequest> CommandPtr; +typedef std::shared_ptr<UnsubscribeButtonRequest> CommandPtr; namespace { const uint32_t kConnectionKey = 1u; diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc index a6e1eb0518..042604b672 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/unsubscribe_way_points_request_test.cc @@ -36,7 +36,7 @@ #include "gtest/gtest.h" #include "mobile/unsubscribe_way_points_request.h" #include "interfaces/MOBILE_API.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -78,7 +78,7 @@ class UnSubscribeWayPointsRequestTest } MessageSharedPtr command_msg_; - ::utils::SharedPtr<UnSubscribeWayPointsRequest> command_; + std::shared_ptr<UnSubscribeWayPointsRequest> command_; }; TEST_F(UnSubscribeWayPointsRequestTest, diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc index d1f59bb3a4..acb421af6b 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/update_turn_list_request_test.cc @@ -36,7 +36,7 @@ #include "gtest/gtest.h" #include "mobile/update_turn_list_request.h" #include "interfaces/MOBILE_API.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -88,7 +88,7 @@ class UpdateTurnListRequestTest } MessageSharedPtr command_msg_; - ::utils::SharedPtr<UpdateTurnListRequest> command_; + std::shared_ptr<UpdateTurnListRequest> command_; }; TEST_F(UpdateTurnListRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) { @@ -214,7 +214,7 @@ TEST_F(UpdateTurnListRequestTest, Run_ValidTurnList_SUCCESS) { SubscribeApplicationToSoftButton(_, _, kFunctionId)); MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command_))); - ASSERT_TRUE(result_msg); + ASSERT_TRUE((bool)result_msg); EXPECT_EQ( hmi_apis::FunctionID::Navigation_UpdateTurnList, (*result_msg)[am::strings::params][am::strings::function_id].asInt()); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc index 3401849861..04bcc435ba 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/hmi/vi_is_ready_request.cc @@ -100,7 +100,7 @@ void VIIsReadyRequest::onTimeOut() { } void VIIsReadyRequest::SendMessageToHMI() { - utils::SharedPtr<smart_objects::SmartObject> get_type( + std::shared_ptr<smart_objects::SmartObject> get_type( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VehicleInfo_GetVehicleType, application_manager_)); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc index ed4755a818..a19fdbee97 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_app_extension.cc @@ -118,7 +118,7 @@ VehicleInfoAppExtension& VehicleInfoAppExtension::ExtractVIExtension( DCHECK(ext_ptr); DCHECK(dynamic_cast<VehicleInfoAppExtension*>(ext_ptr.get())); auto vi_app_extension = - application_manager::AppExtensionPtr::static_pointer_cast< + std::static_pointer_cast< VehicleInfoAppExtension>(ext_ptr); DCHECK(vi_app_extension); return *vi_app_extension; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc index 7b94d22312..b16993b002 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc @@ -74,7 +74,7 @@ void VehicleInfoPlugin::OnApplicationEvent( plugins::ApplicationEvent event, app_mngr::ApplicationSharedPtr application) { if (plugins::ApplicationEvent::kApplicationRegistered == event) { - application->AddExtension(new VehicleInfoAppExtension(*this, *application)); + application->AddExtension(std::make_shared<VehicleInfoAppExtension>(*this, *application)); } } diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc index ddfc8e8a55..0508f0cdd6 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_get_vehicle_data_response_test.cc @@ -35,7 +35,7 @@ #include <vector> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -65,7 +65,7 @@ using vehicle_info_plugin::commands::VIGetVehicleDataResponse; using am::event_engine::Event; using test::components::event_engine_test::MockEventDispatcher; -typedef SharedPtr<VIGetVehicleDataResponse> VIGetVehicleDataResponsePtr; +typedef std::shared_ptr<VIGetVehicleDataResponse> VIGetVehicleDataResponsePtr; namespace { const uint32_t kConnectionKey = 2u; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc index d0093f45cf..d4477d5d5f 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/hmi/vi_is_ready_request_test.cc @@ -33,7 +33,7 @@ #include "hmi/vi_is_ready_request.h" #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/command_request_test.h" @@ -59,7 +59,7 @@ using am::commands::MessageSharedPtr; using vehicle_info_plugin::commands::VIIsReadyRequest; using am::event_engine::Event; -typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr; +typedef std::shared_ptr<VIIsReadyRequest> VIIsReadyRequestPtr; class VIIsReadyRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc index 3f684cae3f..9cdf60b1ea 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/diagnostic_message_request_test.cc @@ -35,7 +35,7 @@ #include <vector> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -63,7 +63,7 @@ using vehicle_info_plugin::commands::DiagnosticMessageRequest; using am::event_engine::Event; namespace mobile_result = mobile_apis::Result; -typedef SharedPtr<DiagnosticMessageRequest> DiagnosticMessageRequestPtr; +typedef std::shared_ptr<DiagnosticMessageRequest> DiagnosticMessageRequestPtr; namespace { const uint32_t kConnectionKey = 2u; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc index 9719d3ceed..4473a36c63 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_dtcs_request_test.cc @@ -35,7 +35,7 @@ #include <vector> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -64,7 +64,7 @@ using am::MockMessageHelper; using testing::Mock; namespace mobile_result = mobile_apis::Result; -typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr; +typedef std::shared_ptr<GetDTCsRequest> GetDTCsRequestPtr; class GetDTCsRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> { diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc index 4ad8a84189..a88d362968 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_request_test.cc @@ -35,7 +35,7 @@ #include <vector> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -63,7 +63,7 @@ using vehicle_info_plugin::commands::GetVehicleDataRequest; using am::event_engine::Event; namespace mobile_result = mobile_apis::Result; -typedef SharedPtr<GetVehicleDataRequest> GetVehicleDataRequestPtr; +typedef std::shared_ptr<GetVehicleDataRequest> GetVehicleDataRequestPtr; namespace { const uint32_t kConnectionKey = 2u; @@ -160,7 +160,7 @@ TEST_F(GetVehicleDataRequestTest, (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; - SharedPtr<UnwrappedGetVehicleDataRequest> command( + std::shared_ptr<UnwrappedGetVehicleDataRequest> command( CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg)); const am::VehicleData kEmptyVehicleData; @@ -212,7 +212,7 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_UnknownEvent_UNSUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; - SharedPtr<UnwrappedGetVehicleDataRequest> command( + std::shared_ptr<UnwrappedGetVehicleDataRequest> command( CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg)); Event event(hmi_apis::FunctionID::INVALID_ENUM); @@ -232,7 +232,7 @@ TEST_F(GetVehicleDataRequestTest, OnEvent_DataNotAvailable_SUCCESS) { (*command_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; - SharedPtr<UnwrappedGetVehicleDataRequest> command( + std::shared_ptr<UnwrappedGetVehicleDataRequest> command( CreateCommand<UnwrappedGetVehicleDataRequest>(command_msg)); MessageSharedPtr event_msg(CreateMessage(smart_objects::SmartType_Map)); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc index 3cc5af575e..1e8a289637 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc @@ -36,7 +36,7 @@ #include "gtest/gtest.h" #include "mobile/on_vehicle_data_notification.h" -#include "utils/shared_ptr.h" + #include "utils/custom_string.h" #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -61,7 +61,7 @@ using ::testing::ReturnRef; using am::commands::MessageSharedPtr; using vehicle_info_plugin::commands::OnVehicleDataNotification; -typedef ::utils::SharedPtr<OnVehicleDataNotification> NotificationPtr; +typedef std::shared_ptr<OnVehicleDataNotification> NotificationPtr; namespace { const uint32_t kAppId = 1u; diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc index 7cdeb2541c..c468a82bad 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/read_did_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" @@ -62,14 +62,14 @@ namespace am = ::application_manager; using vehicle_info_plugin::commands::ReadDIDRequest; using am::commands::MessageSharedPtr; using am::event_engine::Event; -using ::utils::SharedPtr; + class ReadDIDRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {}; TEST_F(ReadDIDRequestTest, OnEvent_WrongEventId_UNSUCCESS) { Event event(Event::EventID::INVALID_ENUM); - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0); command->on_event(event); } @@ -77,7 +77,7 @@ TEST_F(ReadDIDRequestTest, OnEvent_WrongEventId_UNSUCCESS) { TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) { Event event(Event::EventID::VehicleInfo_ReadDID); - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); const hmi_apis::Common_Result::eType hmi_response_code = hmi_apis::Common_Result::SUCCESS; @@ -99,10 +99,10 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) { } TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) { - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); ON_CALL(app_mngr_, application(_)) - .WillByDefault(Return(SharedPtr<am::Application>())); + .WillByDefault(Return(std::shared_ptr<am::Application>())); MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command))); EXPECT_EQ(mobile_apis::Result::APPLICATION_NOT_REGISTERED, @@ -112,7 +112,7 @@ TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) { } TEST_F(ReadDIDRequestTest, Run_CommandLimitsExceeded_UNSUCCESS) { - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); MockAppPtr app(CreateMockApp()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); @@ -128,7 +128,7 @@ TEST_F(ReadDIDRequestTest, Run_CommandLimitsExceeded_UNSUCCESS) { TEST_F(ReadDIDRequestTest, Run_EmptyDidLocation_UNSUCCESS) { MockAppPtr app(CreateMockApp()); - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>()); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); @@ -145,7 +145,7 @@ TEST_F(ReadDIDRequestTest, Run_SUCCESS) { MockAppPtr app(CreateMockApp()); MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map)); (*msg)[am::strings::msg_params][am::strings::did_location]["SomeData"] = 0; - SharedPtr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>(msg)); + std::shared_ptr<ReadDIDRequest> command(CreateCommand<ReadDIDRequest>(msg)); ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app)); diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc index 369a37e388..323334de2d 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_request_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/command_request_test.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_message_helper.h" @@ -56,7 +56,7 @@ using ::testing::_; using vehicle_info_plugin::commands::UnsubscribeVehicleDataRequest; using am::commands::MessageSharedPtr; -typedef ::utils::SharedPtr<UnsubscribeVehicleDataRequest> CommandPtr; +typedef std::shared_ptr<UnsubscribeVehicleDataRequest> CommandPtr; namespace { const uint32_t kConnectionKey = 1u; @@ -71,7 +71,7 @@ class UnsubscribeVehicleRequestTest UnsubscribeVehicleRequestTest() : mock_app_(CreateMockApp()) , vi_app_extension_ptr_( - utils::MakeShared<vehicle_info_plugin::VehicleInfoAppExtension>( + std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>( vi_plugin_, *mock_app_)) , app_set_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {} diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc index bed9cffeb2..a0d4699de8 100644 --- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc +++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/unsubscribe_vehicle_response_test.cc @@ -34,7 +34,7 @@ #include <stdint.h> #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "application_manager/commands/commands_test.h" #include "application_manager/mock_application_manager.h" @@ -66,10 +66,10 @@ MATCHER_P(ResultCodeIs, result_code, "") { TEST_F(UnsubscribeVehicleResponseTest, Run_SendFalseResponseToMobile_SendInvalidEnum) { MessageSharedPtr command_msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); (*command_msg)[am::strings::msg_params][am::strings::success] = false; - ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command = + std::shared_ptr<UnsubscribeVehicleDataResponse> command = CreateCommand<UnsubscribeVehicleDataResponse>(command_msg); EXPECT_CALL( @@ -81,9 +81,9 @@ TEST_F(UnsubscribeVehicleResponseTest, TEST_F(UnsubscribeVehicleResponseTest, Run_SendSuccessfulResponseToMobile_SUCCESS) { MessageSharedPtr command_msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); (*command_msg)[am::strings::msg_params][am::strings::success] = true; - ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command = + std::shared_ptr<UnsubscribeVehicleDataResponse> command = CreateCommand<UnsubscribeVehicleDataResponse>(command_msg); EXPECT_CALL( @@ -95,13 +95,13 @@ TEST_F(UnsubscribeVehicleResponseTest, TEST_F(UnsubscribeVehicleResponseTest, Run_SendResponseToMobile_SendCodeToMobile) { MessageSharedPtr command_msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); (*command_msg)[am::strings::msg_params][am::strings::success] = true; mobile_apis::Result::eType result_type = mobile_apis::Result::WARNINGS; (*command_msg)[am::strings::msg_params][am::strings::result_code] = result_type; - ::utils::SharedPtr<UnsubscribeVehicleDataResponse> command = + std::shared_ptr<UnsubscribeVehicleDataResponse> command = CreateCommand<UnsubscribeVehicleDataResponse>(command_msg); command->Run(); diff --git a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc index 481635d8e6..25cb5a7e1e 100644 --- a/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc +++ b/src/components/application_manager/src/app_launch/app_launch_ctrl_impl.cc @@ -38,7 +38,7 @@ #include "connection_handler/connection_handler.h" #include "application_manager/application.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" + namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") @@ -60,7 +60,7 @@ void AppLaunchCtrlImpl::OnAppRegistered( const application_manager::Application& app) { LOG4CXX_AUTO_TRACE(logger_); // TODO (AKutsan) : get device mac - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( app.policy_app_id(), app.bundle_id(), app.mac_address()); apps_launcher_.OnLaunched(app_data); app_launch_data_.AddApplicationData(*app_data); diff --git a/src/components/application_manager/src/app_launch/app_launch_data_db.cc b/src/components/application_manager/src/app_launch/app_launch_data_db.cc index 64f9102d90..9a7ae0dee8 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_db.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_db.cc @@ -37,7 +37,7 @@ #include "application_manager/app_launch/app_launch_sql_queries.h" #include "application_manager/smart_object_keys.h" #include "application_manager/message_helper.h" -#include "utils/make_shared.h" + namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") @@ -276,7 +276,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataDB::GetAppDataByDevMac( const std::string device_mac = query.GetString(device_mac_index); const std::string mobile_app_id = query.GetString(application_id_index); const std::string bundle_id = query.GetString(bundle_id_index); - dev_apps.push_back(utils::MakeShared<ApplicationData>( + dev_apps.push_back(std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac)); } while (query.Next()); LOG4CXX_DEBUG(logger_, "All application data has been successfully loaded"); diff --git a/src/components/application_manager/src/app_launch/app_launch_data_json.cc b/src/components/application_manager/src/app_launch/app_launch_data_json.cc index 7599dcccb3..f59053d97b 100644 --- a/src/components/application_manager/src/app_launch/app_launch_data_json.cc +++ b/src/components/application_manager/src/app_launch/app_launch_data_json.cc @@ -33,7 +33,7 @@ #include "application_manager/app_launch/app_launch_data_json.h" #include "application_manager/smart_object_keys.h" #include "smart_objects/smart_object.h" -#include "utils/make_shared.h" + #include "utils/date_time.h" #include "json/json.h" @@ -185,7 +185,7 @@ std::vector<ApplicationDataPtr> AppLaunchDataJson::GetAppDataByDevMac( if (deviceMac == dev_mac) { dev_apps.push_back( - utils::MakeShared<ApplicationData>(appID, bundleID, deviceMac)); + std::make_shared<ApplicationData>(appID, bundleID, deviceMac)); } } } diff --git a/src/components/application_manager/src/app_launch/apps_launcher.cc b/src/components/application_manager/src/app_launch/apps_launcher.cc index bf3ce1e0a9..f3851482c1 100644 --- a/src/components/application_manager/src/app_launch/apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/apps_launcher.cc @@ -1,6 +1,6 @@ #include <algorithm> #include "application_manager/app_launch/apps_launcher.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" #include <iostream> @@ -15,7 +15,7 @@ struct LauncherGenerator { , app_launch_max_retry_attempt_(app_launch_max_retry_attempt) , app_launch_retry_wait_time_(app_launch_retry_wait_time) {} AppsLauncher::LauncherPtr operator()() { - return utils::MakeShared<AppsLauncher::Launcher>( + return std::make_shared<AppsLauncher::Launcher>( apps_laucnher_, connection_handler_, app_launch_max_retry_attempt_, diff --git a/src/components/application_manager/src/app_launch/device_apps_launcher.cc b/src/components/application_manager/src/app_launch/device_apps_launcher.cc index 9c67c70e2c..3532cb819a 100644 --- a/src/components/application_manager/src/app_launch/device_apps_launcher.cc +++ b/src/components/application_manager/src/app_launch/device_apps_launcher.cc @@ -6,8 +6,8 @@ #include "application_manager/app_launch/app_launch_data.h" #include "application_manager/app_launch/apps_launcher.h" #include "application_manager/resumption/resume_ctrl.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/timer.h" #include "utils/timer_task_impl.h" #include <iostream> @@ -16,7 +16,7 @@ namespace app_launch { CREATE_LOGGERPTR_GLOBAL(logger_, "AppLaunch") typedef std::pair<std::string, std::vector<ApplicationDataPtr> > AppsOnDevice; -typedef utils::SharedPtr<AppsOnDevice> AppsOnDevicePtr; +typedef std::shared_ptr<AppsOnDevice> AppsOnDevicePtr; class Launcher { public: @@ -95,7 +95,7 @@ class Launcher { AppsOnDevicePtr apps_on_device_; }; -typedef utils::SharedPtr<Launcher> LauncherPtr; +typedef std::shared_ptr<Launcher> LauncherPtr; typedef std::vector<LauncherPtr> Launchers; struct LauncherGenerator { @@ -107,7 +107,7 @@ struct LauncherGenerator { , apps_launcher_(apps_launcher) {} LauncherPtr operator()() const { - return utils::MakeShared<Launcher>( + return std::make_shared<Launcher>( resume_ctrl_, interface_, apps_launcher_); } @@ -130,7 +130,7 @@ DeviceAppsLauncherImpl::DeviceAppsLauncherImpl(DeviceAppsLauncher& interface, } bool DeviceAppsLauncherImpl::LauncherFinder::operator()( - const utils::SharedPtr<Launcher>& launcher) const { + const std::shared_ptr<Launcher>& launcher) const { return device_mac_ == launcher->apps_on_device_->first; } @@ -142,7 +142,7 @@ bool DeviceAppsLauncherImpl::LaunchAppsOnDevice( "On Device " << device_mac << " will be launched " << applications_to_launch.size() << " apps"); AppsOnDevicePtr apps_on_device = - utils::MakeShared<AppsOnDevice>(device_mac, applications_to_launch); + std::make_shared<AppsOnDevice>(device_mac, applications_to_launch); sync_primitives::AutoLock lock(launchers_lock_); DCHECK_OR_RETURN(!free_launchers_.empty(), false) const Launchers::iterator it = free_launchers_.begin(); diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc index 717fbeba1b..aca4b9ba05 100644 --- a/src/components/application_manager/src/application_impl.cc +++ b/src/components/application_manager/src/application_impl.cc @@ -41,8 +41,8 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/gen_hash.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/timer_task_impl.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/resumption/resume_ctrl.h" @@ -83,8 +83,8 @@ void SwitchApplicationParameters(ApplicationSharedPtr app, const size_t device_id, const std::string& mac_address) { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<ApplicationImpl> application = - ApplicationSharedPtr::dynamic_pointer_cast<ApplicationImpl>(app); + std::shared_ptr<ApplicationImpl> application = + std::dynamic_pointer_cast<ApplicationImpl>(app); DCHECK_OR_RETURN_VOID(application); application->app_id_ = app_id; application->device_id_ = device_id; @@ -97,7 +97,7 @@ ApplicationImpl::ApplicationImpl( const std::string& mac_address, const connection_handler::DeviceHandle device_id, const custom_str::CustomString& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager) : grammar_id_(0) , hmi_app_id_(0) diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 571359007c..41dcdf3885 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -65,7 +65,7 @@ #include "utils/threads/thread.h" #include "utils/file_system.h" #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" #include "smart_objects/enum_schema_item.h" #include "interfaces/HMI_API_schema.h" @@ -186,7 +186,7 @@ ApplicationManagerImpl::ApplicationManagerImpl( {TYPE_ICONS, "Icons"}}; sync_primitives::AutoLock lock(timer_pool_lock_); - TimerSPtr clearing_timer(utils::MakeShared<timer::Timer>( + TimerSPtr clearing_timer(std::make_shared<timer::Timer>( "ClearTimerPoolTimer", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::ClearTimerPool))); @@ -411,7 +411,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( bool mobile_projection_state = app->mobile_projection_enabled(); ApplicationSharedPtr active_app = active_application(); // Check app in FULL level - if (active_app.valid()) { + if (active_app.use_count() != 0) { // If checking app hmi level FULL, we return false // because we couldn't have two applications with same HMIType in FULL and // LIMITED HMI level @@ -438,28 +438,28 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( // Check LIMITED apps if (voice_state) { - if (get_limited_voice_application().valid() && + if ((get_limited_voice_application().use_count() != 0) && (get_limited_voice_application()->app_id() != app->app_id())) { return true; } } if (media_state) { - if (get_limited_media_application().valid() && + if ((get_limited_media_application().use_count() != 0) && (get_limited_media_application()->app_id() != app->app_id())) { return true; } } if (navi_state) { - if (get_limited_navi_application().valid() && + if ((get_limited_navi_application().use_count() != 0) && (get_limited_navi_application()->app_id() != app->app_id())) { return true; } } if (mobile_projection_state) { - if (get_limited_mobile_projection_application().valid() && + if ((get_limited_mobile_projection_application().use_count() != 0) && (get_limited_mobile_projection_application()->app_id() != app->app_id())) { return true; @@ -470,7 +470,7 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited( } ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( - const utils::SharedPtr<smart_objects::SmartObject>& + const std::shared_ptr<smart_objects::SmartObject>& request_for_registration) { LOG4CXX_AUTO_TRACE(logger_); @@ -488,7 +488,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( if (connection_handler().get_session_observer().GetDataOnSessionKey( connection_key, &app_id, &sessions_list, &device_id) == -1) { LOG4CXX_ERROR(logger_, "Failed to create application: no connection info."); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, @@ -520,7 +520,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( if (!is_all_apps_allowed_) { LOG4CXX_WARN(logger_, "RegisterApplication: access to app's disabled by user"); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, @@ -539,7 +539,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( GetPolicyHandler().GetStatisticManager(), *this)); if (!application) { - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID, @@ -550,7 +550,7 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication( } HmiStatePtr initial_state = - CreateRegularState(utils::SharedPtr<Application>(application), + CreateRegularState(std::shared_ptr<Application>(application), mobile_apis::HMILevel::INVALID_ENUM, mobile_apis::AudioStreamingState::INVALID_ENUM, mobile_apis::VideoStreamingState::INVALID_ENUM, @@ -705,7 +705,7 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed( const bool is_audio_app = app->IsAudioApplication(); const bool does_audio_app_with_same_type_exist = IsAppTypeExistsInFullOrLimited(app); - const bool is_active_app_exist = active_application().valid(); + const bool is_active_app_exist = (active_application().use_count() != 0); mobile_api::HMILevel::eType result = mobile_api::HMILevel::HMI_FULL; if (is_audio_app && does_audio_app_with_same_type_exist) { @@ -747,42 +747,42 @@ void ApplicationManagerImpl::OnHMIStartedCooperation() { hmi_cooperating_ = true; MessageHelper::SendGetSystemInfoRequest(*this); - utils::SharedPtr<smart_objects::SmartObject> is_vr_ready( + std::shared_ptr<smart_objects::SmartObject> is_vr_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_IsReady, *this)); rpc_service_->ManageHMICommand(is_vr_ready); - utils::SharedPtr<smart_objects::SmartObject> is_tts_ready( + std::shared_ptr<smart_objects::SmartObject> is_tts_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::TTS_IsReady, *this)); rpc_service_->ManageHMICommand(is_tts_ready); - utils::SharedPtr<smart_objects::SmartObject> is_ui_ready( + std::shared_ptr<smart_objects::SmartObject> is_ui_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::UI_IsReady, *this)); rpc_service_->ManageHMICommand(is_ui_ready); - utils::SharedPtr<smart_objects::SmartObject> is_navi_ready( + std::shared_ptr<smart_objects::SmartObject> is_navi_ready( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::Navigation_IsReady, *this)); rpc_service_->ManageHMICommand(is_navi_ready); - utils::SharedPtr<smart_objects::SmartObject> is_ivi_ready( + std::shared_ptr<smart_objects::SmartObject> is_ivi_ready( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::VehicleInfo_IsReady, *this)); rpc_service_->ManageHMICommand(is_ivi_ready); - utils::SharedPtr<smart_objects::SmartObject> is_rc_ready( + std::shared_ptr<smart_objects::SmartObject> is_rc_ready( MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::RC_IsReady, *this)); rpc_service_->ManageHMICommand(is_rc_ready); - utils::SharedPtr<smart_objects::SmartObject> button_capabilities( + std::shared_ptr<smart_objects::SmartObject> button_capabilities( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::Buttons_GetCapabilities, *this)); rpc_service_->ManageHMICommand(button_capabilities); - utils::SharedPtr<smart_objects::SmartObject> mixing_audio_supported_request( + std::shared_ptr<smart_objects::SmartObject> mixing_audio_supported_request( MessageHelper::CreateModuleInfoSO( hmi_apis::FunctionID::BasicCommunication_MixingAudioSupported, *this)); @@ -862,7 +862,7 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) { } HmiStatePtr ApplicationManagerImpl::CreateRegularState( - utils::SharedPtr<Application> app, + std::shared_ptr<Application> app, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::VideoStreamingState::eType video_state, @@ -1021,7 +1021,7 @@ void ApplicationManagerImpl::OnDeviceListUpdated( return; } - smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr update_list = std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& so_to_send = *update_list; so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList; @@ -1108,7 +1108,7 @@ void ApplicationManagerImpl::OnDeviceSwitchingStart( return; } - auto update_list = utils::MakeShared<smart_objects::SmartObject>(); + auto update_list = std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& so_to_send = *update_list; so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList; @@ -1295,7 +1295,7 @@ void ApplicationManagerImpl::ReplaceMobileByHMIAppId( if (message.keyExists(strings::app_id)) { ApplicationSharedPtr application_ptr = application(message[strings::app_id].asUInt()); - if (application_ptr.valid()) { + if (application_ptr.use_count() != 0) { LOG4CXX_DEBUG(logger_, "ReplaceMobileByHMIAppId from " << message[strings::app_id].asInt() << " to " @@ -1332,7 +1332,7 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId( ApplicationSharedPtr application = application_by_hmi_app(message[strings::app_id].asUInt()); - if (application.valid()) { + if (application.use_count() != 0) { LOG4CXX_DEBUG(logger_, "ReplaceHMIByMobileAppId from " << message[strings::app_id].asInt() << " to " @@ -2421,7 +2421,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { // must be sent to PASA HMI on shutdown synchronously smart_objects::SmartObjectSPtr msg = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); (*msg)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_OnSDLClose; @@ -2438,7 +2438,7 @@ void ApplicationManagerImpl::SendOnSDLClose() { } // SmartObject |message| has no way to declare priority for now - utils::SharedPtr<Message> message_to_send( + std::shared_ptr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); hmi_so_factory().attachSchema(*msg, false); @@ -2880,7 +2880,7 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) { navi_app_to_stop_.push_back(app_id); - TimerSPtr close_timer(utils::MakeShared<timer::Timer>( + TimerSPtr close_timer(std::make_shared<timer::Timer>( "CloseNaviAppTimer", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::CloseNaviApp))); @@ -2955,7 +2955,7 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, if (from == HMI_FULL || from == HMI_LIMITED) { LOG4CXX_TRACE(logger_, "HMILevel from FULL or LIMITED"); navi_app_to_end_stream_.push_back(app_id); - TimerSPtr end_stream_timer(utils::MakeShared<timer::Timer>( + TimerSPtr end_stream_timer(std::make_shared<timer::Timer>( "AppShouldFinishStreaming", new TimerTaskImpl<ApplicationManagerImpl>( this, &ApplicationManagerImpl::EndNaviStreaming))); @@ -2973,11 +2973,11 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id, } void ApplicationManagerImpl::SendHMIStatusNotification( - const utils::SharedPtr<Application> app) { + const std::shared_ptr<Application> app) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(app); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = @@ -3517,7 +3517,7 @@ void ApplicationManagerImpl::SendDriverDistractionState( return; } smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*on_driver_distraction)[strings::params][strings::message_type] = static_cast<int32_t>(application_manager::MessageType::kNotification); @@ -3640,7 +3640,7 @@ bool ApplicationManagerImpl::IsAppSubscribedForWayPoints( LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); - if (subscribed_way_points_apps_list_.find(app) == + if (subscribed_way_points_apps_list_.find(app->app_id()) == subscribed_way_points_apps_list_.end()) { return false; } @@ -3651,7 +3651,7 @@ void ApplicationManagerImpl::SubscribeAppForWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.insert(app); + subscribed_way_points_apps_list_.insert(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); @@ -3661,7 +3661,7 @@ void ApplicationManagerImpl::UnsubscribeAppFromWayPoints( ApplicationSharedPtr app) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(subscribed_way_points_apps_lock_); - subscribed_way_points_apps_list_.erase(app); + subscribed_way_points_apps_list_.erase(app->app_id()); LOG4CXX_DEBUG(logger_, "There are applications subscribed: " << subscribed_way_points_apps_list_.size()); diff --git a/src/components/application_manager/src/command_holder_impl.cc b/src/components/application_manager/src/command_holder_impl.cc index 9799b170dc..ea74e78f4e 100644 --- a/src/components/application_manager/src/command_holder_impl.cc +++ b/src/components/application_manager/src/command_holder_impl.cc @@ -43,7 +43,7 @@ CommandHolderImpl::CommandHolderImpl(ApplicationManager& app_manager) void CommandHolderImpl::Suspend( ApplicationSharedPtr application, CommandType type, - utils::SharedPtr<smart_objects::SmartObject> command) { + std::shared_ptr<smart_objects::SmartObject> command) { LOG4CXX_AUTO_TRACE(logger_); DCHECK_OR_RETURN_VOID(application); LOG4CXX_DEBUG(logger_, diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc index dbe89b8881..db78ad15f0 100644 --- a/src/components/application_manager/src/commands/command_impl.cc +++ b/src/components/application_manager/src/commands/command_impl.cc @@ -40,7 +40,7 @@ namespace { struct AppExtensionPredicate { AppExtensionUID uid; bool operator()(const ApplicationSharedPtr app) { - return app ? app->QueryInterface(uid).valid() : false; + return app ? (app->QueryInterface(uid).use_count() != 0) : false; } }; } diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc index 491fc72de4..18b3d2a94e 100644 --- a/src/components/application_manager/src/commands/command_request_impl.cc +++ b/src/components/application_manager/src/commands/command_request_impl.cc @@ -34,7 +34,7 @@ #include <numeric> #include <string> #include "utils/macro.h" -#include "utils/make_shared.h" + #include "application_manager/commands/command_request_impl.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" @@ -145,7 +145,7 @@ struct DisallowedParamsInserter { VehicleData::const_iterator it = vehicle_data.find(param); if (vehicle_data.end() != it) { smart_objects::SmartObjectSPtr disallowed_param = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); (*disallowed_param)[strings::data_type] = (*it).second; (*disallowed_param)[strings::result_code] = code_; response_[strings::msg_params][param.c_str()] = *disallowed_param; @@ -273,7 +273,7 @@ void CommandRequestImpl::SendResponse( } smart_objects::SmartObjectSPtr result = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& response = *result; @@ -417,7 +417,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject* msg_params, bool use_events) { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); const uint32_t hmi_correlation_id = application_manager_.GetNextHMICorrelationID(); @@ -455,7 +455,7 @@ uint32_t CommandRequestImpl::SendHMIRequest( void CommandRequestImpl::CreateHMINotification( const hmi_apis::FunctionID::eType& function_id, const NsSmart::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; diff --git a/src/components/application_manager/src/commands/notification_from_hmi.cc b/src/components/application_manager/src/commands/notification_from_hmi.cc index 1fef383213..649b52fde9 100644 --- a/src/components/application_manager/src/commands/notification_from_hmi.cc +++ b/src/components/application_manager/src/commands/notification_from_hmi.cc @@ -76,7 +76,7 @@ void NotificationFromHMI::SendNotificationToMobile( void NotificationFromHMI::CreateHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; diff --git a/src/components/application_manager/src/commands/request_from_hmi.cc b/src/components/application_manager/src/commands/request_from_hmi.cc index f77495ac31..b993ab033e 100644 --- a/src/components/application_manager/src/commands/request_from_hmi.cc +++ b/src/components/application_manager/src/commands/request_from_hmi.cc @@ -33,7 +33,7 @@ #include "application_manager/commands/request_from_hmi.h" #include "application_manager/application_manager.h" #include "application_manager/rpc_service.h" -#include "utils/make_shared.h" + namespace application_manager { @@ -74,7 +74,7 @@ void RequestFromHMI::SendResponse( const hmi_apis::FunctionID::eType function_id, const hmi_apis::Common_Result::eType result_code) { smart_objects::SmartObjectSPtr message = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); FillCommonParametersOfSO(*message, correlation_id, function_id); (*message)[strings::params][strings::message_type] = MessageType::kResponse; @@ -91,7 +91,7 @@ void RequestFromHMI::SendErrorResponse( const hmi_apis::Common_Result::eType result_code, const std::string error_message) { smart_objects::SmartObjectSPtr message = - ::utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); FillCommonParametersOfSO(*message, correlation_id, function_id); (*message)[strings::params][strings::message_type] = diff --git a/src/components/application_manager/src/commands/response_from_hmi.cc b/src/components/application_manager/src/commands/response_from_hmi.cc index 123dbad828..bf732830f2 100644 --- a/src/components/application_manager/src/commands/response_from_hmi.cc +++ b/src/components/application_manager/src/commands/response_from_hmi.cc @@ -80,7 +80,7 @@ void ResponseFromHMI::SendResponseToMobile( void ResponseFromHMI::CreateHMIRequest( const hmi_apis::FunctionID::eType& function_id, const smart_objects::SmartObject& msg_params) const { - smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr result = std::make_shared<smart_objects::SmartObject>(); if (!result) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc index 0587327791..6fb88ddd3b 100644 --- a/src/components/application_manager/src/help_prompt_manager_impl.cc +++ b/src/components/application_manager/src/help_prompt_manager_impl.cc @@ -38,7 +38,7 @@ #include "application_manager/smart_object_keys.h" #include "smart_objects/smart_object.h" #include "utils/logger.h" -#include "utils/make_shared.h" + CREATE_LOGGERPTR_GLOBAL(logger_, "HelpPromptManagerImpl") @@ -86,7 +86,7 @@ bool HelpPromptManagerImpl::AddCommand( LOG4CXX_DEBUG(logger_, "Will be added " << count_new_commands << " commands"); smart_objects::SmartObjectSPtr vr_item = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Array); smart_objects::SmartArray& ar_vr_cmd = *(vr_item->asArray()); smart_objects::SmartArray& ar_cmd = *(commands.asArray()); @@ -207,7 +207,7 @@ void HelpPromptManagerImpl::SendTTSRequest() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "TTS request for appID:" << app_.app_id()); smart_objects::SmartObjectSPtr tts_global_properties = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (tts_global_properties) { smart_objects::SmartObject& ref = *tts_global_properties; @@ -241,7 +241,7 @@ void HelpPromptManagerImpl::SendUIRequest() { LOG4CXX_AUTO_TRACE(logger_); LOG4CXX_DEBUG(logger_, "UI request for appID:" << app_.app_id()); smart_objects::SmartObjectSPtr ui_global_properties = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (ui_global_properties) { smart_objects::SmartObject& ref = *ui_global_properties; diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc index ce8514010f..b1872dfaab 100644 --- a/src/components/application_manager/src/hmi_language_handler.cc +++ b/src/components/application_manager/src/hmi_language_handler.cc @@ -223,7 +223,7 @@ void HMILanguageHandler::SendOnLanguageChangeToMobile( const uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr notification =std::make_shared<smart_objects::SmartObject>(); DCHECK_OR_RETURN_VOID(notification); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc index e1bc2b5125..0033fe4fb6 100644 --- a/src/components/application_manager/src/hmi_state.cc +++ b/src/components/application_manager/src/hmi_state.cc @@ -42,7 +42,7 @@ namespace application_manager { CREATE_LOGGERPTR_GLOBAL(logger_, "HmiState") -HmiState::HmiState(utils::SharedPtr<Application> app, +HmiState::HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr, StateID state_id) : app_(app) @@ -55,7 +55,7 @@ HmiState::HmiState(utils::SharedPtr<Application> app, LOG4CXX_DEBUG(logger_, *this); } -HmiState::HmiState(utils::SharedPtr<Application> app, +HmiState::HmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : app_(app) , state_id_(STATE_ID_REGULAR) @@ -115,7 +115,7 @@ mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state() return AudioStreamingState::NOT_AUDIBLE; } -VRHmiState::VRHmiState(utils::SharedPtr<Application> app, +VRHmiState::VRHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_VR_SESSION) {} @@ -123,7 +123,7 @@ DEPRECATED VRHmiState::VRHmiState(uint32_t app_id, const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {} -TTSHmiState::TTSHmiState(utils::SharedPtr<Application> app, +TTSHmiState::TTSHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_TTS_SESSION) {} @@ -147,7 +147,7 @@ mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state() } VideoStreamingHmiState::VideoStreamingHmiState( - utils::SharedPtr<Application> app, const ApplicationManager& app_mngr) + std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_VIDEO_STREAMING) {} mobile_apis::VideoStreamingState::eType @@ -159,7 +159,7 @@ VideoStreamingHmiState::video_streaming_state() const { return mobile_apis::VideoStreamingState::NOT_STREAMABLE; } -NaviStreamingHmiState::NaviStreamingHmiState(utils::SharedPtr<Application> app, +NaviStreamingHmiState::NaviStreamingHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : VideoStreamingHmiState(app, app_mngr) { set_state_id(STATE_ID_NAVI_STREAMING); @@ -185,7 +185,7 @@ NaviStreamingHmiState::audio_streaming_state() const { return expected_state; } -PhoneCallHmiState::PhoneCallHmiState(utils::SharedPtr<Application> app, +PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_PHONE_CALL) {} @@ -210,7 +210,7 @@ mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const { return HMILevel::HMI_BACKGROUND; } -SafetyModeHmiState::SafetyModeHmiState(utils::SharedPtr<Application> app, +SafetyModeHmiState::SafetyModeHmiState(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_SAFETY_MODE) {} @@ -218,7 +218,7 @@ DEPRECATED SafetyModeHmiState::SafetyModeHmiState( uint32_t app_id, const ApplicationManager& app_mngr) : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {} -DeactivateHMI::DeactivateHMI(utils::SharedPtr<Application> app, +DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_DEACTIVATE_HMI) {} @@ -238,7 +238,7 @@ mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const { return HMILevel::HMI_BACKGROUND; } -AudioSource::AudioSource(utils::SharedPtr<Application> app, +AudioSource::AudioSource(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_AUDIO_SOURCE) {} @@ -256,7 +256,7 @@ mobile_apis::HMILevel::eType AudioSource::hmi_level() const { return mobile_apis::HMILevel::HMI_BACKGROUND; } -EmbeddedNavi::EmbeddedNavi(utils::SharedPtr<Application> app, +EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app, const ApplicationManager& app_mngr) : HmiState(app, app_mngr, STATE_ID_EMBEDDED_NAVI) {} diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc index 81491b7bf9..aa3f2449ee 100644 --- a/src/components/application_manager/src/message_helper/message_helper.cc +++ b/src/components/application_manager/src/message_helper/message_helper.cc @@ -61,7 +61,7 @@ #include "utils/file_system.h" #include "utils/macro.h" #include "utils/logger.h" -#include "utils/make_shared.h" + #include "formatters/formatter_json_rpc.h" #include "formatters/CFormatterJsonSDLRPCv2.h" @@ -258,7 +258,7 @@ MessageHelper::CreateHMINotification(hmi_apis::FunctionID::eType function_id) { using smart_objects::SmartType_Map; LOG4CXX_AUTO_TRACE(logger_); SmartObjectSPtr notification_ptr = - utils::MakeShared<SmartObject>(SmartType_Map); + std::make_shared<SmartObject>(SmartType_Map); SmartObject& notification = *notification_ptr; notification[strings::params][strings::message_type] = static_cast<int32_t>(kNotification); @@ -315,7 +315,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI( hmi_apis::messageType::eType message_type, const uint32_t correlation_id) { using namespace smart_objects; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); SmartObject& ref = *message; ref[strings::params][strings::message_type] = static_cast<int>(message_type); @@ -331,7 +331,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateHashUpdateNotification( const uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnHashChangeID; @@ -399,7 +399,7 @@ MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile( LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& message = *notification; message[strings::params][strings::function_id] = static_cast<int32_t>( @@ -698,7 +698,7 @@ void MessageHelper::SendHMIStatusNotification( const Application& application_impl, ApplicationManager& application_manager) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject; + smart_objects::SmartObjectSPtr notification = std::make_shared<smart_objects::SmartObject>(); if (!notification) { LOG4CXX_ERROR(logger_, "Failed to create smart object"); return; @@ -739,8 +739,8 @@ void MessageHelper::SendActivateAppToHMI( return; } - utils::SharedPtr<smart_objects::SmartObject> message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::shared_ptr<smart_objects::SmartObject> message = + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_ActivateApp; @@ -825,7 +825,7 @@ void MessageHelper::CreateGetVehicleDataRequest( ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr request = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*request)[strings::params][strings::message_type] = static_cast<int>(kRequest); @@ -853,7 +853,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse( uint32_t connection_key) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr response = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*response)[strings::params][strings::function_id] = static_cast<int>(function_id); @@ -877,7 +877,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO( ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr device_list_so = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*device_list_so)[strings::device_list] = @@ -911,7 +911,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO( uint32_t function_id, ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr module_info = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); smart_objects::SmartObject& object = *module_info; object[strings::params][strings::message_type] = static_cast<int>(kRequest); @@ -927,7 +927,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon( const std::string& path_to_icon, uint32_t app_id) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr set_icon = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!set_icon) { @@ -954,7 +954,7 @@ void MessageHelper::SendOnButtonSubscriptionNotification( LOG4CXX_AUTO_TRACE(logger_); SmartObjectSPtr notification_ptr = - utils::MakeShared<SmartObject>(SmartType_Map); + std::make_shared<SmartObject>(SmartType_Map); if (!notification_ptr) { LOG4CXX_ERROR(logger_, "Memory allocation failed."); return; @@ -988,7 +988,7 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp( using namespace mobile_apis; LOG4CXX_AUTO_TRACE(logger_); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application pointer "); return; } @@ -1044,7 +1044,7 @@ void MessageHelper::SendAppDataToHMI(ApplicationConstSharedPtr app, void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return; } @@ -1064,7 +1064,7 @@ MessageHelper::CreateGlobalPropertiesRequestsToHMI( LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectList requests; - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return requests; } @@ -1197,7 +1197,7 @@ void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app, smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp( ApplicationConstSharedPtr app) { smart_objects::SmartObjectSPtr result = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!result) { return NULL; @@ -1420,7 +1420,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration( void MessageHelper::SendUIChangeRegistrationRequestToHMI( ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Application is not valid"); return; } @@ -1595,7 +1595,7 @@ bool MessageHelper::CreateHMIApplicationStruct( void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app, ApplicationManager& app_mngr) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_ERROR(logger_, "Invalid application"); return; } @@ -1651,7 +1651,7 @@ void MessageHelper::SendOnAppUnregNotificationToHMI( bool is_unexpected_disconnect, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); smart_objects::SmartObject& message = *notification; @@ -1681,7 +1681,7 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI( const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID(); smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = hmi_apis::FunctionID::BasicCommunication_ActivateApp; @@ -1724,8 +1724,8 @@ void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id, return; } - utils::SharedPtr<smart_objects::SmartObject> message = - utils::MakeShared<smart_objects::SmartObject>( + std::shared_ptr<smart_objects::SmartObject> message = + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1744,7 +1744,7 @@ void MessageHelper::SendSDLActivateAppResponse( const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1793,7 +1793,7 @@ void MessageHelper::SendSDLActivateAppResponse( void MessageHelper::SendOnSDLConsentNeeded( const policy::DeviceParams& device_info, ApplicationManager& app_man) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*message)[strings::params][strings::function_id] = @@ -1833,7 +1833,7 @@ void MessageHelper::SendGetUserFriendlyMessageResponse( ApplicationManager& app_mngr) { LOG4CXX_AUTO_TRACE(logger_); smart_objects::SmartObjectSPtr message = - new smart_objects::SmartObject(smart_objects::SmartType_Map); + std::make_shared<smart_objects::SmartObject>(smart_objects::SmartType_Map); if (!message) { return; } @@ -1903,7 +1903,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( using namespace smart_objects; using namespace hmi_apis; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); DCHECK_OR_RETURN_VOID(message); SmartObject& params = (*message)[strings::params]; @@ -1945,7 +1945,7 @@ void MessageHelper::SendGetListOfPermissionsResponse( using namespace smart_objects; using namespace hmi_apis; - SmartObjectSPtr message = utils::MakeShared<SmartObject>(SmartType_Map); + SmartObjectSPtr message = std::make_shared<SmartObject>(SmartType_Map); DCHECK_OR_RETURN_VOID(message); SmartObject& params = (*message)[strings::params]; @@ -1986,7 +1986,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse( response_data[strings::msg_params][strings::success] = false; response_data[strings::params][strings::connection_key] = connection_key; - return utils::MakeShared<smart_objects::SmartObject>(response_data); + return std::make_shared<smart_objects::SmartObject>(response_data); } void MessageHelper::SendNaviSetVideoConfig( @@ -2136,7 +2136,7 @@ void MessageHelper::SendOnDataStreaming( } smart_objects::SmartObjectSPtr notification = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); (*notification)[strings::params][strings::function_id] = @@ -2226,7 +2226,7 @@ void MessageHelper::SendSystemRequestNotification( #endif DCHECK(app_mngr.GetRPCService().ManageMobileCommand( - utils::MakeShared<smart_objects::SmartObject>(content), + std::make_shared<smart_objects::SmartObject>(content), commands::Command::SOURCE_SDL)); } @@ -2394,7 +2394,7 @@ void MessageHelper::SendOnPermissionsChangeNotification( } app_mngr.GetRPCService().ManageMobileCommand( - utils::MakeShared<smart_objects::SmartObject>(content), + std::make_shared<smart_objects::SmartObject>(content), commands::Command::SOURCE_SDL); } @@ -2479,14 +2479,14 @@ void MessageHelper::SendOnAppPermissionsChangedNotification( } app_mngr.GetRPCService().ManageHMICommand( - utils::MakeShared<smart_objects::SmartObject>(message)); + std::make_shared<smart_objects::SmartObject>(message)); } void MessageHelper::SendGetStatusUpdateResponse(const std::string& status, const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!message) { return; @@ -2507,7 +2507,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, const uint32_t correlation_id, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); DCHECK(message); @@ -2525,7 +2525,7 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result, void MessageHelper::SendOnStatusUpdate(const std::string& status, ApplicationManager& app_mngr) { smart_objects::SmartObjectSPtr message = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Map); if (!message) { return; diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index 88c01c7af7..ce0bac9c0e 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -54,7 +54,7 @@ #include "interfaces/MOBILE_API.h" #include "utils/file_system.h" #include "utils/scope_guard.h" -#include "utils/make_shared.h" + #include "utils/helpers.h" #include "policy/policy_manager.h" @@ -224,7 +224,7 @@ struct LinksCollector { } void operator()(const ApplicationSharedPtr& app) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Skip current application."); @@ -258,7 +258,7 @@ struct LinkAppToDevice { } void operator()(const ApplicationSharedPtr& app) { - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Skip current application."); @@ -328,7 +328,7 @@ PolicyHandler::PolicyHandler(const PolicySettings& settings, , dl_handle_(0) , last_activated_app_id_(0) , app_to_device_link_lock_(true) - , statistic_manager_impl_(utils::MakeShared<StatisticManagerImpl>(this)) + , statistic_manager_impl_(std::make_shared<StatisticManagerImpl>(this)) , settings_(settings) , application_manager_(application_manager) {} @@ -355,14 +355,14 @@ bool PolicyHandler::LoadPolicyLibrary() { if (CreateManager()) { policy_manager_->set_listener(this); event_observer_ = - utils::SharedPtr<PolicyEventObserver>(new PolicyEventObserver( + std::shared_ptr<PolicyEventObserver>(new PolicyEventObserver( this, application_manager_.event_dispatcher())); } } else { LOG4CXX_ERROR(logger_, error); } - return policy_manager_.valid(); + return (policy_manager_.use_count() != 0); } bool PolicyHandler::CreateManager() { @@ -375,11 +375,11 @@ bool PolicyHandler::CreateManager() { char* error_string = dlerror(); if (NULL == error_string) { policy_manager_ = - utils::SharedPtr<PolicyManager>(create_manager(), delete_manager); + std::shared_ptr<PolicyManager>(create_manager(), delete_manager); } else { LOG4CXX_WARN(logger_, error_string); } - return policy_manager_.valid(); + return (policy_manager_.use_count() != 0); } const PolicySettings& PolicyHandler::get_settings() const { @@ -520,7 +520,7 @@ void PolicyHandler::SendOnAppPermissionsChanged( << policy_app_id); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id); return; } @@ -555,7 +555,7 @@ struct SmartObjectToInt { StatusNotifier PolicyHandler::AddApplication( const std::string& application_id, const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) { - POLICY_LIB_CHECK(utils::MakeShared<utils::CallNothing>()); + POLICY_LIB_CHECK(std::make_shared<utils::CallNothing>()); return policy_manager_->AddApplication(application_id, hmi_types); } @@ -591,7 +591,7 @@ void PolicyHandler::OnAppPermissionConsentInternal( if (connection_key) { ApplicationSharedPtr app = application_manager_.application(connection_key); - if (app.valid()) { + if (app.use_count() != 0) { out_permissions.policy_app_id = app->policy_app_id(); DeviceParams device_params = GetDeviceParams( app->device(), @@ -618,7 +618,7 @@ void PolicyHandler::OnAppPermissionConsentInternal( // If list of apps sent to HMI for user consents is not the same as // current, // permissions should be set only for coincident to registered apps - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Invalid pointer to application was passed." "Permissions setting skipped."); @@ -733,7 +733,7 @@ std::vector<FunctionalGroupPermission> PolicyHandler::CollectAppPermissions( ApplicationSharedPtr app = application_manager_.application(connection_key); std::vector<FunctionalGroupPermission> group_permissions; - if (NULL == app.get() || !app.valid()) { + if (NULL == app.get() || app.use_count() == 0) { LOG4CXX_WARN(logger_, "Connection key '" << connection_key @@ -883,7 +883,7 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Application with id '" << policy_app_id @@ -958,7 +958,7 @@ void PolicyHandler::OnPendingPermissionChange( POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "No app found for " << policy_app_id << " policy app id."); return; @@ -1269,7 +1269,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, LOG4CXX_AUTO_TRACE(logger_); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application(connection_key); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN(logger_, "Activated App failed: no app found."); return; } @@ -1363,7 +1363,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); @@ -1416,7 +1416,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, LOG4CXX_AUTO_TRACE(logger_); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); @@ -1627,7 +1627,7 @@ void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) { listeners_.remove(listener); } -utils::SharedPtr<usage_statistics::StatisticsManager> +std::shared_ptr<usage_statistics::StatisticsManager> PolicyHandler::GetStatisticManager() const { return statistic_manager_impl_; } @@ -1669,7 +1669,7 @@ custom_str::CustomString PolicyHandler::GetAppName( ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); - if (!app.valid()) { + if (app.use_count() == 0) { LOG4CXX_WARN( logger_, "Connection_key not found for application_id:" << policy_app_id); diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc index e052e347f0..1c103b13af 100644 --- a/src/components/application_manager/src/request_controller.cc +++ b/src/components/application_manager/src/request_controller.cc @@ -35,7 +35,7 @@ #include "application_manager/request_controller.h" #include "application_manager/commands/command_request_impl.h" #include "application_manager/commands/request_to_hmi.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace application_manager { @@ -176,7 +176,7 @@ RequestController::TResult RequestController::addHMIRequest( const RequestPtr request) { LOG4CXX_AUTO_TRACE(logger_); - if (!request.valid()) { + if (request.use_count() == 0) { LOG4CXX_ERROR(logger_, "HMI request pointer is invalid"); return RequestController::INVALID_DATA; } @@ -185,7 +185,7 @@ RequestController::TResult RequestController::addHMIRequest( const uint64_t timeout_in_mseconds = static_cast<uint64_t>(request->default_timeout()); RequestInfoPtr request_info_ptr = - utils::MakeShared<HMIRequestInfo>(request, timeout_in_mseconds); + std::make_shared<HMIRequestInfo>(request, timeout_in_mseconds); if (0 == timeout_in_mseconds) { LOG4CXX_DEBUG(logger_, @@ -287,7 +287,7 @@ void RequestController::terminateWaitingForExecutionAppRequests( std::list<RequestPtr>::iterator request_it = mobile_request_list_.begin(); while (mobile_request_list_.end() != request_it) { RequestPtr request = (*request_it); - if ((request.valid()) && (request->connection_key() == app_id)) { + if ((request.use_count() != 0) && (request->connection_key() == app_id)) { mobile_request_list_.erase(request_it++); } else { ++request_it; @@ -488,7 +488,7 @@ void RequestController::Worker::threadMain() { const uint32_t timeout_in_mseconds = request_ptr->default_timeout(); RequestInfoPtr request_info_ptr = - utils::MakeShared<MobileRequestInfo>(request_ptr, timeout_in_mseconds); + std::make_shared<MobileRequestInfo>(request_ptr, timeout_in_mseconds); if (!request_controller_->waiting_for_response_.Add(request_info_ptr)) { commands::CommandRequestImpl* cmd_request = diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc index 9a5828d939..04210a7572 100644 --- a/src/components/application_manager/src/request_info.cc +++ b/src/components/application_manager/src/request_info.cc @@ -151,7 +151,7 @@ RequestInfoPtr RequestInfoSet::Find(const uint32_t connection_key, RequestInfoPtr result; // Request info for searching in request info set by log_n time - utils::SharedPtr<FakeRequestInfo> request_info_for_search( + std::shared_ptr<FakeRequestInfo> request_info_for_search( new FakeRequestInfo(connection_key, correlation_id)); sync_primitives::AutoLock lock(this_lock_); diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc index be2bff5534..74054eab29 100644 --- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc +++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc @@ -48,7 +48,7 @@ #include "utils/helpers.h" #include "application_manager/resumption/resumption_data_db.h" #include "application_manager/resumption/resumption_data_json.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace resumption { @@ -79,7 +79,7 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager) , application_manager_(application_manager) {} #ifdef BUILD_TESTS void ResumeCtrlImpl::set_resumption_storage( - utils::SharedPtr<ResumptionData> mock_storage) { + std::shared_ptr<ResumptionData> mock_storage) { resumption_storage_ = mock_storage; } diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc index 42894a36a8..3152d1f749 100644 --- a/src/components/application_manager/src/rpc_handler_impl.cc +++ b/src/components/application_manager/src/rpc_handler_impl.cc @@ -54,7 +54,7 @@ RPCHandlerImpl::RPCHandlerImpl(ApplicationManager& app_manager) RPCHandlerImpl::~RPCHandlerImpl() {} void RPCHandlerImpl::ProcessMessageFromMobile( - const utils::SharedPtr<Message> message) { + const std::shared_ptr<Message> message) { LOG4CXX_AUTO_TRACE(logger_); #ifdef TELEMETRY_MONITOR AMTelemetryObserver::MessageMetricSharedPtr metric( @@ -62,7 +62,7 @@ void RPCHandlerImpl::ProcessMessageFromMobile( metric->begin = date_time::DateTime::getCurrentTime(); #endif // TELEMETRY_MONITOR smart_objects::SmartObjectSPtr so_from_mobile = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); DCHECK_OR_RETURN_VOID(so_from_mobile); if (!so_from_mobile) { @@ -91,9 +91,9 @@ void RPCHandlerImpl::ProcessMessageFromMobile( } void RPCHandlerImpl::ProcessMessageFromHMI( - const utils::SharedPtr<Message> message) { + const std::shared_ptr<Message> message) { LOG4CXX_AUTO_TRACE(logger_); - smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject); + smart_objects::SmartObjectSPtr smart_object = std::make_shared<smart_objects::SmartObject>(); if (!smart_object) { LOG4CXX_ERROR(logger_, "Null pointer"); @@ -154,7 +154,7 @@ void RPCHandlerImpl::OnMessageReceived( return; } - utils::SharedPtr<Message> outgoing_message = ConvertRawMsgToMessage(message); + std::shared_ptr<Message> outgoing_message = ConvertRawMsgToMessage(message); if (outgoing_message) { LOG4CXX_DEBUG(logger_, "Posting new Message"); @@ -220,7 +220,7 @@ bool RPCHandlerImpl::ConvertMessageToSO( LOG4CXX_WARN(logger_, "Failed to parse string to smart object :" << message.json_message()); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( message.connection_key(), message.function_id(), @@ -245,7 +245,7 @@ bool RPCHandlerImpl::ConvertMessageToSO( << " binary size should be " << message.data_size() << " payload data size is " << message.payload_size()); - utils::SharedPtr<smart_objects::SmartObject> response( + std::shared_ptr<smart_objects::SmartObject> response( MessageHelper::CreateNegativeResponse( message.connection_key(), message.function_id(), @@ -310,7 +310,7 @@ bool RPCHandlerImpl::ConvertMessageToSO( NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION; smart_objects::SmartObjectSPtr msg_to_send = - new smart_objects::SmartObject(output); + std::make_shared<smart_objects::SmartObject>(output); v1_shema.attachSchema(*msg_to_send, false); app_manager_.GetRPCService().SendMessageToMobile(msg_to_send); return false; @@ -329,11 +329,11 @@ bool RPCHandlerImpl::ConvertMessageToSO( return true; } -utils::SharedPtr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( +std::shared_ptr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( const protocol_handler::RawMessagePtr message) { LOG4CXX_AUTO_TRACE(logger_); DCHECK(message); - utils::SharedPtr<Message> outgoing_message; + std::shared_ptr<Message> outgoing_message; LOG4CXX_DEBUG(logger_, "Service type." << message->service_type()); if (message->service_type() != protocol_handler::kRpc && @@ -347,7 +347,7 @@ utils::SharedPtr<Message> RPCHandlerImpl::ConvertRawMsgToMessage( MobileMessageHandler::HandleIncomingMessageProtocol(message); if (convertion_result) { - outgoing_message = convertion_result; + outgoing_message = std::shared_ptr<Message>(convertion_result); } else { LOG4CXX_ERROR(logger_, "Received invalid message"); } diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc index 11a98fc970..bdd6c8e0c2 100644 --- a/src/components/application_manager/src/rpc_service_impl.cc +++ b/src/components/application_manager/src/rpc_service_impl.cc @@ -327,8 +327,8 @@ void RPCServiceImpl::Handle(const impl::MessageToMobile message) { return; } - utils::SharedPtr<protocol_handler::RawMessage> rawMessage = - MobileMessageHandler::HandleOutgoingMessageProtocol(message); + std::shared_ptr<protocol_handler::RawMessage> rawMessage( + MobileMessageHandler::HandleOutgoingMessageProtocol(message)); if (!rawMessage) { LOG4CXX_ERROR(logger_, "Failed to create raw message."); @@ -404,7 +404,7 @@ void RPCServiceImpl::SendMessageToMobile( "Attached schema to message, result if valid: " << message->isValid()); // Messages to mobile are not yet prioritized so use default priority value - utils::SharedPtr<Message> message_to_send( + std::shared_ptr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); if (!ConvertSOtoMessage((*message), (*message_to_send))) { LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string"); @@ -486,7 +486,7 @@ void RPCServiceImpl::SendMessageToHMI( } // SmartObject |message| has no way to declare priority for now - utils::SharedPtr<Message> message_to_send( + std::shared_ptr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); if (!message_to_send) { LOG4CXX_ERROR(logger_, "Null pointer"); diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc index 1a1e5543df..f7a147d6df 100644 --- a/src/components/application_manager/src/state_controller_impl.cc +++ b/src/components/application_manager/src/state_controller_impl.cc @@ -35,7 +35,7 @@ #include "application_manager/usage_statistics.h" #include "application_manager/rpc_service.h" #include "utils/helpers.h" -#include "utils/make_shared.h" + #include "connection_handler/connection_handler.h" namespace application_manager { @@ -472,7 +472,7 @@ mobile_apis::HMILevel::eType StateControllerImpl::GetAvailableHmiLevel( return result; } - const bool is_active_app_exist = app_mngr_.active_application(); + const bool is_active_app_exist = (bool)app_mngr_.active_application(); if (is_audio_app) { if (does_audio_app_with_same_type_exist) { result = app_mngr_.GetDefaultHmiLevel(app); @@ -853,7 +853,7 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) { DCHECK_OR_RETURN_VOID(app); const HmiStatePtr regular = app->RegularHmiState(); DCHECK_OR_RETURN_VOID(regular); - HmiStatePtr new_regular = utils::MakeShared<HmiState>(*regular); + HmiStatePtr new_regular = std::make_shared<HmiState>(*regular); LOG4CXX_DEBUG(logger_, "Current HMI level: '" << app->hmi_level() << "'"); const bool is_audio_app = app->IsAudioApplication(); @@ -968,53 +968,53 @@ bool StateControllerImpl::IsStateActive(HmiState::StateID state_id) const { } HmiStatePtr StateControllerImpl::CreateHmiState( - utils::SharedPtr<Application> app, HmiState::StateID state_id) const { + std::shared_ptr<Application> app, HmiState::StateID state_id) const { using namespace utils; LOG4CXX_AUTO_TRACE(logger_); HmiStatePtr new_state; switch (state_id) { case HmiState::STATE_ID_PHONE_CALL: { - new_state = MakeShared<PhoneCallHmiState>(app, app_mngr_); + new_state = std::make_shared<PhoneCallHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_SAFETY_MODE: { - new_state = MakeShared<SafetyModeHmiState>(app, app_mngr_); + new_state = std::make_shared<SafetyModeHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_VR_SESSION: { - new_state = MakeShared<VRHmiState>(app, app_mngr_); + new_state = std::make_shared<VRHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_TTS_SESSION: { - new_state = MakeShared<TTSHmiState>(app, app_mngr_); + new_state = std::make_shared<TTSHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_VIDEO_STREAMING: { - new_state = MakeShared<VideoStreamingHmiState>(app, app_mngr_); + new_state = std::make_shared<VideoStreamingHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_NAVI_STREAMING: { - new_state = MakeShared<NaviStreamingHmiState>(app, app_mngr_); + new_state = std::make_shared<NaviStreamingHmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_REGULAR: { - new_state = MakeShared<HmiState>(app, app_mngr_); + new_state = std::make_shared<HmiState>(app, app_mngr_); break; } case HmiState::STATE_ID_POSTPONED: { - new_state = MakeShared<HmiState>(app, app_mngr_, state_id); + new_state = std::make_shared<HmiState>(app, app_mngr_, state_id); break; } case HmiState::STATE_ID_DEACTIVATE_HMI: { - new_state = MakeShared<DeactivateHMI>(app, app_mngr_); + new_state = std::make_shared<DeactivateHMI>(app, app_mngr_); break; } case HmiState::STATE_ID_AUDIO_SOURCE: { - new_state = MakeShared<AudioSource>(app, app_mngr_); + new_state = std::make_shared<AudioSource>(app, app_mngr_); break; } case HmiState::STATE_ID_EMBEDDED_NAVI: { - new_state = MakeShared<EmbeddedNavi>(app, app_mngr_); + new_state = std::make_shared<EmbeddedNavi>(app, app_mngr_); break; } default: diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc index 80755b6509..8081dee139 100644 --- a/src/components/application_manager/src/usage_statistics.cc +++ b/src/components/application_manager/src/usage_statistics.cc @@ -35,7 +35,7 @@ #include "smart_objects/enum_schema_item.h" #include "policy/usage_statistics/statistics_manager.h" #include "utils/macro.h" -#include "utils/make_shared.h" + using namespace mobile_apis; using namespace NsSmartDeviceLink::NsSmartObjects; @@ -56,7 +56,7 @@ std::string LanguageIdToString(Language::eType lang_id) { UsageStatistics::UsageStatistics( const std::string& app_id, - utils::SharedPtr<StatisticsManager> statistics_manager) + std::shared_ptr<StatisticsManager> statistics_manager) : time_in_hmi_state_sptr_( new usage_statistics::AppStopwatchImpl(statistics_manager, app_id)) , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI) @@ -78,7 +78,7 @@ UsageStatistics::UsageStatistics( UsageStatistics::UsageStatistics( const std::string& app_id, - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, AppStopwatch* time_in_hmi_state_ptr) : time_in_hmi_state_sptr_(time_in_hmi_state_ptr) , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI) diff --git a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc index 2fda4a7031..3293a8908d 100644 --- a/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc +++ b/src/components/application_manager/test/app_launch/app_launch_ctrl_test.cc @@ -40,7 +40,7 @@ #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" #include "connection_handler/mock_connection_handler.h" -#include "utils/make_shared.h" + #include "utils/test_async_waiter.h" namespace test { @@ -60,12 +60,12 @@ namespace ch_test = test::components::connection_handler_test; namespace am_test = test::components::application_manager_test; const uint32_t MAX_TEST_DURATION = 1000; // 1 second -typedef utils::SharedPtr<am_test::MockApplication> MockAppPtr; +typedef std::shared_ptr<am_test::MockApplication> MockAppPtr; class AppLaunchCtrlTest : public ::testing::Test { public: MockAppPtr AppFromAppData(const app_launch::ApplicationData& app_data) { - utils::SharedPtr<NiceMock<am_test::MockApplication> > app = - utils::MakeShared<NiceMock<am_test::MockApplication> >(); + std::shared_ptr<NiceMock<am_test::MockApplication> > app = + std::make_shared<NiceMock<am_test::MockApplication> >(); ON_CALL(*app, mac_address()).WillByDefault(ReturnRef(app_data.device_mac_)); ON_CALL(*app, bundle_id()).WillByDefault(ReturnRef(app_data.bundle_id_)); @@ -77,7 +77,7 @@ class AppLaunchCtrlTest : public ::testing::Test { app_launch::ApplicationDataPtr AppDataFromApp( const am_test::MockApplication& app) { app_launch::ApplicationDataPtr app_data = - utils::MakeShared<NiceMock<app_launch::ApplicationData> >( + std::make_shared<NiceMock<app_launch::ApplicationData> >( app.policy_app_id(), app.bundle_id(), app.mac_address()); return app_data; } @@ -137,7 +137,7 @@ class AppLaunchCtrlTest : public ::testing::Test { using app_launch::ApplicationData; AppAndAppData app; app.second = - utils::MakeShared<ApplicationData>(app_id, bundle_id, device_mac); + std::make_shared<ApplicationData>(app_id, bundle_id, device_mac); app.first = AppFromAppData(*app.second); return app; } diff --git a/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc index bfae920dbf..dc96fcf176 100644 --- a/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc +++ b/src/components/application_manager/test/app_launch/app_launch_data_db_test.cc @@ -38,7 +38,7 @@ #include "utils/macro.h" #include "sql_database.h" #include "sql_query.h" -#include "utils/make_shared.h" + #include "utils/file_system.h" #include "application_manager/mock_app_launch_settings.h" #include "application_manager/app_launch/app_launch_data_db.h" @@ -284,7 +284,7 @@ TEST_F(AppLaunchDataDBTest, SelectMultipleData) { const std::string mobile_app_id = AddCounter("d1_mobile_app_id", i); const std::string bundle_id = AddCounter("d1_bundle_id", i); - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac_1); AddApplicationDataWithIncreaseTable(*app_data); input_data1.push_back(app_data); @@ -294,7 +294,7 @@ TEST_F(AppLaunchDataDBTest, SelectMultipleData) { const std::string mobile_app_id = AddCounter("d2_mobile_app_id", i); const std::string bundle_id = AddCounter("d2_bundle_id", i); - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac_2); AddApplicationDataWithIncreaseTable(*app_data); input_data2.push_back(app_data); diff --git a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc index 04006954b5..f68ad32bbb 100644 --- a/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc +++ b/src/components/application_manager/test/app_launch/app_launch_data_json_test.cc @@ -36,7 +36,7 @@ #include "json/json.h" #include "gtest/gtest.h" #include "utils/macro.h" -#include "utils/make_shared.h" + #include "utils/file_system.h" #include "utils/date_time.h" #include "resumption/last_state_impl.h" @@ -301,7 +301,7 @@ TEST_F(AppLaunchDataJsonTest, SelectMultipleData) { const std::string mobile_app_id = AddCounter("d1_mobile_app_id_", i); const std::string bundle_id = AddCounter("d1_bundle_id_", i); - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac_1); AddApplicationDataWithIncreaseTable(*app_data); input_data1.push_back(app_data); @@ -311,7 +311,7 @@ TEST_F(AppLaunchDataJsonTest, SelectMultipleData) { const std::string mobile_app_id = AddCounter("d2_mobile_app_id_", i); const std::string bundle_id = AddCounter("d2_bundle_id_", i); - ApplicationDataPtr app_data = utils::MakeShared<ApplicationData>( + ApplicationDataPtr app_data = std::make_shared<ApplicationData>( mobile_app_id, bundle_id, device_mac_2); AddApplicationDataWithIncreaseTable(*app_data); input_data2.push_back(app_data); diff --git a/src/components/application_manager/test/application_helper_test.cc b/src/components/application_manager/test/application_helper_test.cc index c9a8fd2da4..e84dc5f7be 100644 --- a/src/components/application_manager/test/application_helper_test.cc +++ b/src/components/application_manager/test/application_helper_test.cc @@ -50,8 +50,8 @@ #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "test/resumption/mock_last_state.h" #include "media_manager/mock_media_manager.h" @@ -121,13 +121,13 @@ class ApplicationHelperTest : public testing::Test { .WillOnce(ReturnRef(path_to_plagin)); app_manager_impl_.Init(mock_last_state_, &mock_media_manager_); - app_impl_ = new ApplicationImpl( + app_impl_ = std::make_shared<ApplicationImpl>( application_id, policy_app_id, mac_address, device_id, app_name, - utils::MakeShared<usage_statistics_test::MockStatisticsManager>(), + std::make_shared<usage_statistics_test::MockStatisticsManager>(), app_manager_impl_); } diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index 3fe646d710..ce1d4ed326 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -39,7 +39,7 @@ #include "application_manager/hmi_state.h" #include "utils/file_system.h" -#include "utils/make_shared.h" + #include "application_manager/mock_message_helper.h" #include "utils/custom_string.h" #include "application_manager/mock_application_manager.h" @@ -101,7 +101,7 @@ class ApplicationImplTest : public ::testing::Test { mac_address, device_handle, app_name, - utils::MakeShared<MockStatisticsManager>(), + std::make_shared<MockStatisticsManager>(), mock_application_manager_)); HmiStatePtr initial_state = CreateTestHmiState(); @@ -121,7 +121,7 @@ class ApplicationImplTest : public ::testing::Test { void CheckCurrentHMIState(); MockApplicationManagerSettings mock_application_manager_settings_; MockApplicationManager mock_application_manager_; - utils::SharedPtr<ApplicationImpl> app_impl; + std::shared_ptr<ApplicationImpl> app_impl; uint32_t app_id; std::string policy_app_id; std::string mac_address; @@ -136,8 +136,8 @@ class ApplicationImplTest : public ::testing::Test { }; HmiStatePtr ApplicationImplTest::CreateTestHmiState() { - HmiStatePtr testState = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(app_impl), + HmiStatePtr testState = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(app_impl), mock_application_manager_, state_id); testState->set_hmi_level(test_lvl); @@ -271,7 +271,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) { // Last state does not have a parent EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level()); EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id()); - EXPECT_EQ(NULL, current_state->parent()); + EXPECT_EQ(nullptr, current_state->parent()); } TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) { @@ -310,7 +310,7 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) { // Check that state was correctly removed app_impl->RemovePostponedState(); state2 = app_impl->PostponedHmiState(); - EXPECT_EQ(NULL, state2); + EXPECT_EQ(nullptr, state2); } TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) { @@ -406,7 +406,7 @@ TEST_F(ApplicationImplTest, GetFile) { test_file.file_type = FileType::GRAPHIC_JPEG; test_file.file_name = "test_file 1"; - EXPECT_EQ(NULL, app_impl->GetFile(test_file.file_name)); + EXPECT_EQ(nullptr, app_impl->GetFile(test_file.file_name)); EXPECT_TRUE(app_impl->AddFile(test_file)); const AppFile* app_file = app_impl->GetFile(test_file.file_name); EXPECT_EQ(test_file.is_persistent, app_file->is_persistent); @@ -812,7 +812,7 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) { TEST_F(ApplicationImplTest, PushPopMobileMessage) { smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); const hmi_apis::Common_DriverDistractionState::eType state = hmi_apis::Common_DriverDistractionState::DD_ON; (*on_driver_distraction)[strings::params][strings::function_id] = diff --git a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc index 9ae388c809..b168f7a480 100644 --- a/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc +++ b/src/components/application_manager/test/application_manager_impl_mock_hmi_test.cc @@ -38,7 +38,7 @@ #include "application_manager/application_impl.h" #include "application_manager/application_manager_impl.h" #include "utils/custom_string.h" -#include "utils/make_shared.h" + #include "encryption/hashing.h" #include "application_manager/mock_application_manager_settings.h" @@ -87,7 +87,7 @@ class ApplicationManagerImplMockHmiTest : public ::testing::Test { public: ApplicationManagerImplMockHmiTest() : mock_storage_( - ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >( + std::make_shared<NiceMock<resumption_test::MockResumptionData> >( mock_app_mngr_)) {} protected: @@ -146,7 +146,7 @@ class ApplicationManagerImplMockHmiTest : public ::testing::Test { Return(0))); } - utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> > + std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_; application_manager_test::MockApplicationManager mock_app_mngr_; NiceMock<policy_handler_test::MockPolicySettings> mock_policy_settings_; @@ -168,13 +168,13 @@ TEST_F(ApplicationManagerImplMockHmiTest, plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager = new plugin_manager::MockRPCPluginManager; - utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl( + std::shared_ptr<ApplicationImpl> app_impl = std::make_shared<ApplicationImpl>( application_id, policy_app_id, encryption::MakeHash(mac_address), device_id, app_name, - utils::SharedPtr<usage_statistics::StatisticsManager>( + std::shared_ptr<usage_statistics::StatisticsManager>( new usage_statistics_test::MockStatisticsManager()), *app_manager_impl_); std::unique_ptr<plugin_manager::RPCPluginManager> mock_rpc_plugin_manager_ptr( @@ -195,7 +195,7 @@ TEST_F(ApplicationManagerImplMockHmiTest, // // Skip sending notification on device switching as it is not the goal // here EXPECT_CALL(mock_command_factory, CreateCommand(_, _)) - .WillOnce(Return(utils::SharedPtr<commands::Command>())); + .WillOnce(Return(std::shared_ptr<commands::Command>())); plugin_manager::MockRPCPlugin mock_rpc_plugin; utils::Optional<plugin_manager::RPCPlugin> mock_rpc_plugin_opt = @@ -212,14 +212,14 @@ TEST_F(ApplicationManagerImplMockHmiTest, const uint32_t correlation_id_1 = 1u; const uint32_t correlation_id_2 = 2u; const uint32_t correlation_id_3 = 3u; - utils::SharedPtr<NiceMock<MockRequest> > cmd_1 = - utils::MakeShared<NiceMock<MockRequest> >(connection_key, + std::shared_ptr<NiceMock<MockRequest> > cmd_1 = + std::make_shared<NiceMock<MockRequest> >(connection_key, correlation_id_1); - utils::SharedPtr<NiceMock<MockRequest> > cmd_2 = - utils::MakeShared<NiceMock<MockRequest> >(connection_key, + std::shared_ptr<NiceMock<MockRequest> > cmd_2 = + std::make_shared<NiceMock<MockRequest> >(connection_key, correlation_id_2); - utils::SharedPtr<NiceMock<MockRequest> > cmd_3 = - utils::MakeShared<NiceMock<MockRequest> >(connection_key, + std::shared_ptr<NiceMock<MockRequest> > cmd_3 = + std::make_shared<NiceMock<MockRequest> >(connection_key, correlation_id_3); EXPECT_CALL(mock_command_factory, CreateCommand(_, _)) @@ -228,11 +228,11 @@ TEST_F(ApplicationManagerImplMockHmiTest, .WillOnce(Return(cmd_3)); commands::MessageSharedPtr hmi_msg_1 = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); commands::MessageSharedPtr hmi_msg_2 = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); commands::MessageSharedPtr hmi_msg_3 = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*hmi_msg_1)[strings::msg_params][strings::app_id] = (*hmi_msg_2)[strings::msg_params][strings::app_id] = diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc index d2bba895c8..5b3a148357 100644 --- a/src/components/application_manager/test/application_manager_impl_test.cc +++ b/src/components/application_manager/test/application_manager_impl_test.cc @@ -58,7 +58,7 @@ #include "utils/custom_string.h" #include "utils/file_system.h" #include "utils/lock.h" -#include "utils/make_shared.h" + #include "utils/push_log.h" #include "encryption/hashing.h" @@ -103,7 +103,7 @@ class ApplicationManagerImplTest : public ::testing::Test { ApplicationManagerImplTest() : app_id_(0u) , mock_storage_( - ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >( + std::make_shared<NiceMock<resumption_test::MockResumptionData> >( mock_app_mngr_)) , mock_rpc_service_(new MockRPCService) , mock_message_helper_( @@ -151,7 +151,7 @@ class ApplicationManagerImplTest : public ::testing::Test { app_manager_impl_.reset(new am::ApplicationManagerImpl( mock_application_manager_settings_, mock_policy_settings_)); - mock_app_ptr_ = utils::SharedPtr<MockApplication>(new MockApplication()); + mock_app_ptr_ = std::shared_ptr<MockApplication>(new MockApplication()); app_manager_impl_->set_protocol_handler(&mock_protocol_handler_); ASSERT_TRUE(app_manager_impl_.get()); ASSERT_TRUE(mock_app_ptr_.get()); @@ -196,7 +196,7 @@ class ApplicationManagerImplTest : public ::testing::Test { uint32_t app_id_; NiceMock<policy_test::MockPolicySettings> mock_policy_settings_; - utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> > + std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_; std::unique_ptr<rpc_service::RPCService> mock_rpc_service_; @@ -207,7 +207,7 @@ class ApplicationManagerImplTest : public ::testing::Test { std::unique_ptr<am::ApplicationManagerImpl> app_manager_impl_; application_manager::MockMessageHelper* mock_message_helper_; - utils::SharedPtr<MockApplication> mock_app_ptr_; + std::shared_ptr<MockApplication> mock_app_ptr_; NiceMock<protocol_handler_test::MockProtocolHandler> mock_protocol_handler_; }; @@ -221,7 +221,7 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) { app_data[am::json::android][am::json::packageName] = "com.android.test"; smart_objects::SmartObject sm_object(SmartType_Map); sm_object[am::json::response][0] = app_data; - SmartObjectSPtr sptr = MakeShared<SmartObject>(sm_object); + SmartObjectSPtr sptr = std::make_shared<SmartObject>(sm_object); ON_CALL(*mock_message_helper_, CreateModuleInfoSO(_, _)) .WillByDefault(Return(sptr)); @@ -233,7 +233,7 @@ TEST_F(ApplicationManagerImplTest, ProcessQueryApp_ExpectSuccess) { TEST_F(ApplicationManagerImplTest, SubscribeAppForWayPoints_ExpectSubscriptionApp) { auto app_ptr = - ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + std::static_pointer_cast<am::Application>(mock_app_ptr_); app_manager_impl_->SubscribeAppForWayPoints(app_ptr); EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr)); } @@ -241,7 +241,7 @@ TEST_F(ApplicationManagerImplTest, TEST_F(ApplicationManagerImplTest, UnsubscribeAppForWayPoints_ExpectUnsubscriptionApp) { auto app_ptr = - ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + std::static_pointer_cast<am::Application>(mock_app_ptr_); app_manager_impl_->SubscribeAppForWayPoints(app_ptr); EXPECT_TRUE(app_manager_impl_->IsAppSubscribedForWayPoints(app_ptr)); app_manager_impl_->UnsubscribeAppFromWayPoints(app_ptr); @@ -263,11 +263,11 @@ TEST_F( ApplicationManagerImplTest, GetAppsSubscribedForWayPoints_SubcribeAppForWayPoints_ExpectCorrectResult) { auto app_ptr = - ApplicationSharedPtr::static_pointer_cast<am::Application>(mock_app_ptr_); + std::static_pointer_cast<am::Application>(mock_app_ptr_); app_manager_impl_->SubscribeAppForWayPoints(app_ptr); std::set<int32_t> result = app_manager_impl_->GetAppsSubscribedForWayPoints(); EXPECT_EQ(1u, result.size()); - EXPECT_TRUE(result.find(app_ptr) != result.end()); + EXPECT_TRUE(result.find(app_ptr->app_id()) != result.end()); } TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_RpcService) { @@ -727,7 +727,7 @@ TEST_F(ApplicationManagerImplTest, .WillOnce(Return(mobile_api::HMILevel::eType::INVALID_ENUM)); smart_objects::SmartObject dummy_object(SmartType_Map); - SmartObjectSPtr sptr = MakeShared<SmartObject>(dummy_object); + SmartObjectSPtr sptr = std::make_shared<SmartObject>(dummy_object); EXPECT_CALL(*mock_message_helper_, CreateModuleInfoSO( @@ -753,7 +753,7 @@ TEST_F(ApplicationManagerImplTest, EXPECT_CALL(*mock_app_ptr_, set_secondary_device(0)).Times(1); smart_objects::SmartObject dummy_object(SmartType_Map); - SmartObjectSPtr sptr = MakeShared<SmartObject>(dummy_object); + SmartObjectSPtr sptr = std::make_shared<SmartObject>(dummy_object); EXPECT_CALL(*mock_message_helper_, CreateModuleInfoSO( @@ -778,8 +778,8 @@ TEST_F(ApplicationManagerImplTest, TEST_F(ApplicationManagerImplTest, OnDeviceSwitchingStart_ExpectPutAppsInWaitList) { - utils::SharedPtr<MockApplication> switching_app_ptr = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> switching_app_ptr = + std::make_shared<MockApplication>(); const std::string switching_device_id = "switching"; const std::string switching_device_id_hash = @@ -796,8 +796,8 @@ TEST_F(ApplicationManagerImplTest, EXPECT_CALL(*switching_app_ptr, hmi_level()) .WillRepeatedly(Return(hmi_level_switching_app)); - utils::SharedPtr<MockApplication> nonswitching_app_ptr = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> nonswitching_app_ptr = + std::make_shared<MockApplication>(); const std::string nonswitching_device_id = "nonswitching"; const std::string nonswitching_device_id_hash = @@ -836,8 +836,8 @@ TEST_F(ApplicationManagerImplTest, TEST_F(ApplicationManagerImplTest, OnDeviceSwitchingFinish_ExpectUnregisterAppsInWaitList) { - utils::SharedPtr<MockApplication> switching_app_ptr = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> switching_app_ptr = + std::make_shared<MockApplication>(); plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager = new plugin_manager::MockRPCPluginManager; @@ -860,8 +860,8 @@ TEST_F(ApplicationManagerImplTest, EXPECT_CALL(*switching_app_ptr, hmi_level()) .WillRepeatedly(Return(hmi_level_switching_app)); - utils::SharedPtr<MockApplication> nonswitching_app_ptr = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> nonswitching_app_ptr = + std::make_shared<MockApplication>(); const std::string nonswitching_device_id = "nonswitching"; const std::string nonswitching_device_id_hash = @@ -909,13 +909,13 @@ TEST_F(ApplicationManagerImplTest, const connection_handler::DeviceHandle device_id = 1; const custom_str::CustomString app_name(""); - utils::SharedPtr<ApplicationImpl> app_impl = new ApplicationImpl( + std::shared_ptr<ApplicationImpl> app_impl = std::make_shared<ApplicationImpl>( application_id, policy_app_id, mac_address, device_id, app_name, - utils::SharedPtr<usage_statistics::StatisticsManager>( + std::shared_ptr<usage_statistics::StatisticsManager>( new usage_statistics_test::MockStatisticsManager()), *app_manager_impl_); @@ -986,8 +986,8 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) { const uint32_t app_id_2 = 65538; std::string dummy_mac_address; - utils::SharedPtr<MockApplication> mock_app_1 = - utils::SharedPtr<MockApplication>(new MockApplication()); + std::shared_ptr<MockApplication> mock_app_1 = + std::shared_ptr<MockApplication>(new MockApplication()); EXPECT_CALL(*mock_app_1, app_id()).WillRepeatedly(Return(app_id_1)); EXPECT_CALL(*mock_app_1, device()).WillRepeatedly(Return(0)); EXPECT_CALL(*mock_app_1, mac_address()) @@ -997,8 +997,8 @@ TEST_F(ApplicationManagerImplTest, UnregisterAnotherAppDuringAudioPassThru) { .WillRepeatedly( Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4)); - utils::SharedPtr<MockApplication> mock_app_2 = - utils::SharedPtr<MockApplication>(new MockApplication()); + std::shared_ptr<MockApplication> mock_app_2 = + std::shared_ptr<MockApplication>(new MockApplication()); EXPECT_CALL(*mock_app_2, app_id()).WillRepeatedly(Return(app_id_2)); EXPECT_CALL(*mock_app_2, device()).WillRepeatedly(Return(0)); EXPECT_CALL(*mock_app_2, mac_address()) @@ -1397,7 +1397,7 @@ TEST_F(ApplicationManagerImplTest, protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_2; smart_objects::SmartObjectSPtr request_for_registration_ptr = - MakeShared<smart_objects::SmartObject>(request_for_registration); + std::make_shared<smart_objects::SmartObject>(request_for_registration); ApplicationSharedPtr application = app_manager_impl_->RegisterApplication(request_for_registration_ptr); diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc index 6f732b6adc..c19fd00930 100644 --- a/src/components/application_manager/test/application_state_test.cc +++ b/src/components/application_manager/test/application_state_test.cc @@ -41,7 +41,7 @@ #include "application_manager/state_controller.h" #include "application_manager/resumption/resume_ctrl.h" -#include "utils/make_shared.h" + namespace test { namespace components { @@ -75,7 +75,7 @@ class ApplicationStateTest : public ::testing::Test { ApplicationState app_state; const StateID current_id = StateID::STATE_ID_CURRENT; const StateID postponed_id = StateID::STATE_ID_POSTPONED; - utils::SharedPtr<MockApplication> mock_app_; + std::shared_ptr<MockApplication> mock_app_; MockApplicationManager app_mngr_; }; @@ -85,8 +85,8 @@ std::vector<StateID> ApplicationStateTest::added_states_ = TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); @@ -97,8 +97,8 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) { TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) { std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); @@ -120,18 +120,18 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { // Added some states std::vector<StateID>::iterator new_state = added_states_.begin(); for (; new_state != added_states_.end(); ++new_state) { - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); } // Postponed state wasn't added HmiStatePtr get_postponed_id = app_state.GetState(postponed_id); - EXPECT_EQ(NULL, get_postponed_id); + EXPECT_EQ(nullptr, get_postponed_id); // Add posponed state - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); app_state.AddState(state); @@ -143,8 +143,8 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) { TEST_F(ApplicationStateTest, AddStates_GetRegularState) { // Add state std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); state->set_hmi_level(HMILevel::HMI_FULL); @@ -152,8 +152,8 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { ++new_state; // Add some other for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); @@ -169,16 +169,16 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { std::vector<StateID>::iterator new_state = added_states_.begin(); - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); ++new_state; // Add postponed state - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); app_state.AddState(state); @@ -188,8 +188,8 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { ASSERT_EQ(state, post_state); for (; new_state != added_states_.end(); ++new_state) { - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, *new_state); app_state.AddState(state); @@ -211,30 +211,30 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) { TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { // Add some state StateID first_state = StateID::STATE_ID_PHONE_CALL; - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, first_state); app_state.AddState(state); // Add postponed state - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); app_state.AddState(state); // Add new postponed state - utils::SharedPtr<MockApplication> mock_app_2(new MockApplication); - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + std::shared_ptr<MockApplication> mock_app_2(new MockApplication); + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); app_state.AddState(state); // Add regular state - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, StateID::STATE_ID_REGULAR); app_state.AddState(state); @@ -250,8 +250,8 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) { TEST_F(ApplicationStateTest, InitState_GetRegularState) { StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, init_state); @@ -267,8 +267,8 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) { TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { // Precondition StateID init_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, init_state); state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL); @@ -276,8 +276,8 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { app_state.InitState(state); // Add postponed state - state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, postponed_id); app_state.AddState(state); @@ -290,14 +290,14 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) { app_state.RemoveState(postponed_id); get_postponed_state = app_state.GetState(postponed_id); - EXPECT_EQ(NULL, get_postponed_state); + EXPECT_EQ(nullptr, get_postponed_state); } TEST_F(ApplicationStateTest, AddRegularState_RemoveRegularState_RegularStateNotDeleted) { StateID reg_state = StateID::STATE_ID_REGULAR; - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, reg_state); app_state.InitState(state); diff --git a/src/components/application_manager/test/command_holder_test.cc b/src/components/application_manager/test/command_holder_test.cc index 9227fd8fcb..588dc8e6ab 100644 --- a/src/components/application_manager/test/command_holder_test.cc +++ b/src/components/application_manager/test/command_holder_test.cc @@ -35,8 +35,8 @@ #include "application_manager/command_holder_impl.h" #include "application_manager/commands/command.h" #include "smart_objects/smart_object.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application.h" @@ -75,8 +75,8 @@ class CommandHolderImplTest : public testing::Test { const std::string kPolicyAppId_; const uint32_t kHmiApplicationId_; const uint32_t kConnectionKey_; - utils::SharedPtr<smart_objects::SmartObject> cmd_ptr_; - utils::SharedPtr<MockApplication> mock_app_ptr_; + std::shared_ptr<smart_objects::SmartObject> cmd_ptr_; + std::shared_ptr<MockApplication> mock_app_ptr_; application_manager_test::MockRPCService mock_rpc_service_; }; @@ -126,8 +126,8 @@ TEST_F(CommandHolderImplTest, Hold_ReleaseAnotherId_ExpectNoReleased) { mock_app_ptr_, am::CommandHolder::CommandType::kHmiCommand, cmd_ptr_); // Act - utils::SharedPtr<MockApplication> another_app = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> another_app = + std::make_shared<MockApplication>(); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(0); cmd_holder.Resume(another_app, am::CommandHolder::CommandType::kHmiCommand); @@ -144,8 +144,8 @@ TEST_F(CommandHolderImplTest, Hold_DropAnotherId_ExpectReleased) { } while (iterations < 3); // Act - utils::SharedPtr<MockApplication> another_app = - utils::MakeShared<MockApplication>(); + std::shared_ptr<MockApplication> another_app = + std::make_shared<MockApplication>(); cmd_holder.Clear(another_app); EXPECT_CALL(mock_rpc_service_, ManageHMICommand(cmd_ptr_)).Times(iterations); diff --git a/src/components/application_manager/test/commands/command_impl_test.cc b/src/components/application_manager/test/commands/command_impl_test.cc index b50d94f824..2b15397769 100644 --- a/src/components/application_manager/test/commands/command_impl_test.cc +++ b/src/components/application_manager/test/commands/command_impl_test.cc @@ -37,7 +37,7 @@ #include <set> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -55,7 +55,7 @@ using ::testing::Return; using ::testing::AtLeast; using ::testing::_; -using ::utils::SharedPtr; + namespace strings = ::application_manager::strings; using ::application_manager::commands::CommandImpl; using ::application_manager::ApplicationManager; @@ -63,7 +63,7 @@ using ::application_manager::commands::MessageSharedPtr; using ::application_manager::ApplicationSharedPtr; using ::test::components::application_manager_test::MockApplication; -typedef SharedPtr<MockApplication> MockAppPtr; +typedef std::shared_ptr<MockApplication> MockAppPtr; namespace { const uint32_t kDefaultMsgCount = 5u; @@ -125,11 +125,11 @@ class CommandImplTest : public CommandsTest<CommandsTestMocks::kIsNice> { }; typedef CommandImplTest::UnwrappedCommandImpl UCommandImpl; -typedef SharedPtr<UCommandImpl> UCommandImplPtr; +typedef std::shared_ptr<UCommandImpl> UCommandImplPtr; TEST_F(CommandImplTest, GetMethods_SUCCESS) { MessageSharedPtr msg; - SharedPtr<CommandImpl> command = + std::shared_ptr<CommandImpl> command = CreateCommand<CommandImpl>(kDefaultTimeout_, msg); // Current implementation always return `true` diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc index c5a3459673..968c606855 100644 --- a/src/components/application_manager/test/commands/command_request_impl_test.cc +++ b/src/components/application_manager/test/commands/command_request_impl_test.cc @@ -40,7 +40,7 @@ #include "application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_test.h" #include "utils/lock.h" -#include "utils/shared_ptr.h" + #include "utils/data_accessor.h" #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" @@ -65,7 +65,7 @@ using ::testing::Return; using ::testing::SaveArg; using ::testing::DoAll; -using ::utils::SharedPtr; + using am::commands::MessageSharedPtr; using am::CommandParametersPermissions; using am::event_engine::EventObserver; @@ -134,8 +134,8 @@ class CommandRequestImplTest } }; - MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) { - app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set); + MockAppPtr InitAppSetDataAccessor(std::shared_ptr<ApplicationSet>& app_set) { + app_set = (!app_set ? std::make_shared<ApplicationSet>() : app_set); MockAppPtr app(CreateMockApp()); app_set->insert(app); EXPECT_CALL(app_mngr_, applications()) @@ -148,7 +148,7 @@ class CommandRequestImplTest }; typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl; -typedef SharedPtr<UCommandRequestImpl> CommandPtr; +typedef std::shared_ptr<UCommandRequestImpl> CommandPtr; TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) { CommandPtr command = CreateCommand<UCommandRequestImpl>(); diff --git a/src/components/application_manager/test/commands/command_response_impl_test.cc b/src/components/application_manager/test/commands/command_response_impl_test.cc index bd7499ce8f..eb1cb473e0 100644 --- a/src/components/application_manager/test/commands/command_response_impl_test.cc +++ b/src/components/application_manager/test/commands/command_response_impl_test.cc @@ -34,7 +34,7 @@ #include <string> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/commands/commands_test.h" @@ -49,7 +49,7 @@ namespace command_response_impl { namespace strings = ::application_manager::strings; namespace hmi_response = ::application_manager::hmi_response; -using ::utils::SharedPtr; + using ::application_manager::commands::MessageSharedPtr; using ::application_manager::commands::CommandResponseImpl; @@ -57,7 +57,7 @@ class CommandResponseImplTest : public CommandsTest<CommandsTestMocks::kIsNice> {}; TEST_F(CommandResponseImplTest, BasicMethodsOverloads_SUCCESS) { - SharedPtr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(); + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(); // Current implementation always return `true` EXPECT_TRUE(command->Init()); EXPECT_TRUE(command->CleanUp()); @@ -66,7 +66,7 @@ TEST_F(CommandResponseImplTest, BasicMethodsOverloads_SUCCESS) { TEST_F(CommandResponseImplTest, SendResponse_MessageWithResultCode_SUCCESS) { MessageSharedPtr msg; - SharedPtr<CommandResponseImpl> command = + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(msg); // Do not have a weight in this case const bool kSuccess = true; @@ -86,7 +86,7 @@ TEST_F(CommandResponseImplTest, SendResponse_MessageWithResultCode_SUCCESS) { TEST_F(CommandResponseImplTest, SendResponse_EmptyMessageValidResultCode_SUCCESS) { MessageSharedPtr msg; - SharedPtr<CommandResponseImpl> command = + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(msg); const bool kSuccess = true; @@ -108,7 +108,7 @@ TEST_F(CommandResponseImplTest, TEST_F(CommandResponseImplTest, SendResponse_EmptyMessageInvalidResultCode_SUCCESS) { MessageSharedPtr msg; - SharedPtr<CommandResponseImpl> command = + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(msg); const bool kSuccess = true; @@ -133,7 +133,7 @@ TEST_F(CommandResponseImplTest, TEST_F(CommandResponseImplTest, SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_SUCCESS) { MessageSharedPtr msg; - SharedPtr<CommandResponseImpl> command = + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(msg); const mobile_apis::Result::eType kResultCode = @@ -158,7 +158,7 @@ TEST_F(CommandResponseImplTest, TEST_F(CommandResponseImplTest, SendResponse_EmptyMessageInvalidResultCodeNoHmiResponse_INVALID_ENUM) { MessageSharedPtr msg; - SharedPtr<CommandResponseImpl> command = + std::shared_ptr<CommandResponseImpl> command = CreateCommand<CommandResponseImpl>(msg); const mobile_apis::Result::eType kResultCode = diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc index 440763d4c3..de0b5afb3c 100644 --- a/src/components/application_manager/test/event_engine_test.cc +++ b/src/components/application_manager/test/event_engine_test.cc @@ -38,7 +38,7 @@ #include "application_manager/mock_event_observer.h" #include "application_manager/mock_event_dispatcher.h" #include "smart_objects/smart_object.h" -#include "utils/make_shared.h" + #include "interfaces/HMI_API.h" namespace test { diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc index 335e8e4f64..3be730c2c9 100644 --- a/src/components/application_manager/test/help_prompt_manager_test.cc +++ b/src/components/application_manager/test/help_prompt_manager_test.cc @@ -89,7 +89,7 @@ class ApplicationImplTest : public ApplicationImpl { const std::string& mac_address, const connection_handler::DeviceHandle device_id, const custom_str::CustomString& app_name, - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, ApplicationManager& application_manager, MockHelpPromptManager& mock_help_prompt_manager) : ApplicationImpl(application_id, @@ -124,8 +124,8 @@ class HelpPromptManagerTest : public ::testing::Test { HmiStatePtr CreateTestHmiState(); template <class Command> - SharedPtr<Command> CreateCommand(MessageSharedPtr& msg) { - return ::utils::MakeShared<Command>(msg, + std::shared_ptr<Command> CreateCommand(MessageSharedPtr& msg) { + return std::make_shared<Command>(msg, app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -136,17 +136,17 @@ class HelpPromptManagerTest : public ::testing::Test { typedef CommandsTest<CommandsTestMocks::kIsNice>::MockAppManager MockAppManager; MockAppManager app_mngr_; - utils::SharedPtr<ApplicationImplTest> app_impl_; + std::shared_ptr<ApplicationImplTest> app_impl_; MockHmiInterfaces mock_hmi_interfaces_; NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_; NiceMock<MockApplicationManagerSettings> app_mngr_settings_; - utils::SharedPtr<application_manager_test::MockApplication> mock_app_; + std::shared_ptr<application_manager_test::MockApplication> mock_app_; sync_primitives::Lock app_lock_; MockRPCService mock_rpc_service_; application_manager_test::MockHMICapabilities mock_hmi_capabilities_; policy_test::MockPolicyHandlerInterface mock_policy_handler_; MockMessageHelper& mock_message_helper_; - utils::SharedPtr<MockHelpPromptManager> mock_help_prompt_manager_; + std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager_; }; void HelpPromptManagerTest::SetUp() { @@ -173,17 +173,17 @@ void HelpPromptManagerTest::SetUp() { .WillByDefault(Return(0)); mock_help_prompt_manager_ = - utils::SharedPtr<MockHelpPromptManager>(new MockHelpPromptManager()); + std::shared_ptr<MockHelpPromptManager>(new MockHelpPromptManager()); - HmiStatePtr state = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(mock_app_), + HmiStatePtr state = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(mock_app_), app_mngr_, HmiState::STATE_ID_REGULAR); std::string path = file_system::CreateDirectory("storage"); file_system::CreateFile(path + "/" + "certificate"); - mock_app_ = utils::MakeShared<application_manager_test::MockApplication>(); + mock_app_ = std::make_shared<application_manager_test::MockApplication>(); } void HelpPromptManagerTest::TearDown() { @@ -192,7 +192,7 @@ void HelpPromptManagerTest::TearDown() { MessageSharedPtr HelpPromptManagerTest::CreateMsgParams() { MessageSharedPtr msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey; (*msg)[am::strings::msg_params][am::strings::app_id] = kAppId; return msg; @@ -220,8 +220,8 @@ void HelpPromptManagerTest::CreateBasicParamsVRRequest(MessageSharedPtr msg) { } HmiStatePtr HelpPromptManagerTest::CreateTestHmiState() { - HmiStatePtr testState = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(app_impl_), + HmiStatePtr testState = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(app_impl_), app_mngr_, HmiState::STATE_ID_REGULAR); testState->set_hmi_level(HMILevel::INVALID_ENUM); @@ -243,7 +243,7 @@ void HelpPromptManagerTest::CreateApplication( mac_address, device_id, app_name, - utils::MakeShared<MockStatisticsManager>(), + std::make_shared<MockStatisticsManager>(), app_mngr_, mock_help_prompt_manager)); HmiStatePtr initial_state = CreateTestHmiState(); @@ -253,7 +253,7 @@ void HelpPromptManagerTest::CreateApplication( TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) { CreateApplication(*mock_help_prompt_manager_.get()); MessageSharedPtr msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); CreateBasicParamsVRRequest(msg); (*msg)[strings::params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; @@ -265,7 +265,7 @@ TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) { TEST_F(HelpPromptManagerTest, RemoveCommand_OnVrCommandDeleted) { CreateApplication(*mock_help_prompt_manager_.get()); MessageSharedPtr msg = - ::utils::MakeShared<SmartObject>(smart_objects::SmartType_Map); + std::make_shared<SmartObject>(smart_objects::SmartType_Map); CreateBasicParamsVRRequest(msg); (*msg)[strings::params][hmi_response::code] = hmi_apis::Common_Result::SUCCESS; @@ -310,7 +310,7 @@ TEST_F(HelpPromptManagerTest, EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); @@ -358,7 +358,7 @@ TEST_F(HelpPromptManagerTest, EXPECT_CALL(*mock_help_prompt_manager_, OnSetGlobalPropertiesReceived(_, false)); - SharedPtr<SetGlobalPropertiesRequest> command( + std::shared_ptr<SetGlobalPropertiesRequest> command( CreateCommand<SetGlobalPropertiesRequest>(msg)); command->Run(); diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc index e1d2eeb402..8d11a0cc93 100644 --- a/src/components/application_manager/test/hmi_capabilities_test.cc +++ b/src/components/application_manager/test/hmi_capabilities_test.cc @@ -41,7 +41,7 @@ #include "application_manager/mock_message_helper.h" #include "smart_objects/enum_schema_item.h" #include "interfaces/HMI_API.h" -#include "utils/make_shared.h" + #include "application_manager/hmi_capabilities_for_testing.h" #include "utils/file_system.h" #include "application_manager/mock_application_manager.h" @@ -82,7 +82,7 @@ class HMICapabilitiesTest : public ::testing::Test { EXPECT_CALL(mock_application_manager_settings_, launch_hmi()) .WillOnce(Return(false)); hmi_capabilities_test = - utils::MakeShared<HMICapabilitiesForTesting>(app_mngr_); + std::make_shared<HMICapabilitiesForTesting>(app_mngr_); hmi_capabilities_test->Init(&last_state_); } @@ -100,7 +100,7 @@ class HMICapabilitiesTest : public ::testing::Test { event_engine_test::MockEventDispatcher mock_event_dispatcher; resumption::LastStateImpl last_state_; MockApplicationManagerSettings mock_application_manager_settings_; - utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities_test; + std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities_test; const std::string file_name_; application_manager_test::MockRPCService mock_rpc_service_; }; @@ -506,8 +506,8 @@ TEST_F(HMICapabilitiesTest, EXPECT_TRUE(::file_system::DeleteFile("./app_info_data")); } - utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities = - utils::MakeShared<HMICapabilitiesForTesting>(mock_app_mngr); + std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities = + std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr); hmi_capabilities->Init(&last_state_); // Check system capabilities; only phone capability is available @@ -546,8 +546,8 @@ TEST_F(HMICapabilitiesTest, EXPECT_TRUE(::file_system::DeleteFile("./app_info_data")); } - utils::SharedPtr<HMICapabilitiesForTesting> hmi_capabilities = - utils::MakeShared<HMICapabilitiesForTesting>(mock_app_mngr); + std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities = + std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr); hmi_capabilities->Init(&last_state_); // Check system capabilities; only navigation capability is valid, the other diff --git a/src/components/application_manager/test/hmi_language_handler_test.cc b/src/components/application_manager/test/hmi_language_handler_test.cc index 9b8bddc6bc..9777183b8b 100644 --- a/src/components/application_manager/test/hmi_language_handler_test.cc +++ b/src/components/application_manager/test/hmi_language_handler_test.cc @@ -45,8 +45,8 @@ #include "application_manager/mock_rpc_service.h" #include "application_manager/smart_object_keys.h" #include "test/resumption/mock_last_state.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/lock.h" namespace test { @@ -57,7 +57,7 @@ namespace am = ::application_manager; using am::event_engine::Event; using am::ApplicationSet; -using ::utils::SharedPtr; + using ::testing::Return; using ::testing::ReturnRef; @@ -75,7 +75,7 @@ typedef NiceMock< ::test::components::event_engine_test::MockEventDispatcher> typedef NiceMock<application_manager_test::MockApplication> MockApp; typedef NiceMock<application_manager_test::MockRPCService> MockRPCService; -typedef SharedPtr<MockApp> ApplicationSharedPtr; +typedef std::shared_ptr<MockApp> ApplicationSharedPtr; typedef am::HMILanguageHandler::Apps Apps; namespace { @@ -89,7 +89,7 @@ class HmiLanguageHandlerTest : public ::testing::Test { EXPECT_CALL(app_manager_, event_dispatcher()) .WillOnce(ReturnRef(event_dispatcher_)); hmi_language_handler_ = - ::utils::MakeShared<am::HMILanguageHandler>(app_manager_); + std::make_shared<am::HMILanguageHandler>(app_manager_); } void InitHMIActiveLanguages(hmi_apis::Common_Language::eType ui_language, @@ -114,7 +114,7 @@ class HmiLanguageHandlerTest : public ::testing::Test { ApplicationSharedPtr CreateMockApp(const uint32_t app_id, bool expect_call = false) const { - ApplicationSharedPtr app = ::utils::MakeShared<MockApp>(); + ApplicationSharedPtr app = std::make_shared<MockApp>(); if (expect_call) { EXPECT_CALL(*app, app_id()).WillRepeatedly(Return(app_id)); } else { @@ -135,7 +135,7 @@ class HmiLanguageHandlerTest : public ::testing::Test { MockApplicationManager app_manager_; MockHMICapabilities hmi_capabilities_; MockEventDispatcher event_dispatcher_; - SharedPtr<am::HMILanguageHandler> hmi_language_handler_; + std::shared_ptr<am::HMILanguageHandler> hmi_language_handler_; std::shared_ptr<sync_primitives::Lock> app_set_lock_; resumption_test::MockLastState last_state_; MockRPCService mock_rpc_service_; @@ -317,7 +317,7 @@ TEST_F(HmiLanguageHandlerTest, // Needed to call of `ManageMobileCommand` method ON_CALL(*am::MockMessageHelper::message_helper_mock(), GetOnAppInterfaceUnregisteredNotificationToMobile(_, _)) - .WillByDefault(Return(::utils::MakeShared<smart_objects::SmartObject>())); + .WillByDefault(Return(std::make_shared<smart_objects::SmartObject>())); // Wait for `ManageMobileCommand` call twice. // First time in `SendOnLanguageChangeToMobile` diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h index 05cb80c989..1980ffa100 100644 --- a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h @@ -36,7 +36,7 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" #include "application_manager/test/include/application_manager/commands/commands_test.h" diff --git a/src/components/application_manager/test/include/application_manager/commands/commands_test.h b/src/components/application_manager/test/include/application_manager/commands/commands_test.h index ddd0db2cbe..a93e33b373 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -36,10 +36,10 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/command.h" -#include "utils/make_shared.h" + #include "application_manager/mock_application_manager.h" #include "test/application_manager/mock_application_manager_settings.h" #include "application_manager/test/include/application_manager/mock_hmi_interface.h" @@ -60,7 +60,7 @@ using ::testing::NiceMock; using ::testing::Mock; using ::testing::_; -using ::utils::SharedPtr; + using ::smart_objects::SmartObject; using am::commands::MessageSharedPtr; using ::test::components::application_manager_test::MockApplicationManager; @@ -104,7 +104,7 @@ class CommandsTest : public ::testing::Test { typedef typename TypeIf<kIsNice, NiceMock<MockApplication>, MockApplication>::Result MockApp; - typedef SharedPtr<MockApp> MockAppPtr; + typedef std::shared_ptr<MockApp> MockAppPtr; virtual ~CommandsTest() { Mock::VerifyAndClearExpectations(&mock_message_helper_); @@ -112,18 +112,18 @@ class CommandsTest : public ::testing::Test { static MessageSharedPtr CreateMessage( const smart_objects::SmartType type = smart_objects::SmartType_Null) { - return ::utils::MakeShared<SmartObject>(type); + return std::make_shared<SmartObject>(type); } static MockAppPtr CreateMockApp() { - return ::utils::MakeShared<MockApp>(); + return std::make_shared<MockApp>(); } template <class Command> - SharedPtr<Command> CreateCommand(const uint32_t timeout, + std::shared_ptr<Command> CreateCommand(const uint32_t timeout, MessageSharedPtr& msg) { InitCommand(timeout); - return ::utils::MakeShared<Command>((msg ? msg : msg = CreateMessage()), + return std::make_shared<Command>((msg ? msg : msg = CreateMessage()), app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, @@ -131,15 +131,15 @@ class CommandsTest : public ::testing::Test { } template <class Command> - SharedPtr<Command> CreateCommand(MessageSharedPtr& msg) { + std::shared_ptr<Command> CreateCommand(MessageSharedPtr& msg) { return CreateCommand<Command>(kDefaultTimeout_, msg); } template <class Command> - SharedPtr<Command> CreateCommand(const uint32_t timeout = kDefaultTimeout_) { + std::shared_ptr<Command> CreateCommand(const uint32_t timeout = kDefaultTimeout_) { InitCommand(timeout); MessageSharedPtr msg = CreateMessage(); - return ::utils::MakeShared<Command>(msg, + return std::make_shared<Command>(msg, app_mngr_, mock_rpc_service_, mock_hmi_capabilities_, diff --git a/src/components/application_manager/test/include/application_manager/mock_command_factory.h b/src/components/application_manager/test/include/application_manager/mock_command_factory.h index a55183e341..cb48f2220e 100644 --- a/src/components/application_manager/test/include/application_manager/mock_command_factory.h +++ b/src/components/application_manager/test/include/application_manager/mock_command_factory.h @@ -37,7 +37,7 @@ #include "application_manager/command_factory.h" #include "application_manager/commands/command.h" #include "smart_objects/smart_object.h" -#include "utils/shared_ptr.h" + namespace test { namespace components { diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h index 907d0c26f2..3c4a3806d6 100644 --- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h +++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h @@ -96,7 +96,7 @@ class MockResumeCtrl : public resumption::ResumeCtrl { #ifdef BUILD_TESTS MOCK_METHOD1(set_resumption_storage, - void(utils::SharedPtr<resumption::ResumptionData> mock_storage)); + void(std::shared_ptr<resumption::ResumptionData> mock_storage)); MOCK_CONST_METHOD0(get_resumption_active, bool()); #endif // BUILD_TESTS }; diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h index 0d34c113b2..4f8c9fd25e 100644 --- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h +++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h @@ -79,7 +79,7 @@ class ResumptionDataTest : public ::testing::Test { void CheckSavedApp(sm::SmartObject& saved_data); // Set data for resumption virtual void PrepareData(); - utils::SharedPtr<NiceMock<application_manager_test::MockApplication> > + std::shared_ptr<NiceMock<application_manager_test::MockApplication> > app_mock; profile::Profile profile_; @@ -152,7 +152,7 @@ class ResumptionDataTest : public ::testing::Test { application_manager_test::MockApplicationManagerSettings mock_application_manager_settings_; application_manager_test::MockApplicationManager mock_application_manager_; - utils::SharedPtr<NiceMock<application_manager_test::MockAppExtension> > + std::shared_ptr<NiceMock<application_manager_test::MockAppExtension> > mock_app_extension_; std::list<application_manager::AppExtensionPtr> extensions_; }; diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc index 0e48d39e24..39bd5f4d4d 100644 --- a/src/components/application_manager/test/message_helper/message_helper_test.cc +++ b/src/components/application_manager/test/message_helper/message_helper_test.cc @@ -35,7 +35,7 @@ #include "gmock/gmock.h" #include "utils/macro.h" -#include "utils/make_shared.h" + #include "application_manager/policies/policy_handler.h" #include "application_manager/mock_application.h" #include "application_manager/mock_help_prompt_manager.h" @@ -63,9 +63,9 @@ namespace MobileResults = mobile_apis::Result; using namespace application_manager; -typedef utils::SharedPtr<MockApplication> MockApplicationSharedPtr; +typedef std::shared_ptr<MockApplication> MockApplicationSharedPtr; typedef std::vector<std::string> StringArray; -typedef utils::SharedPtr<application_manager::Application> ApplicationSharedPtr; +typedef std::shared_ptr<application_manager::Application> ApplicationSharedPtr; using testing::AtLeast; using testing::ReturnRefOfCopy; @@ -87,7 +87,7 @@ TEST(MessageHelperTestCreate, application_manager::MessageHelper::CreateBlockedByPoliciesResponse( function_id, result, correlation_id, connection_key); - EXPECT_TRUE(ptr); + EXPECT_TRUE((bool)ptr); smart_objects::SmartObject& obj = *ptr; @@ -109,7 +109,7 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendNullPathImagetype_Equal) { smart_objects::SmartObjectSPtr ptr = MessageHelper::CreateSetAppIcon(path_to_icon, app_id); - EXPECT_TRUE(ptr); + EXPECT_TRUE((bool)ptr); smart_objects::SmartObject& obj = *ptr; @@ -128,7 +128,7 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendPathImagetype_Equal) { smart_objects::SmartObjectSPtr ptr = MessageHelper::CreateSetAppIcon(path_to_icon, app_id); - EXPECT_TRUE(ptr); + EXPECT_TRUE((bool)ptr); smart_objects::SmartObject& obj = *ptr; @@ -143,7 +143,7 @@ TEST(MessageHelperTestCreate, CreateSetAppIcon_SendPathImagetype_Equal) { TEST(MessageHelperTestCreate, CreateGlobalPropertiesRequestsToHMI_SmartObject_EmptyList) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); EXPECT_CALL(*appSharedMock, vr_help_title()).Times(AtLeast(1)); EXPECT_CALL(*appSharedMock, vr_help()).Times(AtLeast(1)); EXPECT_CALL(*appSharedMock, help_prompt()).Times(AtLeast(1)); @@ -164,9 +164,9 @@ TEST(MessageHelperTestCreate, TEST(MessageHelperTestCreate, CreateGlobalPropertiesRequestsToHMI_SmartObject_NotEmpty) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); smart_objects::SmartObjectSPtr objPtr = - MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*objPtr)[0][strings::vr_help_title] = "111"; (*objPtr)[1][strings::vr_help] = "222"; @@ -225,10 +225,10 @@ TEST(MessageHelperTestCreate, } TEST(MessageHelperTestCreate, CreateShowRequestToHMI_SendSmartObject_Equal) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); smart_objects::SmartObjectSPtr smartObjectPtr = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); const smart_objects::SmartObject& object = *smartObjectPtr; @@ -251,7 +251,7 @@ TEST(MessageHelperTestCreate, CreateShowRequestToHMI_SendSmartObject_Equal) { TEST(MessageHelperTestCreate, CreateAddCommandRequestToHMI_SendSmartObject_Empty) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); ::application_manager::CommandsMap vis; DataAccessor<application_manager::CommandsMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); @@ -267,12 +267,12 @@ TEST(MessageHelperTestCreate, TEST(MessageHelperTestCreate, CreateAddCommandRequestToHMI_SendSmartObject_Equal) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); CommandsMap vis; DataAccessor<CommandsMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); smart_objects::SmartObjectSPtr smartObjectPtr = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& object = *smartObjectPtr; @@ -309,7 +309,7 @@ TEST(MessageHelperTestCreate, TEST(MessageHelperTestCreate, CreateAddVRCommandRequestFromChoiceToHMI_SendEmptyData_EmptyList) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); application_manager::ChoiceSetMap vis; DataAccessor< ::application_manager::ChoiceSetMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); @@ -325,12 +325,12 @@ TEST(MessageHelperTestCreate, TEST(MessageHelperTestCreate, CreateAddVRCommandRequestFromChoiceToHMI_SendObject_EqualList) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); application_manager::ChoiceSetMap vis; DataAccessor< ::application_manager::ChoiceSetMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); smart_objects::SmartObjectSPtr smartObjectPtr = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& object = *smartObjectPtr; @@ -372,12 +372,12 @@ TEST(MessageHelperTestCreate, } TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); application_manager::SubMenuMap vis; DataAccessor< ::application_manager::SubMenuMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); smart_objects::SmartObjectSPtr smartObjectPtr = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); smart_objects::SmartObject& object = *smartObjectPtr; @@ -412,7 +412,7 @@ TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) { TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendEmptyMap_EmptySmartObjectList) { - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); application_manager::SubMenuMap vis; DataAccessor< ::application_manager::SubMenuMap> data_accessor( vis, std::make_shared<sync_primitives::Lock>(true)); @@ -435,7 +435,7 @@ TEST(MessageHelperTestCreate, CreateNegativeResponse_SendSmartObject_Equal) { smart_objects::SmartObjectSPtr ptr = MessageHelper::CreateNegativeResponse( connection_key, function_id, correlation_id, result_code); - EXPECT_TRUE(ptr); + EXPECT_TRUE((bool)ptr); smart_objects::SmartObject& obj = *ptr; @@ -732,8 +732,8 @@ TEST_F(MessageHelperTest, VerifySoftButtonString_CorrectStrings_True) { TEST_F(MessageHelperTest, ProcessSoftButtons_SmartObjectWithoutButtonsKey_Success) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject object; policy_handler_test::MockPolicySettings policy_settings_; @@ -748,8 +748,8 @@ TEST_F(MessageHelperTest, TEST_F(MessageHelperTest, ProcessSoftButtons_IncorectSoftButonValue_InvalidData) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject object; smart_objects::SmartObject& buttons = object[strings::soft_buttons]; @@ -766,8 +766,8 @@ TEST_F(MessageHelperTest, } TEST_F(MessageHelperTest, VerifyImage_ImageTypeIsStatic_Success) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject image; image[strings::image_type] = mobile_apis::ImageType::STATIC; @@ -779,8 +779,8 @@ TEST_F(MessageHelperTest, VerifyImage_ImageTypeIsStatic_Success) { } TEST_F(MessageHelperTest, VerifyImage_ImageValueNotValid_InvalidData) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject image; image[strings::image_type] = mobile_apis::ImageType::DYNAMIC; @@ -794,8 +794,8 @@ TEST_F(MessageHelperTest, VerifyImage_ImageValueNotValid_InvalidData) { } TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageTypeIsStatic_Success) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject image; image[strings::image_type] = mobile_apis::ImageType::STATIC; @@ -809,8 +809,8 @@ TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageTypeIsStatic_Success) { } TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageValueNotValid_InvalidData) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject image; image[strings::image_type] = mobile_apis::ImageType::DYNAMIC; @@ -824,8 +824,8 @@ TEST_F(MessageHelperTest, VerifyImageApplyPath_ImageValueNotValid_InvalidData) { } TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithValidData_Success) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject images; images[0][strings::image_type] = mobile_apis::ImageType::STATIC; @@ -839,8 +839,8 @@ TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithValidData_Success) { TEST_F(MessageHelperTest, VerifyImageFiles_SmartObjectWithInvalidData_NotSuccsess) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject images; images[0][strings::image_type] = mobile_apis::ImageType::DYNAMIC; @@ -857,8 +857,8 @@ TEST_F(MessageHelperTest, TEST_F(MessageHelperTest, VerifyImageVrHelpItems_SmartObjectWithSeveralValidImages_Succsess) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject message; message[0][strings::image][strings::image_type] = @@ -874,8 +874,8 @@ TEST_F(MessageHelperTest, TEST_F(MessageHelperTest, VerifyImageVrHelpItems_SmartObjWithSeveralInvalidImages_NotSuccsess) { - // Creating sharedPtr to MockApplication - MockApplicationSharedPtr appSharedMock = utils::MakeShared<MockApplication>(); + // Creating std::shared_ptr to MockApplication + MockApplicationSharedPtr appSharedMock = std::make_shared<MockApplication>(); // Creating input data for method smart_objects::SmartObject message; message[0][strings::image][strings::image_type] = @@ -936,7 +936,7 @@ TEST_F(MessageHelperTest, StringToHmiLevel_LevelString_EqEType) { TEST_F(MessageHelperTest, SubscribeApplicationToSoftButton_CallFromApp) { // Create application mock - MockApplicationSharedPtr appSharedPtr = utils::MakeShared<MockApplication>(); + MockApplicationSharedPtr appSharedPtr = std::make_shared<MockApplication>(); // Prepare data for method smart_objects::SmartObject message_params; size_t function_id = 1; diff --git a/src/components/application_manager/test/mobile_message_handler_test.cc b/src/components/application_manager/test/mobile_message_handler_test.cc index 2fe28d8249..2122dc463e 100644 --- a/src/components/application_manager/test/mobile_message_handler_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_test.cc @@ -41,7 +41,7 @@ #include "gmock/gmock.h" #include "application_manager/message.h" #include "protocol/raw_message.h" -#include "utils/make_shared.h" + namespace test { namespace components { @@ -106,7 +106,7 @@ class MobileMessageHandlerTest : public testing::Test { size_t full_size = sizeof(uint8_t) * full_data.size(); - message_ptr_ = utils::MakeShared<RawMessage>(connection_key_, + message_ptr_ = std::make_shared<RawMessage>(connection_key_, protocol_version, &full_data[0], full_size, @@ -170,7 +170,7 @@ class MobileMessageHandlerTest : public testing::Test { uint32_t connection_key, const std::string& json_msg, const application_manager::BinaryData* data = NULL) { - MobileMessage message = utils::MakeShared<Message>( + MobileMessage message = std::make_shared<Message>( MessagePriority::FromServiceType(ServiceType::kRpc)); message->set_function_id(function_id); message->set_correlation_id(correlation_id); @@ -254,7 +254,7 @@ class MobileMessageHandlerTest : public testing::Test { TEST(mobile_message_test, basic_test) { // Example message MobileMessage message = - utils::MakeShared<Message>(protocol_handler::MessagePriority::kDefault); + std::make_shared<Message>(protocol_handler::MessagePriority::kDefault); EXPECT_FALSE(message->has_binary_data()); application_manager::BinaryData binary_data; binary_data.push_back('X'); diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc index a19ea991b9..72edf741f9 100644 --- a/src/components/application_manager/test/mobile_message_handler_v1_test.cc +++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc @@ -40,7 +40,7 @@ #include "gmock/gmock.h" #include "application_manager/message.h" #include "protocol/raw_message.h" -#include "utils/make_shared.h" + using protocol_handler::RawMessage; using protocol_handler::RawMessagePtr; @@ -70,7 +70,7 @@ const unsigned char* data_v1 = TEST(MobileMessageHandlerTestV1Test, HandleIncomingMessageProtocolV1_SendJSONData_ExpectEqual) { - RawMessagePtr message = utils::MakeShared<RawMessage>( + RawMessagePtr message = std::make_shared<RawMessage>( connection_key_p1, protocol_version_1, data_v1, data_json.length()); application_manager::Message* ptr = @@ -90,7 +90,7 @@ TEST(MobileMessageHandlerTestV1Test, const unsigned char* data_v1 = reinterpret_cast<const unsigned char*>(full_data.c_str()); - RawMessagePtr message = utils::MakeShared<RawMessage>( + RawMessagePtr message = std::make_shared<RawMessage>( connection_key_p1, protocol_version_1, data_v1, full_data.length()); application_manager::Message* ptr = @@ -108,7 +108,7 @@ TEST(MobileMessageHandlerTestV1Test, uint32_t connection_key = 1; application_manager::MobileMessage message = - utils::MakeShared<application_manager::Message>( + std::make_shared<application_manager::Message>( protocol_handler::MessagePriority::kDefault); message->set_protocol_version( diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc index 57fa67bf0a..c7baac7923 100644 --- a/src/components/application_manager/test/policy_handler_test.cc +++ b/src/components/application_manager/test/policy_handler_test.cc @@ -53,13 +53,13 @@ #include "json/value.h" #include "smart_objects/smart_object.h" #include "utils/file_system.h" -#include "utils/make_shared.h" + #include "utils/custom_string.h" #include "policy/usage_statistics/counter.h" #include "policy/usage_statistics/statistics_manager.h" #include "interfaces/MOBILE_API.h" #include "policy/mock_policy_settings.h" -#include "utils/make_shared.h" + #include "application_manager/mock_application.h" #include "policy/usage_statistics/mock_statistics_manager.h" #include "protocol_handler/mock_session_observer.h" @@ -134,14 +134,14 @@ class PolicyHandlerTest : public ::testing::Test { protected: NiceMock<MockPolicySettings> policy_settings_; NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_; - utils::SharedPtr<application_manager_test::MockApplication> mock_app_; + std::shared_ptr<application_manager_test::MockApplication> mock_app_; connection_handler_test::MockConnectionHandler conn_handler; protocol_handler_test::MockSessionObserver mock_session_observer; application_manager_test::MockStateController mock_state_controller; components::usage_statistics_test::MockStatisticsManager mock_statistics_manager_; PolicyHandler policy_handler_; - utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_; + std::shared_ptr<policy_manager_test::MockPolicyManager> mock_policy_manager_; application_manager_test::MockApplicationManager app_manager_; const std::string kPolicyAppId_; const std::string kMacAddr_; @@ -179,15 +179,15 @@ class PolicyHandlerTest : public ::testing::Test { std::string path = file_system::CreateDirectory("storage"); file_system::CreateFile(path + "/" + "certificate"); mock_policy_manager_ = - utils::MakeShared<policy_manager_test::MockPolicyManager>(); - ASSERT_TRUE(mock_policy_manager_.valid()); + std::make_shared<policy_manager_test::MockPolicyManager>(); + ASSERT_TRUE(mock_policy_manager_.use_count() != 0); ON_CALL(app_manager_, connection_handler()) .WillByDefault(ReturnRef(conn_handler)); ON_CALL(conn_handler, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer)); - mock_app_ = utils::MakeShared<application_manager_test::MockApplication>(); + mock_app_ = std::make_shared<application_manager_test::MockApplication>(); } virtual void TearDown() OVERRIDE { @@ -444,7 +444,7 @@ TEST_F(PolicyHandlerTest, OnPermissionsUpdated_method_With2Parameters) { } TEST_F(PolicyHandlerTest, OnPermissionsUpdated_TwoParams_InvalidApp_UNSUCCESS) { - utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + std::shared_ptr<application_manager_test::MockApplication> invalid_app; EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) .WillOnce(Return(invalid_app)); EXPECT_CALL(mock_message_helper_, @@ -455,7 +455,7 @@ TEST_F(PolicyHandlerTest, OnPermissionsUpdated_TwoParams_InvalidApp_UNSUCCESS) { } TEST_F(PolicyHandlerTest, OnPermissionsUpdated_InvalidApp_UNSUCCESS) { - utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + std::shared_ptr<application_manager_test::MockApplication> invalid_app; EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) .WillOnce(Return(mock_app_)) .WillOnce(Return(invalid_app)); @@ -774,8 +774,8 @@ TEST_F(PolicyHandlerTest, KmsChanged) { void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key, const uint32_t correlation_id) { - utils::SharedPtr<application_manager_test::MockApplication> application1 = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> application1 = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(app_manager_, ActivateApplication(_)) .WillRepeatedly(Return(true)); EXPECT_CALL(app_manager_, application(connection_key)) @@ -791,12 +791,12 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key, .WillRepeatedly(ReturnRef(conn_handler)); EXPECT_CALL(conn_handler, get_session_observer()) .WillOnce(ReturnRef(mock_session_observer)); - utils::SharedPtr<usage_statistics_test::MockStatisticsManager> + std::shared_ptr<usage_statistics_test::MockStatisticsManager> mock_statistics_manager = - utils::MakeShared<usage_statistics_test::MockStatisticsManager>(); + std::make_shared<usage_statistics_test::MockStatisticsManager>(); UsageStatistics usage_stats( "0", - utils::SharedPtr<usage_statistics::StatisticsManager>( + std::shared_ptr<usage_statistics::StatisticsManager>( mock_statistics_manager)); EXPECT_CALL(*application1, usage_report()).WillOnce(ReturnRef(usage_stats)); EXPECT_CALL(*mock_policy_manager_, GetUserConsentForDevice(_)) @@ -839,7 +839,7 @@ TEST_F(PolicyHandlerTest, OnActivateApp) { TEST_F(PolicyHandlerTest, OnActivateApp_InvalidApp_UNSUCCESS) { // Arrange EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + std::shared_ptr<application_manager_test::MockApplication> invalid_app; EXPECT_CALL(app_manager_, application(kConnectionKey_)) .WillOnce(Return(invalid_app)); @@ -859,12 +859,12 @@ TEST_F(PolicyHandlerTest, OnActivateApp_AppIsRevoked_AppNotActivated) { permissions.appRevoked = true; #ifdef EXTERNAL_PROPRIETARY_MODE - utils::SharedPtr<usage_statistics_test::MockStatisticsManager> + std::shared_ptr<usage_statistics_test::MockStatisticsManager> mock_statistics_manager = - utils::MakeShared<usage_statistics_test::MockStatisticsManager>(); + std::make_shared<usage_statistics_test::MockStatisticsManager>(); UsageStatistics usage_stats( "0", - utils::SharedPtr<usage_statistics::StatisticsManager>( + std::shared_ptr<usage_statistics::StatisticsManager>( mock_statistics_manager)); EXPECT_CALL(*mock_app_, usage_report()).WillOnce(ReturnRef(usage_stats)); const std::string default_mac = "00:00:00:00:00:00"; @@ -898,8 +898,8 @@ void PolicyHandlerTest::OnPendingPermissionChangePrecondition( // Arrange EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> application = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> application = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) .WillOnce(Return(application)); @@ -998,7 +998,7 @@ TEST_F(PolicyHandlerTest, permissions.appUnauthorized = true; NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message = - utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(); + std::make_shared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(); // Check expectations EXPECT_CALL(mock_message_helper_, SendOnAppPermissionsChangedNotification(kAppId1_, _, _)); @@ -1051,7 +1051,7 @@ TEST_F(PolicyHandlerTest, permissions.appUnauthorized = true; NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr message = - utils::MakeShared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(); + std::make_shared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(); // Check expectations // Notification won't be sent EXPECT_CALL(mock_message_helper_, @@ -1168,8 +1168,8 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) { // Arrange EnablePolicyAndPolicyManagerMock(); // Check expectations - utils::SharedPtr<application_manager_test::MockApplication> application = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> application = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) .WillOnce(Return(application)); EXPECT_CALL(app_manager_, connection_handler()) @@ -1271,8 +1271,8 @@ TEST_F(PolicyHandlerTest, GetAppName) { // Check expectations const CustomString app_name("my_mobile_app"); - utils::SharedPtr<application_manager_test::MockApplication> application = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> application = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*application, name()).WillOnce(ReturnRef(app_name)); EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) @@ -1309,8 +1309,8 @@ TEST_F(PolicyHandlerTest, SendOnAppPermissionsChanged) { // Arrange EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> application = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> application = + std::make_shared<application_manager_test::MockApplication>(); // Check expectations EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_)) .WillOnce(Return(application)); @@ -1337,7 +1337,7 @@ TEST_F(PolicyHandlerTest, AddApplication) { EXPECT_CALL( *mock_policy_manager_, AddApplication(kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT))) - .WillOnce(Return(utils::MakeShared<utils::CallNothing>())); + .WillOnce(Return(std::make_shared<utils::CallNothing>())); // Act policy_handler_.AddApplication(kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT)); @@ -1953,8 +1953,8 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { // Arrange EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> mock_app_in_full = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_full = + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_full_id = 1; EXPECT_CALL(*mock_app_in_full, app_id()) .WillRepeatedly(Return(app_in_full_id)); @@ -1964,9 +1964,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { test_app.insert(mock_app_in_full); - utils::SharedPtr<application_manager_test::MockApplication> + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_limited = - utils::MakeShared<application_manager_test::MockApplication>(); + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_limited_id = 2; EXPECT_CALL(*mock_app_in_limited, app_id()) .WillRepeatedly(Return(app_in_limited_id)); @@ -1976,9 +1976,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { test_app.insert(mock_app_in_limited); - utils::SharedPtr<application_manager_test::MockApplication> + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_background = - utils::MakeShared<application_manager_test::MockApplication>(); + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_background_id = 3; EXPECT_CALL(*mock_app_in_background, app_id()) .WillRepeatedly(Return(app_in_background_id)); @@ -1988,8 +1988,8 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) { test_app.insert(mock_app_in_background); - utils::SharedPtr<application_manager_test::MockApplication> mock_app_in_none = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_none = + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_none_id = 4; EXPECT_CALL(*mock_app_in_none, app_id()) .WillRepeatedly(Return(app_in_none_id)); @@ -2017,9 +2017,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { // Arrange EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_none_1 = - utils::MakeShared<application_manager_test::MockApplication>(); + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_none_id_1 = 1; EXPECT_CALL(*mock_app_in_none_1, app_id()) .WillRepeatedly(Return(app_in_none_id_1)); @@ -2029,9 +2029,9 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) { test_app.insert(mock_app_in_none_1); - utils::SharedPtr<application_manager_test::MockApplication> + std::shared_ptr<application_manager_test::MockApplication> mock_app_in_none_2 = - utils::MakeShared<application_manager_test::MockApplication>(); + std::make_shared<application_manager_test::MockApplication>(); const uint32_t app_in_none_id_2 = 2; EXPECT_CALL(*mock_app_in_none_2, app_id()) .WillRepeatedly(Return(app_in_none_id_2)); @@ -2110,7 +2110,7 @@ TEST_F(PolicyHandlerTest, // with such id EXPECT_CALL(app_manager_, application(0)) .WillOnce(Return( - utils::SharedPtr<application_manager_test::MockApplication>())); + std::shared_ptr<application_manager_test::MockApplication>())); EXPECT_FALSE(policy_handler_.SendMessageToSDK(msg, url)); } @@ -2122,8 +2122,8 @@ TEST_F(PolicyHandlerTest, CanUpdate) { TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) { EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> second_mock_app = - utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> second_mock_app = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*mock_app_, hmi_level()) .WillOnce(Return(mobile_apis::HMILevel::HMI_FULL)); diff --git a/src/components/application_manager/test/rc_policy_handler_test.cc b/src/components/application_manager/test/rc_policy_handler_test.cc index 0d9cbfe6aa..b7caf635c9 100644 --- a/src/components/application_manager/test/rc_policy_handler_test.cc +++ b/src/components/application_manager/test/rc_policy_handler_test.cc @@ -46,7 +46,7 @@ #include "json/writer.h" #include "json/value.h" #include "smart_objects/smart_object.h" -#include "utils/make_shared.h" + #include "utils/custom_string.h" #include "interfaces/MOBILE_API.h" #include "policy/mock_policy_settings.h" @@ -94,13 +94,13 @@ class RCPolicyHandlerTest : public ::testing::Test { protected: NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; - utils::SharedPtr<application_manager_test::MockApplication> mock_app_; + std::shared_ptr<application_manager_test::MockApplication> mock_app_; connection_handler_test::MockConnectionHandler conn_handler; protocol_handler_test::MockSessionObserver mock_session_observer; components::usage_statistics_test::MockStatisticsManager mock_statistics_manager_; PolicyHandler policy_handler_; - utils::SharedPtr<policy_manager_test::MockPolicyManager> mock_policy_manager_; + std::shared_ptr<policy_manager_test::MockPolicyManager> mock_policy_manager_; application_manager_test::MockApplicationManager app_manager_; const std::string kPolicyAppId_; const std::string kMacAddr_; @@ -122,15 +122,15 @@ class RCPolicyHandlerTest : public ::testing::Test { ON_CALL(app_manager_, applications()).WillByDefault(Return(app_set)); ON_CALL(policy_settings_, enable_policy()).WillByDefault(Return(true)); mock_policy_manager_ = - utils::MakeShared<policy_manager_test::MockPolicyManager>(); - ASSERT_TRUE(mock_policy_manager_.valid()); + std::make_shared<policy_manager_test::MockPolicyManager>(); + ASSERT_TRUE(mock_policy_manager_.use_count() != 0); ON_CALL(app_manager_, connection_handler()) .WillByDefault(ReturnRef(conn_handler)); ON_CALL(conn_handler, get_session_observer()) .WillByDefault(ReturnRef(mock_session_observer)); - mock_app_ = utils::MakeShared<application_manager_test::MockApplication>(); + mock_app_ = std::make_shared<application_manager_test::MockApplication>(); } virtual void TearDown() OVERRIDE { @@ -206,7 +206,7 @@ TEST_F(RCPolicyHandlerTest, SendMessageToSDK_RemoteControl_SUCCESS) { TEST_F(RCPolicyHandlerTest, OnUpdateHMILevel_InvalidApp_UNSUCCESS) { EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + std::shared_ptr<application_manager_test::MockApplication> invalid_app; EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_)) .WillOnce(Return(invalid_app)); EXPECT_CALL(mock_message_helper_, StringToHMILevel(_)).Times(0); @@ -293,7 +293,7 @@ TEST_F(RCPolicyHandlerTest, TEST_F(RCPolicyHandlerTest, OnUpdateHMIStatus_InvalidApp_UNSUCCESS) { EnablePolicyAndPolicyManagerMock(); - utils::SharedPtr<application_manager_test::MockApplication> invalid_app; + std::shared_ptr<application_manager_test::MockApplication> invalid_app; EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(invalid_app)); EXPECT_CALL(app_manager_, ChangeAppsHMILevel(_, _)).Times(0); @@ -379,7 +379,7 @@ TEST_F(RCPolicyHandlerTest, CheckHMIType_ValidTypes_SUCCESS) { mobile_apis::AppHMIType::eType hmi = mobile_apis::AppHMIType::MEDIA; const smart_objects::SmartObjectSPtr app_types = - utils::MakeShared<smart_objects::SmartObject>( + std::make_shared<smart_objects::SmartObject>( smart_objects::SmartType_Array); (*app_types)[strings::app_hmi_type][0] = mobile_apis::AppHMIType::MEDIA; (*app_types)[strings::app_hmi_type][1] = diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc index c2912fdc0b..112e3c1c39 100644 --- a/src/components/application_manager/test/request_controller/request_controller_test.cc +++ b/src/components/application_manager/test/request_controller/request_controller_test.cc @@ -36,12 +36,12 @@ #include "application_manager/request_controller.h" #include "application_manager/request_info.h" #include "application_manager/mock_request.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/commands/command_request_impl.h" #include "application_manager/message_helper.h" #include "application_manager/application_impl.h" -#include "utils/make_shared.h" + #include "application_manager/mock_application_manager.h" #include "application_manager/event_engine/event_dispatcher.h" #include "resumption/last_state.h" @@ -65,8 +65,8 @@ using ::testing::NiceMock; using ::testing::_; typedef NiceMock<application_manager_test::MockRequest> MRequest; -typedef utils::SharedPtr<MRequest> RequestPtr; -typedef utils::SharedPtr<RequestController> RequestControllerSPtr; +typedef std::shared_ptr<MRequest> RequestPtr; +typedef std::shared_ptr<RequestController> RequestControllerSPtr; namespace { const size_t kNumberOfRequests = 10u; @@ -105,7 +105,7 @@ class RequestControllerTestClass : public ::testing::Test { ON_CALL(mock_request_controller_settings_, thread_pool_size()) .WillByDefault(Return(kThreadPoolSize)); request_ctrl_ = - utils::MakeShared<RequestController>(mock_request_controller_settings_); + std::make_shared<RequestController>(mock_request_controller_settings_); } RequestPtr GetMockRequest( @@ -113,7 +113,7 @@ class RequestControllerTestClass : public ::testing::Test { const uint32_t connection_key = kDefaultConnectionKey, const uint32_t default_timeout = kDefaultTimeout) { RequestPtr output = - utils::MakeShared<MRequest>(connection_key, correlation_id); + std::make_shared<MRequest>(connection_key, correlation_id); ON_CALL(*output, default_timeout()).WillByDefault(Return(default_timeout)); ON_CALL(*output, CheckPermissions()).WillByDefault(Return(true)); return output; diff --git a/src/components/application_manager/test/request_info_test.cc b/src/components/application_manager/test/request_info_test.cc index 11b2d2f259..85cb4f3a37 100644 --- a/src/components/application_manager/test/request_info_test.cc +++ b/src/components/application_manager/test/request_info_test.cc @@ -36,8 +36,8 @@ #include <vector> #include <limits> #include "gmock/gmock.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + namespace request_info = application_manager::request_controller; @@ -76,26 +76,26 @@ class RequestInfoTest : public ::testing::Test { uint32_t default_timeout_; uint32_t mobile_correlation_id; - utils::SharedPtr<TestRequestInfo> CreateTestInfo( + std::shared_ptr<TestRequestInfo> CreateTestInfo( uint32_t connection_key, uint32_t correlation_id, request_info::RequestInfo::RequestType requst_type, const TimevalStruct& start_time, uint64_t timeout_msec) { - utils::SharedPtr<MockRequest> mock_request = - utils::MakeShared<MockRequest>(connection_key, correlation_id); - utils::SharedPtr<TestRequestInfo> request = - utils::MakeShared<TestRequestInfo>( + std::shared_ptr<MockRequest> mock_request = + std::make_shared<MockRequest>(connection_key, correlation_id); + std::shared_ptr<TestRequestInfo> request = + std::make_shared<TestRequestInfo>( mock_request, requst_type, start_time, timeout_msec); return request; } }; TEST_F(RequestInfoTest, RequestInfoEqualEndTime) { - std::vector<utils::SharedPtr<TestRequestInfo> > requests; + std::vector<std::shared_ptr<TestRequestInfo> > requests; const TimevalStruct& time = date_time::DateTime::getCurrentTime(); for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) { - utils::SharedPtr<TestRequestInfo> request = CreateTestInfo( + std::shared_ptr<TestRequestInfo> request = CreateTestInfo( i, i, request_info::RequestInfo::MobileRequest, time, default_timeout_); request->SetEndTime(time); EXPECT_TRUE(request_info_set_.Add(request)); @@ -105,7 +105,7 @@ TEST_F(RequestInfoTest, RequestInfoEqualEndTime) { TEST_F(RequestInfoTest, AddRemoveHMIRequests) { for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) { - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(hmi_connection_key_, i, request_info::RequestInfo::HMIRequest, @@ -119,11 +119,11 @@ TEST_F(RequestInfoTest, AddRemoveHMIRequests) { } TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) { - std::vector<utils::SharedPtr<TestRequestInfo> > requests; + std::vector<std::shared_ptr<TestRequestInfo> > requests; // Add hmi requests for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) { - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(hmi_connection_key_, i, request_info::RequestInfo::HMIRequest, @@ -135,7 +135,7 @@ TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) { EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size()); // Delete every request - std::vector<utils::SharedPtr<TestRequestInfo> >::iterator req_it = + std::vector<std::shared_ptr<TestRequestInfo> >::iterator req_it = requests.begin(); for (; req_it != requests.end(); ++req_it) { @@ -155,14 +155,14 @@ TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) { } TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequests) { - utils::SharedPtr<TestRequestInfo> mobile_request1 = + std::shared_ptr<TestRequestInfo> mobile_request1 = CreateTestInfo(mobile_connection_key1_, 12345, request_info::RequestInfo::MobileRequest, date_time::DateTime::getCurrentTime(), default_timeout_); EXPECT_TRUE(request_info_set_.Add(mobile_request1)); - utils::SharedPtr<TestRequestInfo> mobile_request2 = + std::shared_ptr<TestRequestInfo> mobile_request2 = CreateTestInfo(mobile_connection_key2_, 54321, request_info::RequestInfo::MobileRequest, @@ -175,11 +175,11 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequests) { } TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) { - std::vector<utils::SharedPtr<TestRequestInfo> > requests; + std::vector<std::shared_ptr<TestRequestInfo> > requests; const uint32_t count_of_mobile_request1 = 200; const uint32_t count_of_mobile_request2 = 100; for (uint32_t i = 0; i < count_of_mobile_request1; ++i) { - utils::SharedPtr<TestRequestInfo> mobile_request1 = + std::shared_ptr<TestRequestInfo> mobile_request1 = CreateTestInfo(mobile_connection_key1_, i, request_info::RequestInfo::MobileRequest, @@ -192,7 +192,7 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) { EXPECT_EQ(count_of_mobile_request1, request_info_set_.Size()); for (uint32_t i = 0; i < count_of_mobile_request2; ++i) { - utils::SharedPtr<TestRequestInfo> mobile_request2 = + std::shared_ptr<TestRequestInfo> mobile_request2 = CreateTestInfo(mobile_connection_key2_, i, request_info::RequestInfo::MobileRequest, @@ -214,7 +214,7 @@ TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) { TEST_F(RequestInfoTest, RequestInfoSetFront) { for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) { - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(mobile_connection_key1_, i, request_info::RequestInfo::HMIRequest, @@ -225,9 +225,9 @@ TEST_F(RequestInfoTest, RequestInfoSetFront) { for (uint32_t i = 1; i < count_of_requests_for_test_; ++i) { request_info::RequestInfoPtr request_info = request_info_set_.Front(); - EXPECT_TRUE(request_info.valid()); + EXPECT_TRUE(request_info.use_count() != 0); request_info = request_info_set_.FrontWithNotNullTimeout(); - EXPECT_TRUE(request_info.valid()); + EXPECT_TRUE(request_info.use_count() != 0); EXPECT_TRUE(request_info_set_.RemoveRequest(request_info)); } EXPECT_EQ(1u, request_info_set_.Size()); @@ -248,7 +248,7 @@ TEST_F(RequestInfoTest, RequestInfoSetFind) { appid_connection_id.end(); for (; req_it != end; ++req_it) { - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(req_it->first, req_it->second, request_info::RequestInfo::HMIRequest, @@ -259,16 +259,16 @@ TEST_F(RequestInfoTest, RequestInfoSetFind) { request_info::RequestInfoPtr request = request_info_set_.Find( count_of_requests_for_test_, count_of_requests_for_test_); - EXPECT_FALSE(request.valid()); + EXPECT_FALSE(request.use_count() != 0); req_it = appid_connection_id.begin(); for (; req_it != end; ++req_it) { request_info::RequestInfoPtr request = request_info_set_.Find(req_it->first, req_it->second); - EXPECT_TRUE(request.valid()); + EXPECT_TRUE(request.use_count() != 0); EXPECT_TRUE(request_info_set_.RemoveRequest(request)); request = request_info_set_.Find(req_it->first, req_it->second); - EXPECT_FALSE(request.valid()); + EXPECT_FALSE(request.use_count() != 0); } EXPECT_EQ(0u, request_info_set_.Size()); } @@ -277,7 +277,7 @@ TEST_F(RequestInfoTest, RequestInfoSetEqualHash) { request_info::RequestInfoSet request_info_set; const uint32_t connection_key = 65483; const uint32_t corr_id = 65483; - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(connection_key, corr_id, request_info::RequestInfo::HMIRequest, @@ -289,18 +289,18 @@ TEST_F(RequestInfoTest, RequestInfoSetEqualHash) { EXPECT_EQ(1u, request_info_set.Size()); request_info::RequestInfoPtr found = request_info_set.Find(connection_key, corr_id); - EXPECT_TRUE(found.valid()); + EXPECT_TRUE(found.use_count() != 0); EXPECT_TRUE(request_info_set.RemoveRequest(found)); EXPECT_EQ(0u, request_info_set.Size()); EXPECT_TRUE(request_info_set.Add(request)); EXPECT_FALSE(request_info_set.Add(request)); found = request_info_set.FrontWithNotNullTimeout(); - EXPECT_TRUE(found.valid()); + EXPECT_TRUE(found.use_count() != 0); EXPECT_TRUE(request_info_set.RemoveRequest(found)); found = request_info_set.FrontWithNotNullTimeout(); - EXPECT_FALSE(found.valid()); + EXPECT_FALSE(found.use_count() != 0); found = request_info_set.Front(); - EXPECT_FALSE(found.valid()); + EXPECT_FALSE(found.use_count() != 0); EXPECT_EQ(0u, request_info_set.Size()); } @@ -313,7 +313,7 @@ TEST_F(RequestInfoTest, EndTimeisExpired) { TimevalStruct expired = date_time::DateTime::getCurrentTime(); expired.tv_usec = std::numeric_limits<time_t>::max(); - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(mobile_connection_key1_, mobile_correlation_id, request_info::RequestInfo::MobileRequest, @@ -329,7 +329,7 @@ TEST_F(RequestInfoTest, EndTimeisExpired) { TEST_F(RequestInfoTest, UpdateEndTime) { TimevalStruct time = date_time::DateTime::getCurrentTime(); - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(mobile_connection_key1_, mobile_correlation_id, request_info::RequestInfo::MobileRequest, @@ -343,7 +343,7 @@ TEST_F(RequestInfoTest, UpdateEndTime) { TEST_F(RequestInfoTest, UpdateTimeOut) { TimevalStruct time = date_time::DateTime::getCurrentTime(); - utils::SharedPtr<TestRequestInfo> request = + std::shared_ptr<TestRequestInfo> request = CreateTestInfo(mobile_connection_key1_, mobile_correlation_id, request_info::RequestInfo::MobileRequest, diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc index f126e95e33..2a430ae655 100644 --- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc +++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc @@ -44,7 +44,7 @@ #include "application_manager/application_manager_impl.h" #include "application_manager/application.h" #include "utils/data_accessor.h" -#include "utils/make_shared.h" + #include "application_manager/mock_message_helper.h" #include "application_manager/mock_application_manager.h" #include "application_manager/mock_application_manager_settings.h" @@ -96,16 +96,16 @@ class ResumeCtrlTest : public ::testing::Test { ON_CALL(mock_app_mngr_, event_dispatcher()) .WillByDefault(ReturnRef(mock_event_dispatcher_)); mock_storage_ = - ::utils::MakeShared<NiceMock<resumption_test::MockResumptionData> >( + std::make_shared<NiceMock<resumption_test::MockResumptionData> >( mock_app_mngr_); - mock_app_ = utils::MakeShared<NiceMock<MockApplication> >(); + mock_app_ = std::make_shared<NiceMock<MockApplication> >(); mock_help_prompt_manager_ = std::shared_ptr<MockHelpPromptManager>(new MockHelpPromptManager()); - mock_app_extension_ = utils::MakeShared< + mock_app_extension_ = std::make_shared< NiceMock<application_manager_test::MockAppExtension> >(); const_app_ = static_cast<application_manager::ApplicationConstSharedPtr>(mock_app_); - res_ctrl_ = utils::MakeShared<ResumeCtrlImpl>(mock_app_mngr_); + res_ctrl_ = std::make_shared<ResumeCtrlImpl>(mock_app_mngr_); res_ctrl_->set_resumption_storage(mock_storage_); ON_CALL(mock_app_mngr_, state_controller()) @@ -154,13 +154,13 @@ class ResumeCtrlTest : public ::testing::Test { application_manager_test::MockApplicationManagerSettings mock_application_manager_settings_; application_manager_test::MockApplicationManager mock_app_mngr_; - utils::SharedPtr<NiceMock<application_manager_test::MockAppExtension> > + std::shared_ptr<NiceMock<application_manager_test::MockAppExtension> > mock_app_extension_; MockStateController mock_state_controller_; - utils::SharedPtr<ResumeCtrl> res_ctrl_; - utils::SharedPtr<NiceMock<resumption_test::MockResumptionData> > + std::shared_ptr<ResumeCtrl> res_ctrl_; + std::shared_ptr<NiceMock<resumption_test::MockResumptionData> > mock_storage_; - utils::SharedPtr<NiceMock<MockApplication> > mock_app_; + std::shared_ptr<NiceMock<MockApplication> > mock_app_; std::shared_ptr<MockHelpPromptManager> mock_help_prompt_manager_; application_manager::ApplicationConstSharedPtr const_app_; const uint32_t kTestAppId_; @@ -971,8 +971,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevDisallowed) { } TEST_F(ResumeCtrlTest, SaveAllApplications) { - utils::SharedPtr<application_manager_test::MockApplication> test_app = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> test_app = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*test_app, app_id()).WillRepeatedly(Return(kTestAppId_)); application_manager::ApplicationSet app_set; @@ -987,8 +987,8 @@ TEST_F(ResumeCtrlTest, SaveAllApplications) { } TEST_F(ResumeCtrlTest, SaveAllApplications_EmptyApplicationlist) { - utils::SharedPtr<application_manager::Application> mock_app = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager::Application> mock_app = + std::make_shared<application_manager_test::MockApplication>(); application_manager::ApplicationSet app_set; @@ -1001,8 +1001,8 @@ TEST_F(ResumeCtrlTest, SaveAllApplications_EmptyApplicationlist) { } TEST_F(ResumeCtrlTest, SaveApplication) { - utils::SharedPtr<application_manager::Application> app_sh_mock = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager::Application> app_sh_mock = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*mock_storage_, SaveApplication(app_sh_mock)); res_ctrl_->SaveApplication(app_sh_mock); @@ -1022,16 +1022,16 @@ TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionHasStarted) { const bool res = res_ctrl_->StartResumptionOnlyHMILevel(mock_app_); EXPECT_TRUE(res); - utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> app_sh_mock = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*app_sh_mock, app_id()).WillOnce(Return(kTestAppId_)); res_ctrl_->OnAppActivated(app_sh_mock); } TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionNotActive) { - utils::SharedPtr<application_manager_test::MockApplication> app_sh_mock = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager_test::MockApplication> app_sh_mock = + std::make_shared<application_manager_test::MockApplication>(); EXPECT_CALL(*app_sh_mock, app_id()).Times(0); res_ctrl_->OnAppActivated(app_sh_mock); } @@ -1137,8 +1137,8 @@ TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) { } TEST_F(ResumeCtrlTest, OnSuspend_EmptyApplicationlist) { - utils::SharedPtr<application_manager::Application> mock_app = - ::utils::MakeShared<application_manager_test::MockApplication>(); + std::shared_ptr<application_manager::Application> mock_app = + std::make_shared<application_manager_test::MockApplication>(); application_manager::ApplicationSet app_set; diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc index a75ba23bfb..953f43e056 100644 --- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc @@ -38,7 +38,7 @@ #include "interfaces/MOBILE_API.h" #include "utils/sqlite_wrapper/sql_database.h" #include "utils/sqlite_wrapper/sql_query.h" -#include "utils/make_shared.h" + #include "utils/file_system.h" #include "application_manager/resumption_data_test.h" #include "application_manager/test_resumption_data_db.h" @@ -68,7 +68,7 @@ const std::string kPath = class ResumptionDataDBTest : public ResumptionDataTest { protected: void SetUp() OVERRIDE { - app_mock = utils::MakeShared<NiceMock<MockApplication> >(); + app_mock = std::make_shared<NiceMock<MockApplication> >(); policy_app_id_ = "test_policy_app_id"; app_id_ = 10; is_audio_ = true; diff --git a/src/components/application_manager/test/resumption/resumption_data_json_test.cc b/src/components/application_manager/test/resumption/resumption_data_json_test.cc index ea257b902c..442aacb609 100644 --- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc @@ -69,7 +69,7 @@ class ResumptionDataJsonTest : public ResumptionDataTest { : last_state_("app_storage_folder", "app_info_storage") , res_json(last_state_, mock_application_manager_) {} virtual void SetUp() { - app_mock = new NiceMock<application_manager_test::MockApplication>(); + app_mock = std::make_shared<NiceMock<application_manager_test::MockApplication>>(); policy_app_id_ = "test_policy_app_id"; app_id_ = 10; diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc index e80349dd47..ced9ca84af 100644 --- a/src/components/application_manager/test/resumption/resumption_data_test.cc +++ b/src/components/application_manager/test/resumption/resumption_data_test.cc @@ -40,7 +40,7 @@ #include "application_manager/application.h" #include "utils/data_accessor.h" #include "application_manager/message_helper.h" -#include "utils/make_shared.h" + #include "application_manager/resumption_data_test.h" @@ -322,7 +322,7 @@ void ResumptionDataTest::CheckVRTitle( } void ResumptionDataTest::PrepareData() { - mock_app_extension_ = utils::MakeShared< + mock_app_extension_ = std::make_shared< NiceMock<application_manager_test::MockAppExtension> >(); extensions_.insert(extensions_.begin(), mock_app_extension_); ON_CALL(*app_mock, Extensions()).WillByDefault(ReturnRef(extensions_)); diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc index bbd7220bc9..001a4da3af 100644 --- a/src/components/application_manager/test/state_controller/state_controller_test.cc +++ b/src/components/application_manager/test/state_controller/state_controller_test.cc @@ -41,7 +41,7 @@ #include "transport_manager/mock_transport_manager.h" #include "utils/lock.h" #include "utils/data_accessor.h" -#include "utils/make_shared.h" + #include "application_manager/message_helper.h" #include "application_manager/event_engine/event.h" #include "application_manager/smart_object_keys.h" @@ -138,7 +138,7 @@ class StateControllerImplTest : public ::testing::Test { StateControllerImplTest() : ::testing::Test() , usage_stat("0", - utils::SharedPtr<usage_statistics::StatisticsManager>( + std::shared_ptr<usage_statistics::StatisticsManager>( new usage_statistics_test::MockStatisticsManager)) , applications_lock_ptr_(std::make_shared<sync_primitives::Lock>()) , applications_(application_set_, applications_lock_ptr_) @@ -164,7 +164,7 @@ class StateControllerImplTest : public ::testing::Test { am::ApplicationSet application_set_; mutable std::shared_ptr<sync_primitives::Lock> applications_lock_ptr_; DataAccessor<am::ApplicationSet> applications_; - utils::SharedPtr<am::StateControllerImpl> state_ctrl_; + std::shared_ptr<am::StateControllerImpl> state_ctrl_; am::ApplicationSharedPtr simple_app_; NiceMock<application_manager_test::MockApplication>* simple_app_ptr_; @@ -222,7 +222,7 @@ class StateControllerImplTest : public ::testing::Test { namespace SystemContext = mobile_apis::SystemContext; am::HmiStatePtr state = - utils::MakeShared<am::HmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::HmiState>(simple_app_, app_manager_mock_); state->set_hmi_level(hmi_level); state->set_audio_streaming_state(audio_ss); state->set_video_streaming_state(video_ss); @@ -242,7 +242,7 @@ class StateControllerImplTest : public ::testing::Test { const mobile_apis::SystemContext::eType system_context, const am::ApplicationSharedPtr app) { am::HmiStatePtr new_state = - utils::MakeShared<HmiStateType>(app, app_manager_mock_); + std::make_shared<HmiStateType>(app, app_manager_mock_); new_state->set_hmi_level(hmi_level); new_state->set_audio_streaming_state(audio_ss); @@ -647,9 +647,9 @@ class StateControllerImplTest : public ::testing::Test { app_type = AppType(app_id); app = (*it_begin); am::HmiStatePtr state_first = - utils::MakeShared<T>(app, app_manager_mock_); + std::make_shared<T>(app, app_manager_mock_); am::HmiStatePtr state_second = - utils::MakeShared<Q>(app, app_manager_mock_); + std::make_shared<Q>(app, app_manager_mock_); TestSetSeveralState( app, state_first, state_second, app_type, call_back_result); TestSetSeveralState( @@ -954,7 +954,7 @@ class StateControllerImplTest : public ::testing::Test { virtual void SetUp() OVERRIDE { ON_CALL(app_manager_mock_, event_dispatcher()) .WillByDefault(ReturnRef(mock_event_dispatcher_)); - state_ctrl_ = utils::MakeShared<am::StateControllerImpl>(app_manager_mock_); + state_ctrl_ = std::make_shared<am::StateControllerImpl>(app_manager_mock_); ON_CALL(app_manager_mock_, applications()) .WillByDefault(Return(applications_)); @@ -984,7 +984,7 @@ class StateControllerImplTest : public ::testing::Test { ON_CALL(app_manager_mock_, GetPolicyHandler()) .WillByDefault(ReturnRef(policy_interface_)); smart_objects::SmartObjectSPtr bc_activate_app_request = - new smart_objects::SmartObject(); + std::make_shared<smart_objects::SmartObject>(); (*bc_activate_app_request)[am::strings::params] [am::strings::correlation_id] = corr_id; ON_CALL(message_helper_mock_, @@ -1929,7 +1929,7 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) { std::vector<StateLevelPair>::iterator it = hmi_states.begin(); std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin(); smart_objects::SmartObjectSPtr bc_activate_app_request = - new smart_objects::SmartObject(); + std::make_shared<smart_objects::SmartObject>(); (*bc_activate_app_request)[am::strings::params][am::strings::correlation_id] = corr_id; @@ -2096,7 +2096,7 @@ TEST_F(StateControllerImplTest, ApplyTempStatesForMediaNaviVCApp) { TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) { am::HmiStatePtr state_phone_call = - utils::MakeShared<am::PhoneCallHmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::PhoneCallHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_phone_call, APP_TYPE_NON_MEDIA, @@ -2105,7 +2105,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForNonMediaApplication) { TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) { am::HmiStatePtr state_phone_call = - utils::MakeShared<am::PhoneCallHmiState>(media_app_, app_manager_mock_); + std::make_shared<am::PhoneCallHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_phone_call, APP_TYPE_MEDIA, @@ -2113,7 +2113,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaApplication) { } TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) { - am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>( + am::HmiStatePtr state_phone_call = std::make_shared<am::PhoneCallHmiState>( media_navi_app_, app_manager_mock_); TestSetState(media_navi_app_, state_phone_call, @@ -2123,7 +2123,7 @@ TEST_F(StateControllerImplTest, SetStatePhoneCallForMediaNaviApplication) { TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) { am::HmiStatePtr state_vr = - utils::MakeShared<am::VRHmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::VRHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_vr, APP_TYPE_NON_MEDIA, @@ -2132,7 +2132,7 @@ TEST_F(StateControllerImplTest, SetVRStateForNonMediaApplication) { TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) { am::HmiStatePtr state_vr = - utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_); + std::make_shared<am::VRHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_vr, APP_TYPE_MEDIA, @@ -2141,7 +2141,7 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaApplication) { TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) { am::HmiStatePtr state_vr = - utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); + std::make_shared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); TestSetState(media_navi_vc_app_, state_vr, APP_TYPE_MEDIA, @@ -2151,7 +2151,7 @@ TEST_F(StateControllerImplTest, SetVRStateForMediaNaviVoiceApplication) { TEST_F(StateControllerImplTest, SetTTSStateForNonMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(simple_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(simple_app_, @@ -2163,7 +2163,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForNonMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(simple_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(simple_app_, @@ -2175,7 +2175,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(media_app_, @@ -2187,7 +2187,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(media_app_, @@ -2199,7 +2199,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaNaviVCApplicationAttenuatedNotSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(media_navi_vc_app_, @@ -2211,7 +2211,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetTTSStateForMediaNaviVCApplicationAttenuatedSupported) { am::HmiStatePtr state_tts = - utils::MakeShared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); + std::make_shared<am::TTSHmiState>(media_navi_vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(media_navi_vc_app_, @@ -2222,7 +2222,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(simple_app_, + std::make_shared<am::VideoStreamingHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_navi_streming, @@ -2233,7 +2233,7 @@ TEST_F(StateControllerImplTest, SetNaviStreamingStateForNonMediaApplication) { TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(media_app_, + std::make_shared<am::VideoStreamingHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); @@ -2246,7 +2246,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateMediaApplicationAttenuatedSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(media_app_, + std::make_shared<am::VideoStreamingHmiState>(media_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); @@ -2259,7 +2259,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateVCApplicationAttenuatedNotSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_); + std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(false)); TestSetState(vc_app_, @@ -2271,7 +2271,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateVCApplicationAttenuatedSupported) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_); + std::make_shared<am::VideoStreamingHmiState>(vc_app_, app_manager_mock_); EXPECT_CALL(app_manager_mock_, is_attenuated_supported()) .WillRepeatedly(Return(true)); TestSetState(vc_app_, @@ -2282,7 +2282,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateNaviApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(navi_app_, + std::make_shared<am::VideoStreamingHmiState>(navi_app_, app_manager_mock_); TestSetState(navi_app_, state_navi_streming, @@ -2293,7 +2293,7 @@ TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateNaviApplication) { TEST_F(StateControllerImplTest, DISABLED_SetNaviStreamingStateMediaNaviApplication) { am::HmiStatePtr state_navi_streming = - utils::MakeShared<am::VideoStreamingHmiState>(media_navi_app_, + std::make_shared<am::VideoStreamingHmiState>(media_navi_app_, app_manager_mock_); TestSetState(media_navi_app_, state_navi_streming, @@ -2303,7 +2303,7 @@ TEST_F(StateControllerImplTest, TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) { am::HmiStatePtr state_safety_mode = - utils::MakeShared<am::SafetyModeHmiState>(simple_app_, app_manager_mock_); + std::make_shared<am::SafetyModeHmiState>(simple_app_, app_manager_mock_); TestSetState(simple_app_, state_safety_mode, APP_TYPE_NON_MEDIA, @@ -2312,7 +2312,7 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForNonMediaApplication) { TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) { am::HmiStatePtr state_safety_mode = - utils::MakeShared<am::VRHmiState>(media_app_, app_manager_mock_); + std::make_shared<am::VRHmiState>(media_app_, app_manager_mock_); TestSetState(media_app_, state_safety_mode, APP_TYPE_MEDIA, @@ -2322,7 +2322,7 @@ TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaApplication) { TEST_F(StateControllerImplTest, SetSafetyModeStateForMediaNaviVoiceApplication) { am::HmiStatePtr state_safety_mode = - utils::MakeShared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); + std::make_shared<am::VRHmiState>(media_navi_vc_app_, app_manager_mock_); TestSetState(media_navi_vc_app_, state_safety_mode, APP_TYPE_MEDIA, @@ -2956,7 +2956,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivated) { .WillRepeatedly(Return(true)); smart_objects::SmartObjectSPtr activate_app = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); (*activate_app)[am::strings::params][am::strings::correlation_id] = kCorrID; SetBCActivateAppRequestToHMI(hmi_apis::Common_HMILevel::FULL, kCorrID); state_ctrl_->on_event(event); diff --git a/src/components/application_manager/test/usage_statistics_test.cc b/src/components/application_manager/test/usage_statistics_test.cc index b07ce310e9..28e71f6f60 100644 --- a/src/components/application_manager/test/usage_statistics_test.cc +++ b/src/components/application_manager/test/usage_statistics_test.cc @@ -36,8 +36,8 @@ #include "smart_objects/enum_schema_item.h" #include "policy/usage_statistics/mock_statistics_manager.h" #include "policy/usage_statistics/mock_app_stopwatch.h" -#include "utils/make_shared.h" -#include "utils/shared_ptr.h" + + namespace test { namespace components { @@ -70,14 +70,14 @@ class UsageStatisticsTest : public testing::Test { public: UsageStatisticsTest() : mock_statistics_manager_sptr_( - utils::MakeShared<MockStatisticsManager>()) + std::make_shared<MockStatisticsManager>()) , usage_statistics_test_object1_sptr_( new application_manager::UsageStatistics( kAppId, mock_statistics_manager_sptr_)) , language_(LanguageIdToString(kTestLanguageId)) {} protected: - utils::SharedPtr<MockStatisticsManager> mock_statistics_manager_sptr_; + std::shared_ptr<MockStatisticsManager> mock_statistics_manager_sptr_; std::unique_ptr<application_manager::UsageStatistics> usage_statistics_test_object1_sptr_; const std::string language_; diff --git a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h index 8f5ee96ce5..934e4d5b08 100644 --- a/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h +++ b/src/components/formatters/test/include/formatters/SmartFactoryTestHelper.h @@ -107,9 +107,9 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType, protected: typedef std::map<const StructIdentifiersTest::eType, - utils::SharedPtr<ISchemaItem> > TStructsSchemaItems; + std::shared_ptr<ISchemaItem> > TStructsSchemaItems; - static utils::SharedPtr<ISchemaItem> ProvideObjectSchemaItemForStruct( + static std::shared_ptr<ISchemaItem> ProvideObjectSchemaItemForStruct( TStructsSchemaItems& struct_schema_items, const StructIdentifiersTest::eType struct_id); @@ -147,10 +147,10 @@ class CSmartFactoryTest : public CSmartFactory<FunctionIdTest::eType, const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items); - static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_1( + static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_1( TStructsSchemaItems& struct_schema_items); - static utils::SharedPtr<ISchemaItem> InitStructSchemaItem_Common_2(); + static std::shared_ptr<ISchemaItem> InitStructSchemaItem_Common_2(); }; } // namespace formatters diff --git a/src/components/formatters/test/src/SmartFactoryTestHelper.cc b/src/components/formatters/test/src/SmartFactoryTestHelper.cc index 2dd76f85f8..8c7716e9b4 100644 --- a/src/components/formatters/test/src/SmartFactoryTestHelper.cc +++ b/src/components/formatters/test/src/SmartFactoryTestHelper.cc @@ -148,7 +148,7 @@ CSmartFactoryTest::CSmartFactoryTest() void CSmartFactoryTest::InitStructSchemes( TStructsSchemaItems& struct_schema_items) { - utils::SharedPtr<ISchemaItem> struct_schema_item_Common_1 = + std::shared_ptr<ISchemaItem> struct_schema_item_Common_1 = InitStructSchemaItem_Common_1(struct_schema_items); struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_1, struct_schema_item_Common_1)); @@ -156,7 +156,7 @@ void CSmartFactoryTest::InitStructSchemes( std::make_pair(StructIdentifiersTest::Common_1, CSmartSchema(struct_schema_item_Common_1))); - utils::SharedPtr<ISchemaItem> struct_schema_item_Common_2 = + std::shared_ptr<ISchemaItem> struct_schema_item_Common_2 = InitStructSchemaItem_Common_2(); struct_schema_items.insert(std::make_pair(StructIdentifiersTest::Common_2, struct_schema_item_Common_2)); @@ -269,7 +269,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function1_response( const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items) { // Function parameter available. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -333,7 +333,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function2_response( const std::set<FunctionIdTest::eType>& function_id_items, const std::set<MessageTypeTest::eType>& message_type_items) { // Function parameter available. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -399,7 +399,7 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function3_response( // Function parameter available. // // Must be true if VR is present and ready to communicate with SDL. - utils::SharedPtr<ISchemaItem> available_SchemaItem = + std::shared_ptr<ISchemaItem> available_SchemaItem = CBoolSchemaItem::create(TSchemaItemParameter<bool>()); CObjectSchemaItem::Members schema_members; @@ -431,12 +431,12 @@ CSmartSchema CSmartFactoryTest::InitFunction_Function3_response( return CSmartSchema(CObjectSchemaItem::create(root_members_map)); } -utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( +std::shared_ptr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( TStructsSchemaItems& struct_schema_items) { // Struct member text. // // Text to display - utils::SharedPtr<ISchemaItem> text_SchemaItem = + std::shared_ptr<ISchemaItem> text_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(1), TSchemaItemParameter<size_t>(500), TSchemaItemParameter<std::string>()); @@ -444,14 +444,14 @@ utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( // Struct member image. // // Image struct - utils::SharedPtr<ISchemaItem> image_SchemaItem = + std::shared_ptr<ISchemaItem> image_SchemaItem = ProvideObjectSchemaItemForStruct(struct_schema_items, StructIdentifiersTest::Common_2); // Struct member position. // // Position to display item - utils::SharedPtr<ISchemaItem> position_SchemaItem = + std::shared_ptr<ISchemaItem> position_SchemaItem = TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1), TSchemaItemParameter<int32_t>(500), TSchemaItemParameter<int32_t>()); @@ -472,19 +472,19 @@ utils::SharedPtr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_1( return CObjectSchemaItem::create(schema_members); } -utils::SharedPtr<ISchemaItem> +std::shared_ptr<ISchemaItem> CSmartFactoryTest::InitStructSchemaItem_Common_2() { // Struct member text. // // Text to display - utils::SharedPtr<ISchemaItem> text_SchemaItem = + std::shared_ptr<ISchemaItem> text_SchemaItem = CStringSchemaItem::create(TSchemaItemParameter<size_t>(1), TSchemaItemParameter<size_t>(500), TSchemaItemParameter<std::string>()); // Struct member position. // // Position to display item - utils::SharedPtr<ISchemaItem> position_SchemaItem = + std::shared_ptr<ISchemaItem> position_SchemaItem = TNumberSchemaItem<int32_t>::create(TSchemaItemParameter<int32_t>(1), TSchemaItemParameter<int32_t>(500), TSchemaItemParameter<int32_t>()); @@ -497,7 +497,7 @@ CSmartFactoryTest::InitStructSchemaItem_Common_2() { return CObjectSchemaItem::create(schema_members); } -utils::SharedPtr<ISchemaItem> +std::shared_ptr<ISchemaItem> CSmartFactoryTest::ProvideObjectSchemaItemForStruct( TStructsSchemaItems& struct_schema_items, const StructIdentifiersTest::eType struct_id) { diff --git a/src/components/hmi_message_handler/mock_hmi_message_handler.h b/src/components/hmi_message_handler/mock_hmi_message_handler.h index d9060088ff..f4ed601bed 100644 --- a/src/components/hmi_message_handler/mock_hmi_message_handler.h +++ b/src/components/hmi_message_handler/mock_hmi_message_handler.h @@ -50,9 +50,9 @@ class MockHMIMessageHandler : public ::hmi_message_handler::HMIMessageHandler { MOCK_METHOD1(RemoveHMIMessageAdapter, void(HMIMessageAdapter* adapter)); MOCK_CONST_METHOD0(get_settings, const HMIMessageHandlerSettings&()); MOCK_METHOD1(OnMessageReceived, - void(utils::SharedPtr<application_manager::Message> message)); + void(std::shared_ptr<application_manager::Message> message)); MOCK_METHOD1(OnErrorSending, - void(utils::SharedPtr<application_manager::Message> message)); + void(std::shared_ptr<application_manager::Message> message)); MOCK_METHOD1(SendMessageToHMI, void(MessageSharedPointer message)); }; } // namespace hmi_message_handler_test diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc index 53a0d84362..d400cca335 100644 --- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc +++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc @@ -55,7 +55,7 @@ void MessageBrokerAdapter::SendMessageToHMI( hmi_message_handler::MessageSharedPointer message) { LOG4CXX_AUTO_TRACE(logger_); - if (!message.valid()) { + if (message.use_count() == 0) { LOG4CXX_ERROR(logger_, "Can`t send not valid message"); return; } diff --git a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc index eead7106c6..2ac91ba16d 100644 --- a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc +++ b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc @@ -31,8 +31,8 @@ */ #include "gtest/gtest.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "hmi_message_handler/hmi_message_handler_impl.h" #include "hmi_message_handler/mock_hmi_message_adapter_impl.h" @@ -45,7 +45,7 @@ namespace hmi_message_handler_test { using ::testing::Return; using hmi_message_handler::HMIMessageHandlerImpl; -typedef utils::SharedPtr<MockHMIMessageAdapterImpl> +typedef std::shared_ptr<MockHMIMessageAdapterImpl> MockHMIMessageAdapterImplSPtr; TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) { @@ -60,7 +60,7 @@ TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) { ; MockHMIMessageAdapterImplSPtr message_adapter_impl = - utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler); + std::make_shared<MockHMIMessageAdapterImpl>(message_handler); EXPECT_EQ(message_handler, message_adapter_impl->get_handler()); @@ -71,7 +71,7 @@ TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) { TEST(HMIMessageAdapterImplTest, Handler_NULLPointer_CorrectReturnedPointer) { HMIMessageHandler* message_handler = NULL; MockHMIMessageAdapterImplSPtr message_adapter_impl = - utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler); + std::make_shared<MockHMIMessageAdapterImpl>(message_handler); EXPECT_EQ(NULL, message_adapter_impl->get_handler()); } diff --git a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc index fd459ea094..e66f900299 100644 --- a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc +++ b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc @@ -86,7 +86,7 @@ class HMIMessageHandlerImplTest : public ::testing::Test { hmi_message_handler::MessageSharedPointer CreateMessage() { // The ServiceType doesn't really matter - return new application_manager::Message( + return std::make_shared<application_manager::Message>( protocol_handler::MessagePriority::FromServiceType( protocol_handler::ServiceType::kInvalidServiceType)); } @@ -104,7 +104,7 @@ TEST_F(HMIMessageHandlerImplTest, TEST_F(HMIMessageHandlerImplTest, OnErrorSending_NotEmptyMessage_ExpectOnErrorSendingProceeded) { // Arrange - utils::SharedPtr<application_manager::Message> message = CreateMessage(); + std::shared_ptr<application_manager::Message> message = CreateMessage(); EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(message)); // Act @@ -113,7 +113,7 @@ TEST_F(HMIMessageHandlerImplTest, TEST_F(HMIMessageHandlerImplTest, OnErrorSending_InvalidObserver_Cancelled) { // Arrange - utils::SharedPtr<application_manager::Message> message = CreateMessage(); + std::shared_ptr<application_manager::Message> message = CreateMessage(); hmi_handler_->set_message_observer(NULL); EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(_)).Times(0); diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h index f514168c53..61095e388a 100644 --- a/src/components/include/application_manager/application_manager.h +++ b/src/components/include/application_manager/application_manager.h @@ -42,7 +42,7 @@ #include "application_manager/command_factory.h" #include "connection_handler/connection_handler.h" #include "utils/data_accessor.h" -#include "utils/shared_ptr.h" + #include "telemetry_monitor/telemetry_observable.h" #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/application_manager_settings.h" @@ -260,7 +260,7 @@ class ApplicationManager { * **/ virtual void SendHMIStatusNotification( - const utils::SharedPtr<Application> app) = 0; + const std::shared_ptr<Application> app) = 0; /** * @brief Checks if driver distraction state is valid, creates message @@ -457,7 +457,7 @@ class ApplicationManager { virtual void IviInfoUpdated(mobile_apis::VehicleDataType::eType vehicle_info, int value) = 0; - virtual ApplicationSharedPtr RegisterApplication(const utils::SharedPtr< + virtual ApplicationSharedPtr RegisterApplication(const std::shared_ptr< smart_objects::SmartObject>& request_for_registration) = 0; virtual void SendUpdateAppList() = 0; @@ -697,7 +697,7 @@ class ApplicationManager { * @return new regular HMI state */ virtual HmiStatePtr CreateRegularState( - utils::SharedPtr<Application> app, + std::shared_ptr<Application> app, mobile_apis::HMILevel::eType hmi_level, mobile_apis::AudioStreamingState::eType audio_state, mobile_apis::VideoStreamingState::eType video_state, diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h index b8946a63f4..ee9274ead7 100644 --- a/src/components/include/application_manager/policies/policy_handler_interface.h +++ b/src/components/include/application_manager/policies/policy_handler_interface.h @@ -52,7 +52,7 @@ using namespace ::rpc::policy_table_interface_base; namespace policy { -typedef utils::SharedPtr<utils::Callable> StatusNotifier; +typedef std::shared_ptr<utils::Callable> StatusNotifier; class PolicyHandlerInterface { public: @@ -124,7 +124,7 @@ class PolicyHandlerInterface { virtual void add_listener(PolicyHandlerObserver* listener) = 0; virtual void remove_listener(PolicyHandlerObserver* listener) = 0; - virtual utils::SharedPtr<usage_statistics::StatisticsManager> + virtual std::shared_ptr<usage_statistics::StatisticsManager> GetStatisticManager() const = 0; virtual void SendOnAppPermissionsChanged( diff --git a/src/components/include/hmi_message_handler/hmi_message_observer.h b/src/components/include/hmi_message_handler/hmi_message_observer.h index 0676615b53..d9ae422b8f 100644 --- a/src/components/include/hmi_message_handler/hmi_message_observer.h +++ b/src/components/include/hmi_message_handler/hmi_message_observer.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_ #define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_OBSERVER_H_ -#include "utils/shared_ptr.h" + namespace application_manager { class Message; @@ -45,9 +45,9 @@ class HMIMessageObserver { public: virtual ~HMIMessageObserver() {} virtual void OnMessageReceived( - utils::SharedPtr<application_manager::Message> message) = 0; + std::shared_ptr<application_manager::Message> message) = 0; virtual void OnErrorSending( - utils::SharedPtr<application_manager::Message> message) = 0; + std::shared_ptr<application_manager::Message> message) = 0; }; } diff --git a/src/components/include/hmi_message_handler/hmi_message_sender.h b/src/components/include/hmi_message_handler/hmi_message_sender.h index 91c20a1986..3f70f78a97 100644 --- a/src/components/include/hmi_message_handler/hmi_message_sender.h +++ b/src/components/include/hmi_message_handler/hmi_message_sender.h @@ -36,7 +36,7 @@ #include "application_manager/message.h" namespace hmi_message_handler { -typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer; +typedef std::shared_ptr<application_manager::Message> MessageSharedPointer; class HMIMessageSender { public: diff --git a/src/components/include/policy/policy_external/policy/policy_manager.h b/src/components/include/policy/policy_external/policy/policy_manager.h index 83038472cd..57f6d2f802 100644 --- a/src/components/include/policy/policy_external/policy/policy_manager.h +++ b/src/components/include/policy/policy_external/policy/policy_manager.h @@ -46,7 +46,7 @@ namespace policy { class PolicySettings; -typedef utils::SharedPtr<utils::Callable> StatusNotifier; +typedef std::shared_ptr<utils::Callable> StatusNotifier; class PolicyManager : public usage_statistics::StatisticsManager { public: @@ -609,7 +609,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @param access_remote pointer to new access_remote instance */ virtual void set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) = 0; + std::shared_ptr<AccessRemote> access_remote) = 0; /** * @brief Checks if there is existing URL in the EndpointUrls vector with diff --git a/src/components/include/policy/policy_regular/policy/policy_manager.h b/src/components/include/policy/policy_regular/policy/policy_manager.h index bd29b2942e..ee0bae7118 100644 --- a/src/components/include/policy/policy_regular/policy/policy_manager.h +++ b/src/components/include/policy/policy_regular/policy/policy_manager.h @@ -46,7 +46,7 @@ namespace policy { class PolicySettings; -typedef utils::SharedPtr<utils::Callable> StatusNotifier; +typedef std::shared_ptr<utils::Callable> StatusNotifier; class PolicyManager : public usage_statistics::StatisticsManager { public: @@ -589,7 +589,7 @@ class PolicyManager : public usage_statistics::StatisticsManager { * @param access_remote pointer to new access_remote instance */ virtual void set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) = 0; + std::shared_ptr<AccessRemote> access_remote) = 0; /** * @brief Checks if there is existing URL in the EndpointUrls vector with diff --git a/src/components/include/protocol/raw_message.h b/src/components/include/protocol/raw_message.h index 99cb73ce67..5171d42593 100644 --- a/src/components/include/protocol/raw_message.h +++ b/src/components/include/protocol/raw_message.h @@ -33,7 +33,7 @@ #define SRC_COMPONENTS_INCLUDE_PROTOCOL_RAW_MESSAGE_H_ #include "utils/macro.h" -#include "utils/shared_ptr.h" +#include <memory> #include "protocol/service_type.h" #include "protocol/message_priority.h" @@ -114,6 +114,6 @@ class RawMessage { bool waiting_; DISALLOW_COPY_AND_ASSIGN(RawMessage); }; -typedef utils::SharedPtr<RawMessage> RawMessagePtr; +typedef std::shared_ptr<RawMessage> RawMessagePtr; } // namespace protocol_handler #endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_RAW_MESSAGE_H_ diff --git a/src/components/include/protocol_handler/telemetry_observer.h b/src/components/include/protocol_handler/telemetry_observer.h index a76fbce717..a908ebcaa1 100644 --- a/src/components/include/protocol_handler/telemetry_observer.h +++ b/src/components/include/protocol_handler/telemetry_observer.h @@ -50,7 +50,7 @@ class PHTelemetryObserver { }; virtual void StartMessageProcess(uint32_t message_id, const TimevalStruct& start_time) = 0; - virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m) = 0; + virtual void EndMessageProcess(std::shared_ptr<MessageMetric> m) = 0; virtual ~PHTelemetryObserver() {} }; } // protocol_handler diff --git a/src/components/include/security_manager/security_query.h b/src/components/include/security_manager/security_query.h index cdad1c746c..8aa5b60853 100644 --- a/src/components/include/security_manager/security_query.h +++ b/src/components/include/security_manager/security_query.h @@ -37,7 +37,7 @@ #include <cstddef> #include <vector> #include <string> -#include "utils/shared_ptr.h" +#include <memory> namespace security_manager { /** @@ -189,6 +189,6 @@ class SecurityQuery { /** *\brief SmartPointer wrapper */ -typedef utils::SharedPtr<SecurityQuery> SecurityQueryPtr; +typedef std::shared_ptr<SecurityQuery> SecurityQueryPtr; } // namespace security_manager #endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_QUERY_H_ diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h index 79f601d75d..4a86c17f39 100644 --- a/src/components/include/test/application_manager/mock_application_manager.h +++ b/src/components/include/test/application_manager/mock_application_manager.h @@ -121,7 +121,7 @@ class MockApplicationManager : public application_manager::ApplicationManager { mobile_apis::HMILevel::eType to)); MOCK_METHOD1( SendHMIStatusNotification, - void(const utils::SharedPtr<application_manager::Application> app)); + void(const std::shared_ptr<application_manager::Application> app)); MOCK_METHOD1(SendDriverDistractionState, void(application_manager::ApplicationSharedPtr app)); MOCK_METHOD1(RemoveHMIFakeParameters, @@ -171,7 +171,7 @@ class MockApplicationManager : public application_manager::ApplicationManager { void(mobile_apis::VehicleDataType::eType vehicle_info, int value)); MOCK_METHOD1(RegisterApplication, - application_manager::ApplicationSharedPtr(const utils::SharedPtr< + application_manager::ApplicationSharedPtr(const std::shared_ptr< smart_objects::SmartObject>& request_for_registration)); MOCK_METHOD0(SendUpdateAppList, void()); MOCK_METHOD2(MarkAppsGreyOut, diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h index ffa9222c8e..cb47147074 100644 --- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h +++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h @@ -112,7 +112,7 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface { MOCK_METHOD1(add_listener, void(policy::PolicyHandlerObserver* listener)); MOCK_METHOD1(remove_listener, void(policy::PolicyHandlerObserver* listener)); MOCK_CONST_METHOD0(GetStatisticManager, - utils::SharedPtr<usage_statistics::StatisticsManager>()); + std::shared_ptr<usage_statistics::StatisticsManager>()); MOCK_CONST_METHOD2(CheckSystemAction, bool(mobile_apis::SystemAction::eType system_action, const std::string& policy_app_id)); diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h index 859d164231..17ec69ccf8 100644 --- a/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h +++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_observer.h @@ -45,9 +45,9 @@ class MockHMIMessageObserver : public hmi_message_handler::HMIMessageObserver, public utils::Singleton<MockHMIMessageObserver> { public: MOCK_METHOD1(OnMessageReceived, - void(utils::SharedPtr<application_manager::Message> message)); + void(std::shared_ptr<application_manager::Message> message)); MOCK_METHOD1(OnErrorSending, - void(utils::SharedPtr<application_manager::Message> message)); + void(std::shared_ptr<application_manager::Message> message)); virtual ~MockHMIMessageObserver() {} }; diff --git a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h index 02931114f0..a4d50d7cc2 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_cache_manager.h @@ -106,7 +106,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { MOCK_METHOD2(Init, bool(const std::string& file_name, const PolicySettings* settings)); - MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt)); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); @@ -231,7 +231,7 @@ class MockCacheManagerInterface : public ::policy::CacheManagerInterface { bool(const std::string& device_id, const std::string& policy_app_id, policy::Permissions& permission)); - MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GetPT, std::shared_ptr<policy_table::Table>()); MOCK_CONST_METHOD0(GetMetaInfo, const MetaInfo()); MOCK_CONST_METHOD0(GetCertificate, std::string()); MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&)); diff --git a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h index ea259fc916..aeabf8fdcb 100644 --- a/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_external/policy/mock_policy_manager.h @@ -163,7 +163,7 @@ class MockPolicyManager : public PolicyManager { bool(const std::string& policy_app_id, std::vector<std::string>* modules)); MOCK_METHOD1(set_access_remote, - void(utils::SharedPtr<AccessRemote> access_remote)); + void(std::shared_ptr<AccessRemote> access_remote)); MOCK_METHOD0(CleanupUnpairedDevices, bool()); MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); diff --git a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h index d216957eb0..440000dbff 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_cache_manager.h @@ -84,7 +84,7 @@ class MockCacheManagerInterface : public CacheManagerInterface { MOCK_METHOD2(Init, bool(const std::string& file_name, const PolicySettings* settings)); - MOCK_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(ApplyUpdate, bool(const policy_table::Table& update_pt)); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); @@ -202,7 +202,7 @@ class MockCacheManagerInterface : public CacheManagerInterface { bool(const std::string& device_id, const std::string& policy_app_id, policy::Permissions& permission)); - MOCK_CONST_METHOD0(pt, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(pt, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(GetHMITypes, const policy_table::AppHMITypes*(const std::string& app_id)); MOCK_CONST_METHOD0(GetCertificate, std::string()); diff --git a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h index 952b264caf..0e06e9c1a3 100644 --- a/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h +++ b/src/components/include/test/policy/policy_regular/policy/mock_policy_manager.h @@ -162,7 +162,7 @@ class MockPolicyManager : public PolicyManager { bool(const std::string& policy_app_id, std::vector<std::string>* modules)); MOCK_METHOD1(set_access_remote, - void(utils::SharedPtr<AccessRemote> access_remote)); + void(std::shared_ptr<AccessRemote> access_remote)); MOCK_METHOD0(CleanupUnpairedDevices, bool()); MOCK_CONST_METHOD1(CanAppKeepContext, bool(const std::string& app_id)); MOCK_CONST_METHOD1(CanAppStealFocus, bool(const std::string& app_id)); diff --git a/src/components/include/test/protocol_handler/mock_telemetry_observer.h b/src/components/include/test/protocol_handler/mock_telemetry_observer.h index 1c87de4d5a..fb1141baa4 100644 --- a/src/components/include/test/protocol_handler/mock_telemetry_observer.h +++ b/src/components/include/test/protocol_handler/mock_telemetry_observer.h @@ -45,7 +45,7 @@ class MockPHTelemetryObserver : public PHTelemetryObserver { public: MOCK_METHOD2(StartMessageProcess, void(uint32_t message_id, const TimevalStruct& start_time)); - MOCK_METHOD1(EndMessageProcess, void(utils::SharedPtr<MessageMetric> m)); + MOCK_METHOD1(EndMessageProcess, void(std::shared_ptr<MessageMetric> m)); }; } // namespace protocol_handler_test diff --git a/src/components/include/transport_manager/error.h b/src/components/include/transport_manager/error.h index 022ddf0e38..ba357dd54b 100644 --- a/src/components/include/transport_manager/error.h +++ b/src/components/include/transport_manager/error.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_ERROR_H_ #include <string> -#include <utils/shared_ptr.h> +#include <memory> namespace transport_manager { @@ -79,7 +79,7 @@ class BaseError { private: std::string description_; }; -typedef utils::SharedPtr<BaseError> BaseErrorPtr; +typedef std::shared_ptr<BaseError> BaseErrorPtr; /** * @brief Error that originates during device search. diff --git a/src/components/include/transport_manager/transport_adapter/device.h b/src/components/include/transport_manager/transport_adapter/device.h index 148e715050..1ac1424477 100644 --- a/src/components/include/transport_manager/transport_adapter/device.h +++ b/src/components/include/transport_manager/transport_adapter/device.h @@ -35,9 +35,10 @@ #include <string> #include <vector> +#include <memory> #include "transport_manager/common.h" -#include "utils/shared_ptr.h" + #include "utils/macro.h" namespace transport_manager { @@ -160,7 +161,7 @@ class Device { **/ bool keep_on_disconnect_; }; -typedef utils::SharedPtr<Device> DeviceSptr; +typedef std::shared_ptr<Device> DeviceSptr; typedef std::vector<DeviceSptr> DeviceVector; } // namespace transport_adapter } // namespace transport_manager diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h index c00adb33b8..630ec4e85f 100644 --- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h +++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h @@ -44,7 +44,7 @@ #include <list> #include <map> -#include "utils/shared_ptr.h" + #include "transport_manager/transport_adapter/device.h" #include "transport_manager/common.h" diff --git a/src/components/include/utils/data_accessor.h b/src/components/include/utils/data_accessor.h index 6d0fb0ed68..0c1eb6ebbd 100644 --- a/src/components/include/utils/data_accessor.h +++ b/src/components/include/utils/data_accessor.h @@ -34,7 +34,7 @@ #include <iostream> #include "utils/lock.h" -#include "utils/shared_ptr.h" + // This class is for thread-safe const access to data template <class T> @@ -67,7 +67,7 @@ class DataAccessor { const T& data_; // Require that the lock lives at least as long as the DataAccessor const std::shared_ptr<sync_primitives::Lock> lock_; - utils::SharedPtr<uint32_t> counter_; + std::shared_ptr<uint32_t> counter_; }; #endif // SRC_COMPONENTS_INCLUDE_UTILS_DATA_ACCESSOR_H_ diff --git a/src/components/include/utils/make_shared.h b/src/components/include/utils/make_shared.h deleted file mode 100644 index 9d40d646a6..0000000000 --- a/src/components/include/utils/make_shared.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_ -#define SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_ - -#include <new> -/** - * @brief The functions set below allows to create shared pointer in a safe way. - * There are up to 5 parameters could be passed as the constructor parameters. - * - * @example - * struct A { - * A(int){} - * A(int, double) {} - * A(int, double, std::string) {} - * } - * SharedPtr<A> shared1(MakeShared<A>(5); - * SharedPtr<A> shared2(MakeShared<A>(5, 5.5); - * SharedPtr<A> shared3(MakeShared<A>(5, 5.5, std::string("MyStr")); - * - * The profit in using MakeShared instead of simple allocation with operator new - *is evident. - * Firstly it allows us to centralize allocation place, secondly it allows us to - *use - * safe operator new overloading (no throwable one). - */ -namespace utils { -template <typename T> -class SharedPtr; - -namespace { -template <typename T> -SharedPtr<T> Initialize(T* object) { - return object == NULL ? SharedPtr<T>() : SharedPtr<T>(object); -} -} - -template <typename T> -SharedPtr<T> MakeShared() { - T* t = new (std::nothrow) T; - return Initialize(t); -} - -template <typename T, typename Arg1> -SharedPtr<T> MakeShared(Arg1& arg1) { - T* t = new (std::nothrow) T(arg1); - return Initialize(t); -} - -template <typename T, typename Arg1, typename Arg2> -SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2) { - T* t = new (std::nothrow) T(arg1, arg2); - return Initialize(t); -} - -template <typename T, typename Arg1, typename Arg2, typename Arg3> -SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2, Arg3& arg3) { - T* t = new (std::nothrow) T(arg1, arg2, arg3); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4> -SharedPtr<T> MakeShared(Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5> -SharedPtr<T> MakeShared( - Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4, Arg5& arg5) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5, - typename Arg6> -SharedPtr<T> MakeShared( - Arg1& arg1, Arg2& arg2, Arg3& arg3, Arg4& arg4, Arg5& arg5, Arg6& arg6) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5, arg6); - return Initialize(t); -} - -template <typename T, typename Arg1> -SharedPtr<T> MakeShared(const Arg1& arg1) { - T* t = new (std::nothrow) T(arg1); - return Initialize(t); -} - -template <typename T, typename Arg1, typename Arg2> -SharedPtr<T> MakeShared(const Arg1& arg1, const Arg2& arg2) { - T* t = new (std::nothrow) T(arg1, arg2); - return Initialize(t); -} - -template <typename T, typename Arg1, typename Arg2, typename Arg3> -SharedPtr<T> MakeShared(const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { - T* t = new (std::nothrow) T(arg1, arg2, arg3); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4> -SharedPtr<T> MakeShared(const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5> -SharedPtr<T> MakeShared(const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5); - return Initialize(t); -} - -template <typename T, - typename Arg1, - typename Arg2, - typename Arg3, - typename Arg4, - typename Arg5, - typename Arg6> -SharedPtr<T> MakeShared(const Arg1& arg1, - const Arg2& arg2, - const Arg3& arg3, - const Arg4& arg4, - const Arg5& arg5, - const Arg6& arg6) { - T* t = new (std::nothrow) T(arg1, arg2, arg3, arg4, arg5, arg6); - return Initialize(t); -} - -} // namespace utils; -#endif // SRC_COMPONENTS_INCLUDE_UTILS_MAKE_SHARED_H_ diff --git a/src/components/include/utils/shared_ptr.h b/src/components/include/utils/shared_ptr.h deleted file mode 100644 index 064bb36b4a..0000000000 --- a/src/components/include/utils/shared_ptr.h +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright (c) 2013, 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. - */ - -#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_ -#define SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_ - -#include <assert.h> -#include <stddef.h> -#include <stdint.h> - -#include "utils/macro.h" -#include "utils/atomic.h" - -namespace utils { - -/** - * @brief Shared pointer. - * - * Pointer to an object with reference counting. - * Object will be automatically deallocated when last shared - * pointer is destroyed. - * - * @tparam ObjectType Type of wrapped object. - **/ -template <typename ObjectType> -class SharedPtr { - static void DummyDeleter(ObjectType* object_to_delete) { - delete object_to_delete; - } - - public: - // std smart pointer compatibility - typedef ObjectType element_type; - typedef void (*Deleter)(ObjectType*); - /** - * @brief Constructor. - * - * Initialize shared pointer with wrapped object. - * Reference counter will be initialized to 1. - * - * @param Object Wrapped object. - **/ - SharedPtr(ObjectType* Object); - - SharedPtr(ObjectType* Object, Deleter deleter) - : mObject(Object) - , mReferenceCounter(new uint32_t(1)) - , deleter_(deleter) {} - - SharedPtr(); - - /** - * @brief Copy constructor. - * - * Initialize shared pointer with another shared pointer. - * Reference counter will be incremented. - * - * @param Other Other shared pointer. - **/ - SharedPtr(const SharedPtr<ObjectType>& Other); - - /** - * @brief Copy constructor. - * - * Initialize shared pointer with another shared pointer. - * Reference counter will be incremented. - * - * @tparam OtherObjectType Type of other object pointer. This - * allows creating a shared pointer to an - * intstance of a base class from a shared - * pointer to an instance of a class - * inherited from this base class. - * If OtherObjectType is not implicitly - * convertible to ObjectType it will - * cause a compile error. - * - * @param Other Other shared pointer. - **/ - template <typename OtherObjectType> - SharedPtr(const SharedPtr<OtherObjectType>& Other); - - /** - * @brief Destructor. - * - * Decrement reference counter and destroy wrapped object - * if reference counter reaches zero. - **/ - ~SharedPtr(); - - /** - * @brief Assignment operator. - * - * Drop reference to currently referenced object and add - * reference to assigned object. - * - * @param Other Shared pointer to an object - * that must be referenced. - * - * @return Reference to this shared pointer. - **/ - SharedPtr<ObjectType>& operator=(const SharedPtr<ObjectType>& Other); - - bool operator==(const SharedPtr<ObjectType>& Other) const; - - bool operator<(const SharedPtr<ObjectType>& other) const; - - /** - * @brief Assignment operator. - * - * Drop reference to currently referenced object and add - * reference to assigned object. - * - * @tparam OtherObjectType Type of other object pointer. This - * allows creating a shared pointer to an - * intstance of a base class from a shared - * pointer to an instance of a class - * inherited from this base class. - * If OtherObjectType is not implicitly - * convertible to ObjectType it will - * cause a compile error. - * - * @param Other Shared pointer to an object - * that must be referenced. - * - * @return Reference to this shared pointer. - **/ - template <typename OtherObjectType> - SharedPtr<ObjectType>& operator=(const SharedPtr<OtherObjectType>& Other); - - template <typename OtherObjectType> - static SharedPtr<OtherObjectType> static_pointer_cast( - const SharedPtr<ObjectType>& pointer); - - template <typename OtherObjectType> - static SharedPtr<OtherObjectType> dynamic_pointer_cast( - const SharedPtr<ObjectType>& pointer); - - /** - * @brief Member access operator. - * - * @return Wrapped object. - **/ - ObjectType* operator->() const; - - ObjectType& operator*() const; - operator bool() const; - void reset(); - void reset(ObjectType* other); - ObjectType* get() const; - -#ifdef BUILD_TESTS - inline const uint32_t* get_ReferenceCounter() const { - return mReferenceCounter; - } -#endif // BUILD_TESTS - - /** - * @return true if mObject not NULL - */ - bool valid() const; - - private: - void reset_impl(ObjectType* other); - - // TSharedPtr needs access to other TSharedPtr private members - // for shared pointers type casts. - template <typename OtherObjectType> - friend class SharedPtr; - - /** - * @brief Drop reference to wrapped object. - * - * If reference counter reaches zero object and its reference - * counter will be deallocated. - **/ - void dropReference(); - - /** - * @brief Wrapped object. - **/ - ObjectType* mObject; - - /** - * @brief Pointer to reference counter. - **/ - uint32_t* mReferenceCounter; - - Deleter deleter_; - void release(); -}; - -template <typename ObjectType> -inline utils::SharedPtr<ObjectType>::SharedPtr(ObjectType* Object) - : mObject(NULL) - , mReferenceCounter(new uint32_t(1)) - , deleter_(DummyDeleter) { - DCHECK(Object != NULL); - mObject = Object; -} - -template <typename ObjectType> -inline utils::SharedPtr<ObjectType>::SharedPtr() - : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) {} - -template <typename ObjectType> -inline utils::SharedPtr<ObjectType>::SharedPtr( - const SharedPtr<ObjectType>& Other) - : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) { - *this = Other; -} - -template <typename ObjectType> -template <typename OtherObjectType> -inline utils::SharedPtr<ObjectType>::SharedPtr( - const SharedPtr<OtherObjectType>& Other) - : mObject(0), mReferenceCounter(0), deleter_(DummyDeleter) { - *this = Other; -} - -template <typename ObjectType> -inline utils::SharedPtr<ObjectType>::~SharedPtr() { - dropReference(); -} - -template <typename ObjectType> -inline utils::SharedPtr<ObjectType>& utils::SharedPtr<ObjectType>::operator=( - const SharedPtr<ObjectType>& Other) { - return operator=<ObjectType>(Other); -} - -template <typename ObjectType> -inline bool utils::SharedPtr<ObjectType>::operator==( - const SharedPtr<ObjectType>& Other) const { - return (mObject == Other.mObject); -} - -template <typename ObjectType> -inline bool utils::SharedPtr<ObjectType>::operator<( - const SharedPtr<ObjectType>& other) const { - return (mObject < other.mObject); -} - -template <typename ObjectType> -template <typename OtherObjectType> -inline utils::SharedPtr<ObjectType>& utils::SharedPtr<ObjectType>::operator=( - const SharedPtr<OtherObjectType>& Other) { - dropReference(); - - mObject = Other.mObject; - mReferenceCounter = Other.mReferenceCounter; - - if (0 != mReferenceCounter) { - atomic_post_inc(mReferenceCounter); - } - - return *this; -} - -template <typename ObjectType> -template <typename OtherObjectType> -utils::SharedPtr<OtherObjectType> utils::SharedPtr< - ObjectType>::static_pointer_cast(const SharedPtr<ObjectType>& pointer) { - SharedPtr<OtherObjectType> casted_pointer; - casted_pointer.mObject = static_cast<OtherObjectType*>(pointer.mObject); - casted_pointer.mReferenceCounter = pointer.mReferenceCounter; - - if (0 != casted_pointer.mReferenceCounter) { - atomic_post_inc(casted_pointer.mReferenceCounter); - } - - return casted_pointer; -} - -template <typename ObjectType> -template <typename OtherObjectType> -utils::SharedPtr<OtherObjectType> utils::SharedPtr< - ObjectType>::dynamic_pointer_cast(const SharedPtr<ObjectType>& pointer) { - SharedPtr<OtherObjectType> casted_pointer; - casted_pointer.mObject = dynamic_cast<OtherObjectType*>(pointer.mObject); - if (NULL != casted_pointer.mObject) { - casted_pointer.mReferenceCounter = pointer.mReferenceCounter; - - if (0 != casted_pointer.mReferenceCounter) { - atomic_post_inc(casted_pointer.mReferenceCounter); - } - } - - return casted_pointer; -} - -template <typename ObjectType> -ObjectType* utils::SharedPtr<ObjectType>::operator->() const { - DCHECK(mObject); - return mObject; -} - -template <typename ObjectType> -ObjectType& utils::SharedPtr<ObjectType>::operator*() const { - DCHECK(mObject); - return *mObject; -} - -template <typename ObjectType> -utils::SharedPtr<ObjectType>::operator bool() const { - return valid(); -} - -template <typename ObjectType> -void utils::SharedPtr<ObjectType>::reset() { - reset_impl(0); -} - -template <typename ObjectType> -void utils::SharedPtr<ObjectType>::reset(ObjectType* other) { - DCHECK(other != NULL); - reset_impl(other); -} - -template <typename ObjectType> -void SharedPtr<ObjectType>::release() { - deleter_(mObject); - mObject = 0; - - delete mReferenceCounter; - mReferenceCounter = 0; -} - -template <typename ObjectType> -void utils::SharedPtr<ObjectType>::reset_impl(ObjectType* other) { - dropReference(); - mObject = other; - mReferenceCounter = new uint32_t(1); -} - -template <typename ObjectType> -inline void SharedPtr<ObjectType>::dropReference() { - if (0 != mReferenceCounter) { - if (1 == atomic_post_dec(mReferenceCounter)) { - release(); - } - } -} - -template <typename ObjectType> -ObjectType* SharedPtr<ObjectType>::get() const { - return mObject; -} - -template <typename ObjectType> -inline bool SharedPtr<ObjectType>::valid() const { - if (mReferenceCounter && (0 < *mReferenceCounter)) { - return (mObject != NULL); - } - return false; -} - -} // namespace utils - -#endif // SRC_COMPONENTS_INCLUDE_UTILS_SHARED_PTR_H_ - -// vim: set ts=2 sw=2 et: diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h index 15023f02dd..add7fc38b8 100644 --- a/src/components/include/utils/threads/message_loop_thread.h +++ b/src/components/include/utils/threads/message_loop_thread.h @@ -40,7 +40,7 @@ #include "utils/macro.h" #include "utils/message_queue.h" #include "utils/threads/thread.h" -#include "utils/shared_ptr.h" + #include "utils/lock.h" namespace threads { diff --git a/src/components/media_manager/include/media_manager/media_adapter_impl.h b/src/components/media_manager/include/media_manager/media_adapter_impl.h index 75c48c98b7..37401f9c2b 100644 --- a/src/components/media_manager/include/media_manager/media_adapter_impl.h +++ b/src/components/media_manager/include/media_manager/media_adapter_impl.h @@ -40,7 +40,7 @@ namespace media_manager { -typedef utils::SharedPtr<MediaAdapterListener> MediaListenerPtr; +typedef std::shared_ptr<MediaAdapterListener> MediaListenerPtr; class MediaAdapterImpl : public MediaAdapter { public: @@ -57,7 +57,7 @@ class MediaAdapterImpl : public MediaAdapter { DISALLOW_COPY_AND_ASSIGN(MediaAdapterImpl); }; -typedef utils::SharedPtr<MediaAdapterImpl> MediaAdapterImplPtr; +typedef std::shared_ptr<MediaAdapterImpl> MediaAdapterImplPtr; } // namespace media_manager diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h index 7fbd4f2f6f..749356e656 100644 --- a/src/components/media_manager/include/media_manager/media_manager_impl.h +++ b/src/components/media_manager/include/media_manager/media_manager_impl.h @@ -86,10 +86,10 @@ class MediaManagerImpl : public MediaManager, void set_mock_mic_listener(MediaListenerPtr media_listener); void set_mock_mic_recorder(MediaAdapterImpl* media_adapter); void set_mock_streamer(protocol_handler::ServiceType stype, - ::utils::SharedPtr<MediaAdapterImpl> mock_stream); + std::shared_ptr<MediaAdapterImpl> mock_stream); void set_mock_streamer_listener( protocol_handler::ServiceType stype, - ::utils::SharedPtr<MediaAdapterListener> mock_stream); + std::shared_ptr<MediaAdapterListener> mock_stream); #endif // BUILD_TESTS protected: diff --git a/src/components/media_manager/include/media_manager/streamer_adapter.h b/src/components/media_manager/include/media_manager/streamer_adapter.h index 5ac8e05cac..997d602cfe 100644 --- a/src/components/media_manager/include/media_manager/streamer_adapter.h +++ b/src/components/media_manager/include/media_manager/streamer_adapter.h @@ -38,7 +38,7 @@ #include "utils/threads/thread.h" #include "utils/threads/thread_delegate.h" #include "utils/atomic_object.h" -#include "utils/shared_ptr.h" + #include "protocol/raw_message.h" namespace media_manager { @@ -96,7 +96,7 @@ class StreamerAdapter : public MediaAdapterImpl { DISALLOW_COPY_AND_ASSIGN(StreamerAdapter); }; -typedef utils::SharedPtr<StreamerAdapter> StreamerAdapterPtr; +typedef std::shared_ptr<StreamerAdapter> StreamerAdapterPtr; } // namespace media_manager diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc index 1aacbe4c28..e1b932b611 100644 --- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc +++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc @@ -145,7 +145,7 @@ void AudioStreamSenderThread::SendAudioPassThroughNotification( data.binary_data = binary_data; smart_objects::SmartObjectSPtr on_audio_pass = - new smart_objects::SmartObject(); + std::make_shared<smart_objects::SmartObject>(); if (!on_audio_pass) { LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer"); diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc index 6a9ded9029..1a95227461 100644 --- a/src/components/media_manager/src/media_manager_impl.cc +++ b/src/components/media_manager/src/media_manager_impl.cc @@ -98,13 +98,13 @@ void MediaManagerImpl::set_mock_mic_recorder(MediaAdapterImpl* media_adapter) { void MediaManagerImpl::set_mock_streamer( protocol_handler::ServiceType stype, - ::utils::SharedPtr<MediaAdapterImpl> mock_stream) { + std::shared_ptr<MediaAdapterImpl> mock_stream) { streamer_[stype] = mock_stream; } void MediaManagerImpl::set_mock_streamer_listener( protocol_handler::ServiceType stype, - ::utils::SharedPtr<MediaAdapterListener> mock_stream) { + std::shared_ptr<MediaAdapterListener> mock_stream) { streamer_listener_[stype] = mock_stream; } @@ -116,33 +116,33 @@ void MediaManagerImpl::Init() { #if defined(EXTENDED_MEDIA_MODE) LOG4CXX_INFO(logger_, "Called Init with default configuration."); - from_mic_recorder_ = new FromMicRecorderAdapter(); + from_mic_recorder_ = std::make_shared<FromMicRecorderAdapter>(); #endif if ("socket" == settings().video_server_type()) { - streamer_[ServiceType::kMobileNav] = new SocketVideoStreamerAdapter( + streamer_[ServiceType::kMobileNav]= std::make_shared<SocketVideoStreamerAdapter>( settings().server_address(), settings().video_streaming_port()); } else if ("pipe" == settings().video_server_type()) { - streamer_[ServiceType::kMobileNav] = new PipeVideoStreamerAdapter( + streamer_[ServiceType::kMobileNav]= std::make_shared<PipeVideoStreamerAdapter>( settings().named_video_pipe_path(), settings().app_storage_folder()); } else if ("file" == settings().video_server_type()) { - streamer_[ServiceType::kMobileNav] = new FileVideoStreamerAdapter( + streamer_[ServiceType::kMobileNav]= std::make_shared<FileVideoStreamerAdapter>( settings().video_stream_file(), settings().app_storage_folder()); } if ("socket" == settings().audio_server_type()) { - streamer_[ServiceType::kAudio] = new SocketAudioStreamerAdapter( + streamer_[ServiceType::kAudio]= std::make_shared<SocketAudioStreamerAdapter>( settings().server_address(), settings().audio_streaming_port()); } else if ("pipe" == settings().audio_server_type()) { - streamer_[ServiceType::kAudio] = new PipeAudioStreamerAdapter( + streamer_[ServiceType::kAudio]= std::make_shared<PipeAudioStreamerAdapter>( settings().named_audio_pipe_path(), settings().app_storage_folder()); } else if ("file" == settings().audio_server_type()) { - streamer_[ServiceType::kAudio] = new FileAudioStreamerAdapter( + streamer_[ServiceType::kAudio]= std::make_shared<FileAudioStreamerAdapter>( settings().audio_stream_file(), settings().app_storage_folder()); } - streamer_listener_[ServiceType::kMobileNav] = new StreamerListener(*this); - streamer_listener_[ServiceType::kAudio] = new StreamerListener(*this); + streamer_listener_[ServiceType::kMobileNav] = std::make_shared<StreamerListener>(*this); + streamer_listener_[ServiceType::kAudio] = std::make_shared<StreamerListener>(*this); if (streamer_[ServiceType::kMobileNav]) { streamer_[ServiceType::kMobileNav]->AddListener( @@ -188,7 +188,7 @@ void MediaManagerImpl::StartMicrophoneRecording(int32_t application_key, file_path += "/"; file_path += output_file; from_mic_listener_ = - new FromMicRecorderListener(file_path, application_manager_); + std::make_shared<FromMicRecorderListener>(file_path, application_manager_); #ifdef EXTENDED_MEDIA_MODE if (from_mic_recorder_) { from_mic_recorder_->AddListener(from_mic_listener_); diff --git a/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h b/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h index 80b2ee3377..6c5bd7b7b9 100644 --- a/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h +++ b/src/components/media_manager/test/include/media_manager/mock_media_adapter_impl.h @@ -45,9 +45,9 @@ using namespace media_manager; class MockMediaAdapterImpl : public ::media_manager::MediaAdapterImpl { public: MOCK_METHOD1(AddListener, - void(const utils::SharedPtr<MediaAdapterListener>&)); + void(const std::shared_ptr<MediaAdapterListener>&)); MOCK_METHOD1(RemoveListener, - void(const utils::SharedPtr<MediaAdapterListener>&)); + void(const std::shared_ptr<MediaAdapterListener>&)); MOCK_METHOD2(SendData, void(int32_t application_key, const ::protocol_handler::RawMessagePtr message)); diff --git a/src/components/media_manager/test/media_manager_impl_test.cc b/src/components/media_manager/test/media_manager_impl_test.cc index a9dc27d7a3..eae7bda680 100644 --- a/src/components/media_manager/test/media_manager_impl_test.cc +++ b/src/components/media_manager/test/media_manager_impl_test.cc @@ -44,8 +44,8 @@ #include "application_manager/state_controller.h" #include "protocol_handler/mock_protocol_handler.h" #include "protocol/common.h" -#include "utils/make_shared.h" -#include "utils/shared_ptr.h" + + #include "utils/file_system.h" #include "utils/scope_guard.h" @@ -58,7 +58,7 @@ using namespace ::media_manager; using ::testing::_; using ::testing::Return; using ::testing::ReturnRef; -using ::utils::SharedPtr; + using ::utils::ScopeGuard; using ::utils::MakeGuard; using ::testing::NiceMock; @@ -99,20 +99,20 @@ void dealloc_file(std::ofstream* test_file) { } // namespace typedef NiceMock<application_manager_test::MockApplication> MockApp; -typedef SharedPtr<MockApp> MockAppPtr; -typedef SharedPtr<MockMediaAdapterImpl> MockMediaAdapterImplPtr; +typedef std::shared_ptr<MockApp> MockAppPtr; +typedef std::shared_ptr<MockMediaAdapterImpl> MockMediaAdapterImplPtr; class MediaManagerImplTest : public ::testing::Test { public: // media_adapter_mock_ will be deleted in media_manager_impl (dtor) MediaManagerImplTest() : media_adapter_mock_(new MockMediaAdapter()) { media_adapter_listener_mock_ = - utils::MakeShared<MockMediaAdapterListener>(); + std::make_shared<MockMediaAdapterListener>(); ON_CALL(mock_media_manager_settings_, video_server_type()) .WillByDefault(ReturnRef(kDefaultValue)); ON_CALL(mock_media_manager_settings_, audio_server_type()) .WillByDefault(ReturnRef(kDefaultValue)); - mock_app_ = ::utils::MakeShared<MockApp>(); + mock_app_ = std::make_shared<MockApp>(); media_manager_impl_.reset( new MediaManagerImpl(app_mngr_, mock_media_manager_settings_)); } @@ -181,7 +181,7 @@ class MediaManagerImplTest : public ::testing::Test { .WillOnce(Return(mock_app_)); EXPECT_CALL(*mock_app_, WakeUpStreaming(service_type)); MockMediaAdapterImplPtr mock_media_streamer = - utils::MakeShared<MockMediaAdapterImpl>(); + std::make_shared<MockMediaAdapterImpl>(); media_manager_impl_->set_mock_streamer(service_type, mock_media_streamer); media_manager_impl_->set_mock_streamer_listener( service_type, media_adapter_listener_mock_); @@ -204,11 +204,11 @@ class MediaManagerImplTest : public ::testing::Test { application_manager_test::MockApplicationManager app_mngr_; MockAppPtr mock_app_; - SharedPtr<MockMediaAdapterListener> media_adapter_listener_mock_; + std::shared_ptr<MockMediaAdapterListener> media_adapter_listener_mock_; MockMediaAdapter* media_adapter_mock_; const ::testing::NiceMock<MockMediaManagerSettings> mock_media_manager_settings_; - SharedPtr<MediaManagerImpl> media_manager_impl_; + std::shared_ptr<MediaManagerImpl> media_manager_impl_; }; TEST_F(MediaManagerImplTest, @@ -375,11 +375,11 @@ TEST_F(MediaManagerImplTest, StopMicrophoneRecording_SUCCESS) { TEST_F(MediaManagerImplTest, StartStopStreaming_AudioAndVideoServiceType_SUCCESS) { MockMediaAdapterImplPtr mock_audio_media_streamer = - utils::MakeShared<MockMediaAdapterImpl>(); + std::make_shared<MockMediaAdapterImpl>(); media_manager_impl_->set_mock_streamer(ServiceType::kAudio, mock_audio_media_streamer); MockMediaAdapterImplPtr mock_nav_media_streamer = - utils::MakeShared<MockMediaAdapterImpl>(); + std::make_shared<MockMediaAdapterImpl>(); media_manager_impl_->set_mock_streamer(ServiceType::kMobileNav, mock_nav_media_streamer); diff --git a/src/components/policy/policy_external/include/policy/access_remote_impl.h b/src/components/policy/policy_external/include/policy/access_remote_impl.h index 0fa53b0237..cee2a8774f 100644 --- a/src/components/policy/policy_external/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_external/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include <map> #include "policy/policy_table/types.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "policy/access_remote.h" #include "policy/cache_manager.h" @@ -46,7 +46,7 @@ namespace policy { class AccessRemoteImpl : public AccessRemote { public: AccessRemoteImpl(); - explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -144,7 +144,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr<CacheManager> cache_; + std::shared_ptr<CacheManager> cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_external/include/policy/cache_manager.h b/src/components/policy/policy_external/include/policy/cache_manager.h index f41ddb14cd..36ddaf0415 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager.h +++ b/src/components/policy/policy_external/include/policy/cache_manager.h @@ -35,7 +35,7 @@ #include <map> -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -232,7 +232,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -720,7 +720,7 @@ class CacheManager : public CacheManagerInterface { void SetExternalConsentForApp(const PermissionConsent& permissions) OVERRIDE; #ifdef BUILD_TESTS - utils::SharedPtr<policy_table::Table> GetPT() const { + std::shared_ptr<policy_table::Table> GetPT() const { return pt_; } #endif @@ -782,10 +782,10 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; - utils::SharedPtr<PTExtRepresentation> ex_backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; + std::shared_ptr<PTExtRepresentation> ex_backup_; bool update_required; typedef std::set<std::string> UnpairedDevices; UnpairedDevices is_unpaired_; diff --git a/src/components/policy/policy_external/include/policy/cache_manager_interface.h b/src/components/policy/policy_external/include/policy/cache_manager_interface.h index 1d74780f19..bb9ce14c7f 100644 --- a/src/components/policy/policy_external/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_external/include/policy/cache_manager_interface.h @@ -38,7 +38,7 @@ #include "policy/policy_table/types.h" #include "policy/pt_representation.h" -#include "utils/shared_ptr.h" + #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" @@ -237,7 +237,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -823,16 +823,16 @@ class CacheManagerInterface { #ifdef BUILD_TESTS /** - * @brief GetPT allows to obtain SharedPtr to PT. + * @brief GetPT allows to obtain std::shared_ptr to PT. * Used ONLY in Unit tests - * @return SharedPTR to PT + * @return std::shared_ptr to PT * */ - virtual utils::SharedPtr<policy_table::Table> GetPT() const = 0; + virtual std::shared_ptr<policy_table::Table> GetPT() const = 0; #endif }; -typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_external/include/policy/policy_helper.h b/src/components/policy/policy_external/include/policy/policy_helper.h index e399b44719..e446c0b2e3 100644 --- a/src/components/policy/policy_external/include/policy/policy_helper.h +++ b/src/components/policy/policy_external/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -85,8 +85,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot, + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot, CheckAppPolicyResults& out_results); bool operator()(const AppPoliciesValueType& app_policy); @@ -202,8 +202,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> snapshot_; CheckAppPolicyResults& out_results_; }; diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h index 67756c053d..3837dda1fa 100644 --- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_ #include <list> -#include "utils/shared_ptr.h" + #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.h" @@ -472,7 +472,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Setter for access_remote instance * @param access_remote pointer to new access_remote instance */ - void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -717,7 +717,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> Parse( const BinaryMessage& pt_content); private: @@ -736,8 +736,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ CheckAppPolicyResults CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); /** * @brief Processes results from policy table update analysis done by @@ -860,7 +860,7 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; /** @@ -1017,7 +1017,7 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief pointer to AccessRemote instance for working with RC applications */ - utils::SharedPtr<AccessRemote> access_remote_; + std::shared_ptr<AccessRemote> access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_external/include/policy/policy_table.h b/src/components/policy/policy_external/include/policy/policy_table.h index ecbd56c2e4..27f4cc33a2 100644 --- a/src/components/policy/policy_external/include/policy/policy_table.h +++ b/src/components/policy/policy_external/include/policy/policy_table.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_EXTERNAL_INCLUDE_POLICY_POLICY_TABLE_H_ -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" @@ -42,7 +42,7 @@ namespace policy { class PolicyTable { public: PolicyTable(); - explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +50,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_external/include/policy/policy_types.h b/src/components/policy/policy_external/include/policy/policy_types.h index 9682b3d58d..078595e8b1 100644 --- a/src/components/policy/policy_external/include/policy/policy_types.h +++ b/src/components/policy/policy_external/include/policy/policy_types.h @@ -39,7 +39,7 @@ #include <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +79,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; diff --git a/src/components/policy/policy_external/include/policy/pt_representation.h b/src/components/policy/policy_external/include/policy/pt_representation.h index 66a9218771..f25fcc6cab 100644 --- a/src/components/policy/policy_external/include/policy/pt_representation.h +++ b/src/components/policy/policy_external/include/policy/pt_representation.h @@ -213,7 +213,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_external/include/policy/sql_pt_representation.h b/src/components/policy/policy_external/include/policy/sql_pt_representation.h index d56f6aeba2..13816eb6c5 100644 --- a/src/components/policy/policy_external/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_external/include/policy/sql_pt_representation.h @@ -85,7 +85,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const; virtual bool Save(const policy_table::Table& table); bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = NULL, diff --git a/src/components/policy/policy_external/include/policy/update_status_manager.h b/src/components/policy/policy_external/include/policy/update_status_manager.h index b663610a5b..cdd1225ef7 100644 --- a/src/components/policy/policy_external/include/policy/update_status_manager.h +++ b/src/components/policy/policy_external/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr<Status> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -199,17 +199,17 @@ class UpdateStatusManager { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; diff --git a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h index adaef0eb28..c145bb432b 100644 --- a/src/components/policy/policy_external/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_external/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include <ctime> #include "policy/usage_statistics/statistics_manager.h" #include "policy/usage_statistics/app_stopwatch.h" -#include "utils/shared_ptr.h" + #include "utils/timer.h" #include "utils/macro.h" @@ -46,18 +46,18 @@ using timer::Timer; class GlobalCounter { public: - GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type); void operator++() const; @@ -65,12 +65,12 @@ class AppCounter { private: std::string app_id_; AppCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type); void Update(const std::string& new_info) const; @@ -78,14 +78,14 @@ class AppInfo { private: std::string app_id_; AppInfoId info_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, std::uint32_t timeout); ~AppStopwatchImpl(); @@ -97,7 +97,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); diff --git a/src/components/policy/policy_external/src/access_remote_impl.cc b/src/components/policy/policy_external/src/access_remote_impl.cc index d042d8c402..26c8c5e38e 100644 --- a/src/components/policy/policy_external/src/access_remote_impl.cc +++ b/src/components/policy/policy_external/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_external/src/cache_manager.cc b/src/components/policy/policy_external/src/cache_manager.cc index 00bb1e4a1c..b30ed3c224 100644 --- a/src/components/policy/policy_external/src/cache_manager.cc +++ b/src/components/policy/policy_external/src/cache_manager.cc @@ -1627,8 +1627,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1670,7 +1670,7 @@ void CacheManager::PersistData() { } // In case of extended policy the meta info should be backuped as well. - if (ex_backup_.valid()) { + if (ex_backup_.use_count() != 0) { ex_backup_->SetMetaInfo( *(*copy_pt.policy_table.module_meta).ccpu_version, *(*copy_pt.policy_table.module_meta).wers_country_code, @@ -1750,7 +1750,7 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); snapshot_ = new policy_table::Table(); sync_primitives::AutoLock auto_lock(cache_lock_); @@ -2237,7 +2237,7 @@ bool CacheManager::Init(const std::string& file_name, LOG4CXX_AUTO_TRACE(logger_); settings_ = settings; InitResult init_result = backup_->Init(settings); - ex_backup_ = utils::SharedPtr<PTRepresentation>::dynamic_pointer_cast< + ex_backup_ = std::dynamic_pointer_cast< PTExtRepresentation>(backup_); bool result = true; @@ -2261,7 +2261,7 @@ bool CacheManager::Init(const std::string& file_name, case InitResult::SUCCESS: { LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, diff --git a/src/components/policy/policy_external/src/policy_helper.cc b/src/components/policy/policy_external/src/policy_helper.cc index 39b9399c24..ed12cdde3a 100644 --- a/src/components/policy/policy_external/src/policy_helper.cc +++ b/src/components/policy/policy_external/src/policy_helper.cc @@ -122,8 +122,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot, + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot, CheckAppPolicyResults& out_results) : pm_(pm) , update_(update) diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc index 4ac66c0d53..c75d14a67a 100644 --- a/src/components/policy/policy_external/src/policy_manager_impl.cc +++ b/src/components/policy/policy_external/src/policy_manager_impl.cc @@ -49,7 +49,7 @@ #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" -#include "utils/make_shared.h" + #include "policy/access_remote.h" #include "policy/access_remote_impl.h" @@ -214,7 +214,7 @@ PolicyManagerImpl::PolicyManagerImpl() , listener_(NULL) , cache_(new CacheManager) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) @@ -225,7 +225,7 @@ PolicyManagerImpl::PolicyManagerImpl(bool in_memory) , listener_(NULL) , cache_(new CacheManager(in_memory)) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(60) , retry_sequence_index_(0) , ignition_check(true) @@ -239,7 +239,7 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { update_status_manager_.set_listener(listener); } -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -247,7 +247,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( if (reader.parse(json.c_str(), value)) { return new policy_table::Table(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -279,7 +279,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, "PTU content is: " << std::string(pt_content.begin(), pt_content.end())); // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is NULL."); update_status_manager_.OnWrongUpdateReceived(); @@ -301,7 +301,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -363,8 +363,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } CheckAppPolicyResults PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -468,7 +468,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, void PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -1276,7 +1276,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -1367,7 +1367,7 @@ void PolicyManagerImpl::SendPermissionsToApp( Permissions notification_data; // Need to get rid of this call - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); PrepareNotificationData( @@ -1775,11 +1775,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, + return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -2024,7 +2024,7 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } diff --git a/src/components/policy/policy_external/src/policy_table.cc b/src/components/policy/policy_external/src/policy_table.cc index 7a63fac50d..8ca6b698d1 100644 --- a/src/components/policy/policy_external/src/policy_table.cc +++ b/src/components/policy/policy_external/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTExtRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc index 3cd7388672..47a7cb6623 100644 --- a/src/components/policy/policy_external/src/sql_pt_representation.cc +++ b/src/components/policy/policy_external/src/sql_pt_representation.cc @@ -513,10 +513,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + std::shared_ptr<policy_table::Table> table = new policy_table::Table(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); diff --git a/src/components/policy/policy_external/src/status.cc b/src/components/policy/policy_external/src/status.cc index 31fc7f110b..34f65339c1 100644 --- a/src/components/policy/policy_external/src/status.cc +++ b/src/components/policy/policy_external/src/status.cc @@ -32,7 +32,7 @@ #include "policy/status.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + policy::UpToDateStatus::UpToDateStatus() : Status(kUpToDate, policy::PolicyTableStatus::StatusUpToDate) {} @@ -45,7 +45,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManager* manager, case kScheduleUpdate: case kScheduleManualUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,14 +59,14 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManager* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; default: break; @@ -85,23 +85,23 @@ void policy::UpdatingStatus::ProcessEvent(policy::UpdateStatusManager* manager, switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kScheduleManualUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_external/src/update_status_manager.cc b/src/components/policy/policy_external/src/update_status_manager.cc index 087db1149b..aee22a3b0c 100644 --- a/src/components/policy/policy_external/src/update_status_manager.cc +++ b/src/components/policy/policy_external/src/update_status_manager.cc @@ -33,7 +33,7 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace policy { @@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) { @@ -67,11 +67,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_external/src/usage_statistics/counter.cc b/src/components/policy/policy_external/src/usage_statistics/counter.cc index 661ea29704..a7e8368239 100644 --- a/src/components/policy/policy_external/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_external/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -53,7 +53,7 @@ void GlobalCounter::operator++() const { } AppCounter::AppCounter( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -67,7 +67,7 @@ void AppCounter::operator++() const { } AppInfo::AppInfo( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -81,7 +81,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager, + std::shared_ptr<usage_statistics::StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -92,7 +92,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) diff --git a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h index 995c63ed20..3870e4ece1 100644 --- a/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h +++ b/src/components/policy/policy_external/test/include/policy/mock_pt_representation.h @@ -78,7 +78,7 @@ class MockPTRepresentation : virtual public ::policy::PTRepresentation { MOCK_METHOD0(Close, bool()); MOCK_METHOD0(Clear, bool()); MOCK_METHOD0(Drop, bool()); - MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); MOCK_METHOD1(SaveUpdateRequired, void(bool value)); diff --git a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h index e753751308..23701e86de 100644 --- a/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h +++ b/src/components/policy/policy_external/test/include/policy/policy_manager_impl_test_base.h @@ -54,7 +54,7 @@ using ::policy::PolicyManagerImpl; typedef std::multimap<std::string, policy_table::Rpcs&> UserConsentPromptToRpcsConnections; -typedef utils::SharedPtr<policy_table::Table> PolicyTableSPtr; +typedef std::shared_ptr<policy_table::Table> PolicyTableSPtr; namespace { const std::string kSdlPreloadedPtJson = "json/sdl_preloaded_pt.json"; @@ -203,7 +203,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { void EmulatePTAppRevoked(const std::string& ptu_name); - utils::SharedPtr<policy_table::Table> PreconditionForBasicValidateSnapshot(); + std::shared_ptr<policy_table::Table> PreconditionForBasicValidateSnapshot(); template <typename ParentType, typename Value> bool IsKeyExisted(const ParentType& parent, const Value& value) const { @@ -236,7 +236,7 @@ class PolicyManagerImplTest_RequestTypes : public ::testing::Test { const std::string app_storage_folder_; const std::string preloaded_pt_filename_; - utils::SharedPtr<PolicyManagerImpl> policy_manager_impl_sptr_; + std::shared_ptr<PolicyManagerImpl> policy_manager_impl_sptr_; NiceMock<MockPolicyListener> listener_; NiceMock<policy_handler_test::MockPolicySettings> policy_settings_; diff --git a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc index 947bb5d3ad..537e40e170 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_ptu_test.cc @@ -1092,7 +1092,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT(preloaded_pt_filename_); GetPTU(kValidSdlPtUpdateJson); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = policy_manager_->GetVehicleInfo(); @@ -1202,7 +1202,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT(preloaded_pt_filename_); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; @@ -1302,7 +1302,7 @@ TEST_F(PolicyManagerImplTest2, actual_groups_permissions[index].group_name); EXPECT_EQ(group1_perm.group_id, actual_groups_permissions[index].group_id); EXPECT_EQ(group1_perm.state, actual_groups_permissions[index].state); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); uint32_t ucr_size = 0; ::policy_table::DeviceData& device_data = *pt->policy_table.device_data; diff --git a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc index e666ac82de..c1ff31f748 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_snapshot_test.cc @@ -84,7 +84,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) { EXPECT_TRUE(cache->IsPTPreloaded()); // Arrange - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Get FunctionalGroupings policy_table::FunctionalGroupings& fc = table->policy_table.functional_groupings; @@ -119,7 +119,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT(preloaded_pt_filename_); policy_manager_->SetSystemLanguage("it-it"); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ("it-it", static_cast<std::string>(*(ModuleMeta.language))); @@ -130,7 +130,7 @@ TEST_F(PolicyManagerImplTest2, SetVINValue_ExpectVINSetSuccessfully) { CreateLocalPT(preloaded_pt_filename_); std::string vin_code("1FAPP6242VH100001"); policy_manager_->SetVINValue(vin_code); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ(vin_code, static_cast<std::string>(*(ModuleMeta.vin))); @@ -141,7 +141,7 @@ TEST_F(PolicyManagerImplTest2, SetSystemInfo_ExpectSystemInfoSetSuccessfully) { CreateLocalPT(preloaded_pt_filename_); policy_manager_->SetSystemInfo("4.1.3.B_EB355B", "WAEGB", "ru-ru"); policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache(); - utils::SharedPtr<policy_table::Table> pt = cache->GetPT(); + std::shared_ptr<policy_table::Table> pt = cache->GetPT(); ::policy_table::ModuleMeta& ModuleMeta = *(pt->policy_table.module_meta); EXPECT_EQ("ru-ru", static_cast<std::string>(*(ModuleMeta.language))); EXPECT_EQ("4.1.3.B_EB355B", @@ -189,7 +189,7 @@ TEST_F(PolicyManagerImplTest2, CleanUnpairedDevice_ExpectDevicesDeleted) { policy_manager_->AddDevice("AAA123456789RRR", "Bluetooth"); policy_manager_->SetDeviceInfo("AAA123456789RRR", dev_info3); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); // Try to find first device in PT policy_table::DeviceData::const_iterator iter = @@ -316,7 +316,7 @@ TEST_F(PolicyManagerImplTest2, AddDevice_RegisterDevice_TRUE) { const bool result = (policy_manager_->GetCache())->AddDevice(device_id_1_, connection_type); // Get Policy table - const utils::SharedPtr<policy_table::Table> policy_table = + const std::shared_ptr<policy_table::Table> policy_table = policy_manager_->GetCache()->GetPT(); // Get preloaded_pt flag from Policy table const bool is_preloaded_pt = diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_test.cc index f4e922e647..f049018848 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test.cc @@ -37,8 +37,8 @@ #include <utility> #include "policy/policy_manager_impl_test_base.h" -#include "utils/make_shared.h" -#include "utils/shared_ptr.h" + + using ::testing::_; using ::testing::Return; @@ -148,7 +148,7 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) { std::string json = table.toStyledString(); ::policy::BinaryMessage msg(json.begin(), json.end()); - utils::SharedPtr<policy_table::Table> snapshot = + std::shared_ptr<policy_table::Table> snapshot = new policy_table::Table(update.policy_table); // Assert EXPECT_CALL(*cache_manager_, GenerateSnapshot()).WillOnce(Return(snapshot)); @@ -236,8 +236,8 @@ TEST_F(PolicyManagerImplTest2, TimeOutExchange) { TEST_F(PolicyManagerImplTest, RequestPTUpdate_SetPT_GeneratedSnapshotAndPTUpdate) { Json::Value table = createPTforLoad(); - utils::SharedPtr<policy_table::Table> p_table = - utils::MakeShared<policy_table::Table>(&table); + std::shared_ptr<policy_table::Table> p_table = + std::make_shared<policy_table::Table>(&table); ASSERT_TRUE(p_table); p_table->SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE); EXPECT_TRUE(IsValid(*p_table)); @@ -249,8 +249,8 @@ TEST_F(PolicyManagerImplTest, } TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) { - utils::SharedPtr<policy_table::Table> p_table = - utils::MakeShared<policy_table::Table>(); + std::shared_ptr<policy_table::Table> p_table = + std::make_shared<policy_table::Table>(); ASSERT_TRUE(p_table); EXPECT_FALSE(IsValid(*p_table)); @@ -261,7 +261,7 @@ TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidPT_PTUpdateFail) { } TEST_F(PolicyManagerImplTest, RequestPTUpdate_InvalidSnapshot_PTUpdateFail) { - utils::SharedPtr<policy_table::Table> p_table; + std::shared_ptr<policy_table::Table> p_table; EXPECT_FALSE(p_table); EXPECT_CALL(listener_, OnSnapshotCreated(_, _, _)).Times(0); @@ -355,7 +355,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking groups consents before setting ExternalConsent status @@ -420,7 +420,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking ExternalConsent consents before setting new ExternalConsent status @@ -484,7 +484,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppPolicy(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -552,7 +552,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppPolicy(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -634,7 +634,7 @@ TEST_F( HmiTypes(policy_table::AHT_DEFAULT)); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -724,7 +724,7 @@ TEST_F( HmiTypes(policy_table::AHT_DEFAULT)); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); ExternalConsentStatus status; @@ -818,7 +818,7 @@ TEST_F(PolicyManagerImplTest_ExternalConsent, policy_manager_->AddApplication(app_id_1_, HmiTypes(policy_table::AHT_DEFAULT)); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Check ExternalConsent consents for application @@ -943,7 +943,7 @@ TEST_F(PolicyManagerImplTest_ExternalConsent, policy_manager_->AddApplication(app_id_1_, HmiTypes(policy_table::AHT_DEFAULT)); - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Check ExternalConsent consents for application @@ -1046,7 +1046,7 @@ TEST_F( PreconditionExternalConsentPreparePTWithAppGroupsAndConsents(); // Act - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = policy_manager_->GetCache()->GetPT(); // Checking ExternalConsent consents before setting new ExternalConsent status diff --git a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc index 48e86d24b7..86b7cdc9ef 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_test_base.cc @@ -38,7 +38,7 @@ #include "policy/policy_manager_impl_test_base.h" #include "utils/file_system.h" -#include "utils/make_shared.h" + #include "utils/gen_hash.h" #include "json/reader.h" @@ -414,7 +414,7 @@ void PolicyManagerImplTest2::GetFunctionalGroupingsFromManager( // Get cache ::policy::CacheManagerInterfaceSPtr cache = policy_manager_->GetCache(); // Get table_snapshot - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Set functional groupings from policy table input_functional_groupings = table->policy_table.functional_groupings; } @@ -639,7 +639,7 @@ void PolicyManagerImplTest_RequestTypes::SetUp() { file_system::CreateDirectory(app_storage_folder_); const bool in_memory = true; - policy_manager_impl_sptr_ = utils::MakeShared<PolicyManagerImpl>(in_memory); + policy_manager_impl_sptr_ = std::make_shared<PolicyManagerImpl>(in_memory); policy_manager_impl_sptr_->set_listener(&listener_); } diff --git a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc index 2f2162494f..404991c969 100644 --- a/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc +++ b/src/components/policy/policy_external/test/policy_manager_impl_user_consent_test.cc @@ -395,7 +395,7 @@ TEST_F(PolicyManagerImplTest2, uint32_t size = result.size(); EXPECT_GT(size, 0u); std::vector< ::policy::UserFriendlyMessage>::iterator result_iter; - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); policy_table::ConsumerFriendlyMessages& consumer_friendly_messages = @@ -456,7 +456,7 @@ TEST_F(PolicyManagerImplTest2, TEST_F(PolicyManagerImplTest2, SetDeviceInfo_ExpectDevInfoAddedToPT) { // Arrange ::policy::DeviceInfo dev_info; - utils::SharedPtr<policy_table::Table> pt = + std::shared_ptr<policy_table::Table> pt = (policy_manager_->GetCache())->GetPT(); dev_info.hardware = "hardware IPX"; dev_info.firmware_rev = "v.8.0.1"; diff --git a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc index 92525c646d..fc4b0ae7b0 100644 --- a/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_ext_representation_test.cc @@ -44,8 +44,8 @@ #include "rpc_base/rpc_base.h" #include "policy/policy_table/types.h" #include "policy/mock_policy_settings.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + using namespace ::policy; namespace policy_table = rpc::policy_table_interface_base; @@ -393,7 +393,7 @@ TEST_F(SQLPTExtRepresentationTest, ASSERT_TRUE(reps_->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps_->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps_->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); policy_table["module_meta"] = Json::Value(Json::objectValue); @@ -1506,7 +1506,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveUserConsentRecords_ExpectedSaved) { // Act EXPECT_TRUE(reps_->Save(original_table)); - utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot(); + std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot(); // GetData/GetKeyData methods do internal existence check - no need to do it // separately. In case of data is missing expectations will be violated. @@ -1591,7 +1591,7 @@ TEST_F(SQLPTExtRepresentationTest, SaveFunctionalGroupings_ExpectedSaved) { // Act EXPECT_TRUE(reps_->Save(original_table)); - utils::SharedPtr<Table> loaded_table = reps_->GenerateSnapshot(); + std::shared_ptr<Table> loaded_table = reps_->GenerateSnapshot(); FunctionalGroupings loaded_groupings = GetData<Table, FunctionalGroupings>(*loaded_table); diff --git a/src/components/policy/policy_external/test/sql_pt_representation_test.cc b/src/components/policy/policy_external/test/sql_pt_representation_test.cc index a5589cc904..bfcf9f2172 100644 --- a/src/components/policy/policy_external/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_external/test/sql_pt_representation_test.cc @@ -49,7 +49,7 @@ #include "policy/policy_table/enums.h" #include "rpc_base/rpc_base.h" #include "policy/mock_policy_settings.h" -#include "utils/shared_ptr.h" + namespace policy_table = rpc::policy_table_interface_base; using policy::SQLPTRepresentation; @@ -1585,7 +1585,7 @@ TEST_F(SQLPTRepresentationTest, ASSERT_TRUE(reps->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); // Remove fields which must be absent in snapshot table["policy_table"]["consumer_friendly_messages"].removeMember("messages"); diff --git a/src/components/policy/policy_external/test/update_status_manager_test.cc b/src/components/policy/policy_external/test/update_status_manager_test.cc index 5546984ff4..278c4fc43a 100644 --- a/src/components/policy/policy_external/test/update_status_manager_test.cc +++ b/src/components/policy/policy_external/test/update_status_manager_test.cc @@ -34,7 +34,7 @@ #include "policy/mock_policy_listener.h" #include "policy/policy_manager_impl.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + #include "utils/conditional_variable.h" namespace test { @@ -48,7 +48,7 @@ using testing::NiceMock; class UpdateStatusManagerTest : public ::testing::Test { protected: - utils::SharedPtr<UpdateStatusManager> manager_; + std::shared_ptr<UpdateStatusManager> manager_; PolicyTableStatus status_; const uint32_t k_timeout_; NiceMock<MockPolicyListener> listener_; @@ -58,7 +58,7 @@ class UpdateStatusManagerTest : public ::testing::Test { public: UpdateStatusManagerTest() - : manager_(utils::MakeShared<UpdateStatusManager>()) + : manager_(std::make_shared<UpdateStatusManager>()) , k_timeout_(1000) , listener_() , up_to_date_status_("UP_TO_DATE") diff --git a/src/components/policy/policy_regular/include/policy/access_remote_impl.h b/src/components/policy/policy_regular/include/policy/access_remote_impl.h index 933690dc49..dbe317667a 100644 --- a/src/components/policy/policy_regular/include/policy/access_remote_impl.h +++ b/src/components/policy/policy_regular/include/policy/access_remote_impl.h @@ -35,7 +35,7 @@ #include <map> #include "policy/policy_table/types.h" #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "policy/access_remote.h" #include "policy/cache_manager.h" @@ -46,7 +46,7 @@ namespace policy { class AccessRemoteImpl : public AccessRemote { public: AccessRemoteImpl(); - explicit AccessRemoteImpl(utils::SharedPtr<CacheManager> cache); + explicit AccessRemoteImpl(std::shared_ptr<CacheManager> cache); /** * @brief CheckModuleType check if module type is allowed for application * @param app_id application id @@ -139,7 +139,7 @@ class AccessRemoteImpl : public AccessRemote { /** * @brief cache_ contains pointer to cache manager instance */ - utils::SharedPtr<CacheManager> cache_; + std::shared_ptr<CacheManager> cache_; /** * @brief hmi_types_ contains list of default HMI types for applications diff --git a/src/components/policy/policy_regular/include/policy/cache_manager.h b/src/components/policy/policy_regular/include/policy/cache_manager.h index 4a0a09db83..236722415f 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager.h @@ -35,7 +35,7 @@ #include <map> -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" #include "policy/usage_statistics/statistics_manager.h" @@ -216,7 +216,7 @@ class CacheManager : public CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot(); + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot(); /** * Applies policy table to the current table @@ -723,7 +723,7 @@ class CacheManager : public CacheManagerInterface { const PolicySettings& get_settings() const; - utils::SharedPtr<policy_table::Table> pt() const { + std::shared_ptr<policy_table::Table> pt() const { return pt_; } @@ -775,9 +775,9 @@ class CacheManager : public CacheManagerInterface { policy::Permissions& permission); private: - utils::SharedPtr<policy_table::Table> pt_; - utils::SharedPtr<policy_table::Table> snapshot_; - utils::SharedPtr<PTRepresentation> backup_; + std::shared_ptr<policy_table::Table> pt_; + std::shared_ptr<policy_table::Table> snapshot_; + std::shared_ptr<PTRepresentation> backup_; bool update_required; typedef std::set<std::string> UnpairedDevices; UnpairedDevices is_unpaired_; diff --git a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h index 3dd2953865..ba6728c520 100644 --- a/src/components/policy/policy_regular/include/policy/cache_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/cache_manager_interface.h @@ -36,7 +36,7 @@ #include <string> #include <vector> -#include "utils/shared_ptr.h" + #include "policy/usage_statistics/counter.h" #include "policy/policy_types.h" #include "policy/policy_settings.h" @@ -222,7 +222,7 @@ class CacheManagerInterface { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() = 0; /** * Applies policy table to the current table @@ -670,12 +670,12 @@ class CacheManagerInterface { virtual std::string GetCertificate() const = 0; /** - * @brief pt allows to obtain SharedPtr to PT. + * @brief pt allows to obtain std::shared_ptr to PT. * Used ONLY in Unit tests - * @return SharedPTR to PT + * @return std::shared_ptr to PT * */ - virtual utils::SharedPtr<policy_table::Table> pt() const = 0; + virtual std::shared_ptr<policy_table::Table> pt() const = 0; /** * @brief OnDeviceSwitching Processes existing policy permissions for devices @@ -687,7 +687,7 @@ class CacheManagerInterface { const std::string& device_id_to) = 0; }; -typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr; +typedef std::shared_ptr<CacheManagerInterface> CacheManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_helper.h b/src/components/policy/policy_regular/include/policy/policy_helper.h index 7f27ab2676..3ca0f93ebd 100644 --- a/src/components/policy/policy_regular/include/policy/policy_helper.h +++ b/src/components/policy/policy_regular/include/policy/policy_helper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_HELPER_H_ #include "policy/policy_table/functions.h" -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" namespace policy { @@ -82,8 +82,8 @@ bool operator!=(const policy_table::ApplicationParams& first, */ struct CheckAppPolicy { CheckAppPolicy(PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); bool operator()(const AppPoliciesValueType& app_policy); private: @@ -131,8 +131,8 @@ struct CheckAppPolicy { private: PolicyManagerImpl* pm_; - const utils::SharedPtr<policy_table::Table> update_; - const utils::SharedPtr<policy_table::Table> snapshot_; + const std::shared_ptr<policy_table::Table> update_; + const std::shared_ptr<policy_table::Table> snapshot_; }; /* diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h index c162d73011..549fdd5a53 100644 --- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h +++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h @@ -37,7 +37,7 @@ #include <list> #include <cstdint> -#include "utils/shared_ptr.h" + #include "utils/lock.h" #include "policy/policy_manager.h" #include "policy/policy_table.h" @@ -467,7 +467,7 @@ class PolicyManagerImpl : public PolicyManager { * @brief Setter for access_remote instance * @param access_remote pointer to new access_remote instance */ - void set_access_remote(utils::SharedPtr<AccessRemote> access_remote) OVERRIDE; + void set_access_remote(std::shared_ptr<AccessRemote> access_remote) OVERRIDE; /** * @brief Sends notification about application HMI level changed @@ -671,7 +671,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> Parse( + virtual std::shared_ptr<policy_table::Table> Parse( const BinaryMessage& pt_content); #else /** @@ -679,7 +679,7 @@ class PolicyManagerImpl : public PolicyManager { * @param pt_content binary content of PT * @return pointer to converted PT */ - virtual utils::SharedPtr<policy_table::Table> ParseArray( + virtual std::shared_ptr<policy_table::Table> ParseArray( const BinaryMessage& pt_content); #endif @@ -705,8 +705,8 @@ class PolicyManagerImpl : public PolicyManager { * @return Collection per-application results */ void CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot); + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot); /** * @brief Fill structure to be sent with OnPermissionsChanged notification @@ -803,7 +803,7 @@ class PolicyManagerImpl : public PolicyManager { * @param type policy table type * @return true if policy table valid, otherwise false */ - bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table, + bool IsPTValid(std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const; /** @@ -867,7 +867,7 @@ class PolicyManagerImpl : public PolicyManager { /** * @brief pointer to AccessRemote instance for working with RC applications */ - utils::SharedPtr<AccessRemote> access_remote_; + std::shared_ptr<AccessRemote> access_remote_; /** * @brief lock guard for protecting applications list access diff --git a/src/components/policy/policy_regular/include/policy/policy_table.h b/src/components/policy/policy_regular/include/policy/policy_table.h index afee8a34e4..9531bb8c79 100644 --- a/src/components/policy/policy_regular/include/policy/policy_table.h +++ b/src/components/policy/policy_regular/include/policy/policy_table.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_POLICY_TABLE_H_ -#include "utils/shared_ptr.h" + #include "policy/pt_representation.h" #include "policy/pt_ext_representation.h" @@ -42,7 +42,7 @@ namespace policy { class PolicyTable { public: PolicyTable(); - explicit PolicyTable(utils::SharedPtr<PTRepresentation> pt_data); + explicit PolicyTable(std::shared_ptr<PTRepresentation> pt_data); virtual ~PolicyTable(); /** @@ -50,12 +50,12 @@ class PolicyTable { * actual class storing policy table. * @return PTRepresentation* Policy Table Content Handler */ - utils::SharedPtr<PTRepresentation> pt_data() const { + std::shared_ptr<PTRepresentation> pt_data() const { return pt_data_; } private: - utils::SharedPtr<PTRepresentation> pt_data_; + std::shared_ptr<PTRepresentation> pt_data_; }; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/policy_types.h b/src/components/policy/policy_regular/include/policy/policy_types.h index e0fc808e2f..276a0a5dca 100644 --- a/src/components/policy/policy_regular/include/policy/policy_types.h +++ b/src/components/policy/policy_regular/include/policy/policy_types.h @@ -39,7 +39,8 @@ #include <map> #include <set> #include <utility> -#include "utils/shared_ptr.h" +#include <memory> + #include "utils/helpers.h" #include "transport_manager/common.h" @@ -79,7 +80,7 @@ enum PolicyTableStatus { // Code generator uses String class name, so this typedef was renamed to PTSring typedef std::string PTString; typedef std::vector<uint8_t> BinaryMessage; -typedef utils::SharedPtr<BinaryMessage> BinaryMessageSptr; +typedef std::shared_ptr<BinaryMessage> BinaryMessageSptr; typedef std::string HMILevel; typedef std::string Parameter; diff --git a/src/components/policy/policy_regular/include/policy/pt_representation.h b/src/components/policy/policy_regular/include/policy/pt_representation.h index 08bd6d4923..378a294532 100644 --- a/src/components/policy/policy_regular/include/policy/pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/pt_representation.h @@ -35,9 +35,11 @@ #include <vector> #include <string> +#include <memory> #include "policy/policy_types.h" #include "policy/policy_table/types.h" #include "policy/policy_settings.h" +#include "utils/macro.h" namespace policy { namespace policy_table = rpc::policy_table_interface_base; @@ -208,7 +210,7 @@ class PTRepresentation { * device_info, statistics, excluding user messages * @return Generated structure for obtaining Json string. */ - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const = 0; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const = 0; virtual bool Save(const policy_table::Table& table) = 0; diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h index b26b2c9ede..0e9302dfac 100644 --- a/src/components/policy/policy_regular/include/policy/sql_pt_representation.h +++ b/src/components/policy/policy_regular/include/policy/sql_pt_representation.h @@ -84,7 +84,7 @@ class SQLPTRepresentation : public virtual PTRepresentation { bool Clear(); bool Drop(); virtual void WriteDb(); - virtual utils::SharedPtr<policy_table::Table> GenerateSnapshot() const; + virtual std::shared_ptr<policy_table::Table> GenerateSnapshot() const; virtual bool Save(const policy_table::Table& table); bool GetInitialAppData(const std::string& app_id, StringArray* nicknames = NULL, diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager.h b/src/components/policy/policy_regular/include/policy/update_status_manager.h index a68d986d10..52d5b92b8a 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager.h @@ -66,14 +66,14 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - void SetNextStatus(utils::SharedPtr<Status> status); + void SetNextStatus(std::shared_ptr<Status> status); /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - void SetPostponedStatus(utils::SharedPtr<Status> status); + void SetPostponedStatus(std::shared_ptr<Status> status); /** * @brief Sets listener pointer @@ -198,17 +198,17 @@ class UpdateStatusManager : public UpdateStatusManagerInterface { /** * @brief Current update status */ - utils::SharedPtr<Status> current_status_; + std::shared_ptr<Status> current_status_; /** * @brief Next status after current to be set */ - utils::SharedPtr<Status> next_status_; + std::shared_ptr<Status> next_status_; /** * @brief Status to be set after 'next' status */ - utils::SharedPtr<Status> postponed_status_; + std::shared_ptr<Status> postponed_status_; sync_primitives::Lock status_lock_; UpdateEvent last_processed_event_; diff --git a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h index e118f9974f..520615489a 100644 --- a/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h +++ b/src/components/policy/policy_regular/include/policy/update_status_manager_interface.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ #define SRC_COMPONENTS_POLICY_POLICY_REGULAR_INCLUDE_POLICY_UPDATE_STATUS_MANAGER_INTERFACE_H_ -#include "utils/shared_ptr.h" + #include "policy/policy_types.h" #include "policy/status.h" @@ -55,14 +55,14 @@ class UpdateStatusManagerInterface { * @brief Set next status during event processing * @param status Status shared pointer */ - virtual void SetNextStatus(utils::SharedPtr<Status> status) = 0; + virtual void SetNextStatus(std::shared_ptr<Status> status) = 0; /** * @brief Set postponed status (will be set after next status) during event * processing * @param status Status shared pointer */ - virtual void SetPostponedStatus(utils::SharedPtr<Status> status) = 0; + virtual void SetPostponedStatus(std::shared_ptr<Status> status) = 0; /** * @brief Sets listener pointer * @param listener Pointer to policy listener implementation @@ -112,7 +112,7 @@ class UpdateStatusManagerInterface { virtual void OnPolicyInit(bool is_update_required) = 0; }; -typedef utils::SharedPtr<UpdateStatusManagerInterface> +typedef std::shared_ptr<UpdateStatusManagerInterface> UpdateStatusManagerInterfaceSPtr; } // namespace policy diff --git a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h index 1e263ec9df..72ae5fd9e0 100644 --- a/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h +++ b/src/components/policy/policy_regular/include/policy/usage_statistics/counter.h @@ -36,7 +36,7 @@ #include <ctime> #include "policy/usage_statistics/statistics_manager.h" #include "policy/usage_statistics/app_stopwatch.h" -#include "utils/shared_ptr.h" + #include "utils/timer.h" #include "utils/macro.h" @@ -46,18 +46,18 @@ using timer::Timer; class GlobalCounter { public: - GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + GlobalCounter(std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type); void operator++() const; private: GlobalCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppCounter { public: - AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, + AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type); void operator++() const; @@ -65,12 +65,12 @@ class AppCounter { private: std::string app_id_; AppCounterId counter_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppInfo { public: - AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, + AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type); void Update(const std::string& new_info) const; @@ -78,14 +78,14 @@ class AppInfo { private: std::string app_id_; AppInfoId info_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; }; class AppStopwatchImpl : public AppStopwatch { public: - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id); - AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager, + AppStopwatchImpl(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, std::uint32_t timeout); void Start(AppStopwatchId stopwatch_type) OVERRIDE; @@ -96,7 +96,7 @@ class AppStopwatchImpl : public AppStopwatch { // Fields std::string app_id_; AppStopwatchId stopwatch_type_; - utils::SharedPtr<StatisticsManager> statistics_manager_; + std::shared_ptr<StatisticsManager> statistics_manager_; timer::Timer timer_; const std::uint32_t time_out_; DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl); diff --git a/src/components/policy/policy_regular/src/access_remote_impl.cc b/src/components/policy/policy_regular/src/access_remote_impl.cc index f99b226f2e..f743a4d56e 100644 --- a/src/components/policy/policy_regular/src/access_remote_impl.cc +++ b/src/components/policy/policy_regular/src/access_remote_impl.cc @@ -89,7 +89,7 @@ struct ToModuleType { AccessRemoteImpl::AccessRemoteImpl() : cache_(new CacheManager()) {} -AccessRemoteImpl::AccessRemoteImpl(utils::SharedPtr<CacheManager> cache) +AccessRemoteImpl::AccessRemoteImpl(std::shared_ptr<CacheManager> cache) : cache_(cache) {} bool AccessRemoteImpl::CheckModuleType(const PTString& app_id, diff --git a/src/components/policy/policy_regular/src/cache_manager.cc b/src/components/policy/policy_regular/src/cache_manager.cc index 1d51b81af4..4530e6692b 100644 --- a/src/components/policy/policy_regular/src/cache_manager.cc +++ b/src/components/policy/policy_regular/src/cache_manager.cc @@ -934,8 +934,8 @@ void CacheManager::CheckSnapshotInitialization() { void CacheManager::PersistData() { LOG4CXX_AUTO_TRACE(logger_); - if (backup_.valid()) { - if (pt_.valid()) { + if (backup_.use_count() != 0) { + if (pt_.use_count() != 0) { // Comma expression is used to hold the lock only during the constructor // call policy_table::Table copy_pt( @@ -1029,10 +1029,10 @@ bool CacheManager::IsPermissionsCalculated(const std::string& device_id, return false; } -utils::SharedPtr<policy_table::Table> CacheManager::GenerateSnapshot() { +std::shared_ptr<policy_table::Table> CacheManager::GenerateSnapshot() { CACHE_MANAGER_CHECK(snapshot_); - snapshot_ = new policy_table::Table(); + snapshot_ = std::make_shared<policy_table::Table>(); // Copy all members of policy table except messages in consumer friendly // messages @@ -1426,7 +1426,7 @@ bool CacheManager::Init(const std::string& file_name, result = LoadFromFile(file_name, *pt_); - utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = GenerateSnapshot(); result &= snapshot->is_valid(); LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " << std::boolalpha << result); diff --git a/src/components/policy/policy_regular/src/policy_helper.cc b/src/components/policy/policy_regular/src/policy_helper.cc index 796dd25ec4..bae9fceb49 100644 --- a/src/components/policy/policy_regular/src/policy_helper.cc +++ b/src/components/policy/policy_regular/src/policy_helper.cc @@ -121,8 +121,8 @@ bool operator!=(const policy_table::ApplicationParams& first, CheckAppPolicy::CheckAppPolicy( PolicyManagerImpl* pm, - const utils::SharedPtr<policy_table::Table> update, - const utils::SharedPtr<policy_table::Table> snapshot) + const std::shared_ptr<policy_table::Table> update, + const std::shared_ptr<policy_table::Table> snapshot) : pm_(pm), update_(update), snapshot_(snapshot) {} bool policy::CheckAppPolicy::HasRevokedGroups( diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc index d01631a2a2..f1e51f3f83 100644 --- a/src/components/policy/policy_regular/src/policy_manager_impl.cc +++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc @@ -44,12 +44,12 @@ #include "utils/file_system.h" #include "utils/logger.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "policy/cache_manager.h" #include "policy/update_status_manager.h" #include "config_profile/profile.h" #include "utils/timer_task_impl.h" -#include "utils/make_shared.h" + #include "policy/access_remote.h" #include "policy/access_remote_impl.h" @@ -74,7 +74,7 @@ PolicyManagerImpl::PolicyManagerImpl() , listener_(NULL) , cache_(new CacheManager) , access_remote_(new AccessRemoteImpl( - CacheManagerInterfaceSPtr::static_pointer_cast<CacheManager>(cache_))) + std::static_pointer_cast<CacheManager>(cache_))) , retry_sequence_timeout_(kDefaultRetryTimeoutInMSec) , retry_sequence_index_(0) , timer_retry_sequence_("Retry sequence timer", @@ -93,21 +93,21 @@ void PolicyManagerImpl::set_listener(PolicyListener* listener) { #ifdef USE_HMI_PTU_DECRYPTION -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::Parse( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; Json::Reader reader; if (reader.parse(json.c_str(), value)) { - return new policy_table::Table(&value); + return std::make_shared<policy_table::Table>(&value); } else { - return utils::SharedPtr<policy_table::Table>(); + return std::make_shared<policy_table::Table>(); } } #else -utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( +std::shared_ptr<policy_table::Table> PolicyManagerImpl::ParseArray( const BinaryMessage& pt_content) { std::string json(pt_content.begin(), pt_content.end()); Json::Value value; @@ -121,7 +121,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray( return new policy_table::Table(&value); } } else { - return utils::SharedPtr<policy_table::Table>(); + return std::shared_ptr<policy_table::Table>(); } } @@ -154,11 +154,11 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, // Assuemes Policy Table was parsed, formatted, and/or decrypted by // the HMI after system request before calling OnReceivedPolicyUpdate // Parse message into table struct - utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content); + std::shared_ptr<policy_table::Table> pt_update = Parse(pt_content); #else // Message Received from server unecnrypted with PTU in first element // of 'data' array. No Parsing was done by HMI. - utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content); + std::shared_ptr<policy_table::Table> pt_update = ParseArray(pt_content); #endif if (!pt_update) { LOG4CXX_WARN(logger_, "Parsed table pointer is 0."); @@ -187,7 +187,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, sync_primitives::AutoLock lock(apps_registration_lock_); // Get current DB data, since it could be updated during awaiting of PTU - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR( @@ -238,8 +238,8 @@ bool PolicyManagerImpl::LoadPT(const std::string& file, } void PolicyManagerImpl::CheckPermissionsChanges( - const utils::SharedPtr<policy_table::Table> pt_update, - const utils::SharedPtr<policy_table::Table> snapshot) { + const std::shared_ptr<policy_table::Table> pt_update, + const std::shared_ptr<policy_table::Table> snapshot) { LOG4CXX_INFO(logger_, "Checking incoming permissions."); // Replace predefined policies with its actual setting, e.g. "123":"default" @@ -274,7 +274,7 @@ void PolicyManagerImpl::GetUpdateUrls(const uint32_t service_type, bool PolicyManagerImpl::RequestPTUpdate() { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> policy_table_snapshot = + std::shared_ptr<policy_table::Table> policy_table_snapshot = cache_->GenerateSnapshot(); if (!policy_table_snapshot) { LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table"); @@ -806,7 +806,7 @@ bool PolicyManagerImpl::ExceededIgnitionCycles() { } bool PolicyManagerImpl::IsPTValid( - utils::SharedPtr<policy_table::Table> policy_table, + std::shared_ptr<policy_table::Table> policy_table, policy_table::PolicyTableType type) const { policy_table->SetPolicyTableType(type); if (!policy_table->is_valid()) { @@ -1066,11 +1066,11 @@ StatusNotifier PolicyManagerImpl::AddApplication( sync_primitives::AutoLock lock(apps_registration_lock_); if (IsNewApplication(application_id)) { AddNewApplication(application_id, device_consent); - return utils::MakeShared<CallStatusChange>(update_status_manager_, + return std::make_shared<CallStatusChange>(update_status_manager_, device_consent); } else { PromoteExistedApplication(application_id, device_consent); - return utils::MakeShared<utils::CallNothing>(); + return std::make_shared<utils::CallNothing>(); } } @@ -1164,8 +1164,8 @@ void PolicyManagerImpl::SaveUpdateStatusRequired(bool is_update_needed) { } void PolicyManagerImpl::set_cache_manager( - CacheManagerInterface* cache_manager) { - cache_ = cache_manager; + CacheManagerInterface* cache_manager) { + cache_ = std::shared_ptr<CacheManagerInterface>(cache_manager); } void PolicyManagerImpl::RetrySequence() { @@ -1287,7 +1287,7 @@ bool PolicyManagerImpl::GetModuleTypes( } void PolicyManagerImpl::set_access_remote( - utils::SharedPtr<AccessRemote> access_remote) { + std::shared_ptr<AccessRemote> access_remote) { access_remote_ = access_remote; } diff --git a/src/components/policy/policy_regular/src/policy_table.cc b/src/components/policy/policy_regular/src/policy_table.cc index c5c6e3e132..b0fa5739da 100644 --- a/src/components/policy/policy_regular/src/policy_table.cc +++ b/src/components/policy/policy_regular/src/policy_table.cc @@ -42,7 +42,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") PolicyTable::PolicyTable() : pt_data_(new SQLPTRepresentation()) {} -PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data) +PolicyTable::PolicyTable(std::shared_ptr<PTRepresentation> pt_data) : pt_data_(pt_data) {} PolicyTable::~PolicyTable() { diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc index b1e574578e..00f3349050 100644 --- a/src/components/policy/policy_regular/src/sql_pt_representation.cc +++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc @@ -483,10 +483,10 @@ bool SQLPTRepresentation::RefreshDB() { return true; } -utils::SharedPtr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() +std::shared_ptr<policy_table::Table> SQLPTRepresentation::GenerateSnapshot() const { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<policy_table::Table> table = new policy_table::Table(); + auto table = std::make_shared<policy_table::Table>(); GatherModuleMeta(&*table->policy_table.module_meta); GatherModuleConfig(&table->policy_table.module_config); GatherUsageAndErrorCounts(&*table->policy_table.usage_and_error_counts); diff --git a/src/components/policy/policy_regular/src/status.cc b/src/components/policy/policy_regular/src/status.cc index 8d65c606d0..306fa87529 100644 --- a/src/components/policy/policy_regular/src/status.cc +++ b/src/components/policy/policy_regular/src/status.cc @@ -32,7 +32,7 @@ #include "policy/status.h" #include "policy/update_status_manager_interface.h" -#include "utils/make_shared.h" + policy::UpToDateStatus::UpToDateStatus() : Status("UP_TO_DATE", policy::PolicyTableStatus::StatusUpToDate) {} @@ -44,7 +44,7 @@ void policy::UpToDateStatus::ProcessEvent(UpdateStatusManagerInterface* manager, case kOnResetPolicyTableRequireUpdate: case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -59,17 +59,17 @@ void policy::UpdateNeededStatus::ProcessEvent( policy::UpdateStatusManagerInterface* manager, policy::UpdateEvent event) { switch (event) { case kOnUpdateSentOut: - manager->SetNextStatus(utils::MakeShared<UpdatingStatus>()); + manager->SetNextStatus(std::make_shared<UpdatingStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; @@ -88,22 +88,22 @@ void policy::UpdatingStatus::ProcessEvent( switch (event) { case kOnValidUpdateReceived: case kOnResetPolicyTableNoUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); break; case kOnNewAppRegistered: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnWrongUpdateReceived: case kOnUpdateTimeout: - manager->SetNextStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpdateNeededStatus>()); break; case kOnResetPolicyTableRequireUpdate: - manager->SetNextStatus(utils::MakeShared<UpToDateStatus>()); - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetNextStatus(std::make_shared<UpToDateStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; case kScheduleUpdate: case kOnResetRetrySequence: - manager->SetPostponedStatus(utils::MakeShared<UpdateNeededStatus>()); + manager->SetPostponedStatus(std::make_shared<UpdateNeededStatus>()); break; default: break; diff --git a/src/components/policy/policy_regular/src/update_status_manager.cc b/src/components/policy/policy_regular/src/update_status_manager.cc index 941113c753..401de1ea79 100644 --- a/src/components/policy/policy_regular/src/update_status_manager.cc +++ b/src/components/policy/policy_regular/src/update_status_manager.cc @@ -33,7 +33,7 @@ #include "policy/update_status_manager.h" #include "policy/policy_listener.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace policy { @@ -41,7 +41,7 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "Policy") UpdateStatusManager::UpdateStatusManager() : listener_(NULL) - , current_status_(utils::MakeShared<UpToDateStatus>()) + , current_status_(std::make_shared<UpToDateStatus>()) , last_processed_event_(kNoEvent) , apps_search_in_progress_(false) , app_registered_from_non_consented_device_(true) {} @@ -55,11 +55,11 @@ void UpdateStatusManager::ProcessEvent(UpdateEvent event) { DoTransition(); } -void UpdateStatusManager::SetNextStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetNextStatus(std::shared_ptr<Status> status) { next_status_ = status; } -void UpdateStatusManager::SetPostponedStatus(utils::SharedPtr<Status> status) { +void UpdateStatusManager::SetPostponedStatus(std::shared_ptr<Status> status) { postponed_status_ = status; } diff --git a/src/components/policy/policy_regular/src/usage_statistics/counter.cc b/src/components/policy/policy_regular/src/usage_statistics/counter.cc index 60e34a929d..199b5ae779 100644 --- a/src/components/policy/policy_regular/src/usage_statistics/counter.cc +++ b/src/components/policy/policy_regular/src/usage_statistics/counter.cc @@ -36,13 +36,13 @@ #include <cassert> #include "policy/usage_statistics/counter.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" namespace usage_statistics { GlobalCounter::GlobalCounter( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, GlobalCounterId counter_type) : counter_type_(counter_type), statistics_manager_(statistics_manager) {} @@ -52,7 +52,7 @@ void GlobalCounter::operator++() const { } } -AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager, +AppCounter::AppCounter(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppCounterId counter_type) : app_id_(app_id) @@ -65,7 +65,7 @@ void AppCounter::operator++() const { } } -AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager, +AppInfo::AppInfo(std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, AppInfoId info_type) : app_id_(app_id) @@ -79,7 +79,7 @@ void AppInfo::Update(const std::string& new_info) const { } AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id) : app_id_(app_id) , stopwatch_type_(SECONDS_HMI_NONE) @@ -90,7 +90,7 @@ AppStopwatchImpl::AppStopwatchImpl( , time_out_(60) {} AppStopwatchImpl::AppStopwatchImpl( - utils::SharedPtr<StatisticsManager> statistics_manager, + std::shared_ptr<StatisticsManager> statistics_manager, const std::string& app_id, uint32_t timeout) : app_id_(app_id) diff --git a/src/components/policy/policy_regular/test/access_remote_impl_test.cc b/src/components/policy/policy_regular/test/access_remote_impl_test.cc index d086144d86..f79bb683f8 100644 --- a/src/components/policy/policy_regular/test/access_remote_impl_test.cc +++ b/src/components/policy/policy_regular/test/access_remote_impl_test.cc @@ -37,7 +37,7 @@ namespace policy { TEST(AccessRemoteImplTest, CheckModuleType) { AccessRemoteImpl access_remote; - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); // No application EXPECT_FALSE(access_remote.CheckModuleType("1234", policy_table::MT_RADIO)); @@ -81,7 +81,7 @@ TEST(AccessRemoteImplTest, GetGroups) { ApplicationOnDevice who = {"dev1", "1234"}; access_remote.hmi_types_[who].push_back(policy_table::AHT_REMOTE_CONTROL); - access_remote.cache_->pt_ = new policy_table::Table(); + access_remote.cache_->pt_ = std::make_shared<policy_table::Table>(); policy_table::ApplicationPolicies& apps = access_remote.cache_->pt_->policy_table.app_policies_section.apps; apps["1234"].groups.push_back("group_default"); diff --git a/src/components/policy/policy_regular/test/counter_test.cc b/src/components/policy/policy_regular/test/counter_test.cc index 2c0ab73c0b..a333ec2ee5 100644 --- a/src/components/policy/policy_regular/test/counter_test.cc +++ b/src/components/policy/policy_regular/test/counter_test.cc @@ -53,7 +53,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -67,7 +67,7 @@ TEST( StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); GlobalCounter reboots_counter(msm, SYNC_REBOOTS); // Assert @@ -82,7 +82,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -96,7 +96,7 @@ TEST( StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS); // Assert @@ -110,7 +110,7 @@ TEST( TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -123,7 +123,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI); // Assert @@ -138,7 +138,7 @@ TEST(StatisticsManagerSetMethod, TEST(StatisticsManagerAddMethod, AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); @@ -155,7 +155,7 @@ TEST(StatisticsManagerAddMethod, TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp"); hmi_full_stopwatch.Start(SECONDS_HMI_FULL); @@ -171,7 +171,7 @@ TEST( StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) { // Arrange - MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>(); + auto msm = std::make_shared<StrictMock<MockStatisticsManager>>(); const std::uint32_t time_out = 1; AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out); diff --git a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h index 8a47e7ca97..72f183175c 100644 --- a/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h +++ b/src/components/policy/policy_regular/test/include/policy/mock_pt_representation.h @@ -76,7 +76,7 @@ class MockPTRepresentation : virtual public PTRepresentation { MOCK_METHOD0(Close, bool()); MOCK_METHOD0(Clear, bool()); MOCK_METHOD0(Drop, bool()); - MOCK_CONST_METHOD0(GenerateSnapshot, utils::SharedPtr<policy_table::Table>()); + MOCK_CONST_METHOD0(GenerateSnapshot, std::shared_ptr<policy_table::Table>()); MOCK_METHOD1(Save, bool(const policy_table::Table& table)); MOCK_CONST_METHOD0(UpdateRequired, bool()); MOCK_METHOD1(SaveUpdateRequired, void(bool value)); diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc index e4e361c52c..86df87d534 100644 --- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc +++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc @@ -51,7 +51,7 @@ #include "utils/macro.h" #include "utils/file_system.h" #include "utils/date_time.h" -#include "utils/make_shared.h" + #include "utils/gen_hash.h" #include "policy/mock_access_remote.h" @@ -145,14 +145,14 @@ class PolicyManagerImplTest : public ::testing::Test { MockCacheManagerInterface* cache_manager; NiceMock<MockPolicyListener> listener; const std::string device_id; - utils::SharedPtr<access_remote_test::MockAccessRemote> access_remote; + std::shared_ptr<access_remote_test::MockAccessRemote> access_remote; void SetUp() OVERRIDE { manager = new PolicyManagerImpl(); manager->set_listener(&listener); cache_manager = new MockCacheManagerInterface(); manager->set_cache_manager(cache_manager); - access_remote = new access_remote_test::MockAccessRemote(); + access_remote = std::shared_ptr<access_remote_test::MockAccessRemote>(); manager->set_access_remote(access_remote); } @@ -352,7 +352,7 @@ class PolicyManagerImplTest2 : public ::testing::Test { // Get cache ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); // Get table_snapshot - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Set functional groupings from policy table input_functional_groupings = table->policy_table.functional_groupings; } @@ -720,8 +720,8 @@ TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) { const std::string json = table.toStyledString(); ::policy::BinaryMessage msg(json.begin(), json.end()); - utils::SharedPtr<policy_table::Table> snapshot = - utils::MakeShared<policy_table::Table>(update.policy_table); + std::shared_ptr<policy_table::Table> snapshot = + std::make_shared<policy_table::Table>(update.policy_table); // Assert EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot)); EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true)); @@ -961,7 +961,7 @@ TEST_F(PolicyManagerImplTest2, UpdatedPreloadedPT_ExpectLPT_IsUpdated) { // Arrange ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache(); - utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> table = cache->GenerateSnapshot(); // Get FunctionalGroupings policy_table::FunctionalGroupings& fc = table->policy_table.functional_groupings; @@ -1253,7 +1253,7 @@ TEST_F(PolicyManagerImplTest2, // Arrange CreateLocalPT("sdl_preloaded_pt.json"); GetPTU("valid_sdl_pt_update.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); policy_table::ModuleConfig& module_config = pt->policy_table.module_config; ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo(); @@ -1334,7 +1334,7 @@ TEST_F( HertBeatTimeout_AddApp_UpdateAppPolicies_ExpectReceivedHertBeatTimeoutCorrect) { // Arrange CreateLocalPT("sdl_preloaded_pt.json"); - utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->pt(); + std::shared_ptr<policy_table::Table> pt = (manager->GetCache())->pt(); ::policy_table::PolicyTableType type1 = ::policy_table::PolicyTableType::PT_PRELOADED; pt->SetPolicyTableType(type1); diff --git a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc index 40dae10a4f..70db02b8a7 100644 --- a/src/components/policy/policy_regular/test/sql_pt_representation_test.cc +++ b/src/components/policy/policy_regular/test/sql_pt_representation_test.cc @@ -47,8 +47,8 @@ #include "json/writer.h" #include "json/reader.h" #include "rpc_base/rpc_base.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/file_system.h" #include "utils/sqlite_wrapper/sql_database.h" @@ -1517,7 +1517,7 @@ TEST_F(SQLPTRepresentationTest, ASSERT_TRUE(reps->Save(update)); // Act - utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot(); + std::shared_ptr<policy_table::Table> snapshot = reps->GenerateSnapshot(); snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT); // Remove fields which must be absent in snapshot table["policy_table"]["consumer_friendly_messages"].removeMember("messages"); diff --git a/src/components/policy/policy_regular/test/update_status_manager_test.cc b/src/components/policy/policy_regular/test/update_status_manager_test.cc index 9d0326d0be..7c73a11175 100644 --- a/src/components/policy/policy_regular/test/update_status_manager_test.cc +++ b/src/components/policy/policy_regular/test/update_status_manager_test.cc @@ -34,7 +34,7 @@ #include "policy/mock_policy_listener.h" #include "policy/policy_manager_impl.h" #include "policy/update_status_manager.h" -#include "utils/make_shared.h" + namespace test { namespace components { @@ -46,13 +46,13 @@ using ::testing::Return; class UpdateStatusManagerTest : public ::testing::Test { protected: - utils::SharedPtr<UpdateStatusManager> manager_; - utils::SharedPtr<MockPolicyListener> listener_; + std::shared_ptr<UpdateStatusManager> manager_; + std::shared_ptr<MockPolicyListener> listener_; public: UpdateStatusManagerTest() - : manager_(utils::MakeShared<UpdateStatusManager>()) - , listener_(utils::MakeShared<MockPolicyListener>()) {} + : manager_(std::make_shared<UpdateStatusManager>()) + , listener_(std::make_shared<MockPolicyListener>()) {} void SetUp() OVERRIDE { manager_->set_listener(listener_.get()); diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h index fb685f33d3..58877ac611 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h @@ -42,7 +42,7 @@ #include "utils/prioritized_queue.h" #include "utils/message_queue.h" #include "utils/threads/message_loop_thread.h" -#include "utils/shared_ptr.h" + #include "utils/messagemeter.h" #include "utils/custom_string.h" diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h index d3e3ec5809..ff084beff8 100644 --- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h +++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h @@ -375,7 +375,7 @@ class ProtocolPacket { * @brief Type definition for variable that hold shared pointer to protocolol * packet */ -typedef utils::SharedPtr<protocol_handler::ProtocolPacket> ProtocolFramePtr; +typedef std::shared_ptr<protocol_handler::ProtocolPacket> ProtocolFramePtr; typedef std::list<ProtocolFramePtr> ProtocolFramePtrList; template <typename _CharT> diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc index cf8a23ddc1..5afae51292 100644 --- a/src/components/protocol_handler/src/multiframe_builder.cc +++ b/src/components/protocol_handler/src/multiframe_builder.cc @@ -35,7 +35,7 @@ #include <limits> #include "utils/logger.h" -#include "utils/make_shared.h" + #include "utils/lock.h" #include "utils/date_time.h" diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc index 6548f86c6a..57b2b8682d 100644 --- a/src/components/protocol_handler/src/protocol_handler_impl.cc +++ b/src/components/protocol_handler/src/protocol_handler_impl.cc @@ -925,8 +925,8 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message, } #ifdef TELEMETRY_MONITOR if (metric_observer_) { - PHTelemetryObserver::MessageMetric* metric = - new PHTelemetryObserver::MessageMetric(); + auto metric = + std::make_shared<PHTelemetryObserver::MessageMetric>(); metric->message_id = message_id; metric->connection_key = message->connection_key(); metric->raw_msg = message; @@ -1384,8 +1384,8 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage( } #ifdef TELEMETRY_MONITOR if (metric_observer_) { - PHTelemetryObserver::MessageMetric* metric = - new PHTelemetryObserver::MessageMetric(); + auto metric = + std::make_shared<PHTelemetryObserver::MessageMetric>(); metric->message_id = packet->message_id(); metric->connection_key = connection_key; metric->raw_msg = rawMessage; @@ -2054,8 +2054,8 @@ void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() { #ifdef TELEMETRY_MONITOR if (metric_observer_) { - PHTelemetryObserver::MessageMetric* metric = - new PHTelemetryObserver::MessageMetric(); + auto metric = + std::make_shared<PHTelemetryObserver::MessageMetric>(); metric->raw_msg = rawMessage; metric_observer_->EndMessageProcess(metric); } diff --git a/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h index a1c1f188d1..2bfe9c925f 100644 --- a/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h +++ b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h @@ -35,7 +35,7 @@ #include "gmock/gmock.h" #include "protocol_handler/time_metric_observer.h" -#include "utils/shared_ptr.h" + namespace test { namespace components { @@ -44,7 +44,7 @@ namespace protocol_handler_test { class MockPHTelemetryObserver : public ::protocol_handler::PHTelemetryObserver { public: MOCK_METHOD2(StartMessageProcess, void(uint32_t, const TimevalStruct&)); - MOCK_METHOD2(EndMessageProcess, void(utils::SharedPtr<MessageMetric>)); + MOCK_METHOD2(EndMessageProcess, void(std::shared_ptr<MessageMetric>)); }; } // namespace protocol_handler_test diff --git a/src/components/protocol_handler/test/incoming_data_handler_test.cc b/src/components/protocol_handler/test/incoming_data_handler_test.cc index 393579927c..6274cf4e10 100644 --- a/src/components/protocol_handler/test/incoming_data_handler_test.cc +++ b/src/components/protocol_handler/test/incoming_data_handler_test.cc @@ -74,7 +74,7 @@ class IncomingDataHandlerTest : public ::testing::Test { void AppendPacketToTMData(const ProtocolPacket& packet) { const RawMessagePtr msg = packet.serializePacket(); - EXPECT_TRUE(msg.valid()); + EXPECT_TRUE(msg.use_count() != 0); EXPECT_GT(msg->data_size(), 0u); tm_data.insert(tm_data.end(), msg->data(), msg->data() + msg->data_size()); } @@ -192,7 +192,7 @@ TEST_F(IncomingDataHandlerTest, Heartbeat_pack) { TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) { FrameList mobile_packets; // single packet RPC - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -203,7 +203,7 @@ TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) { protov1_message_id, some_data)); // consecutive packet Audio - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_2, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -214,7 +214,7 @@ TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) { some_message_id, some_data2)); // single packet Nav - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_ON, FRAME_TYPE_SINGLE, @@ -225,7 +225,7 @@ TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) { ++some_message_id, some_data)); // consecutive packet Bulk - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -268,7 +268,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Version) { malformed_versions.push_back(version); } for (size_t i = 0; i < malformed_versions.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, malformed_versions[i], PROTECTION_OFF, FRAME_TYPE_CONTROL, @@ -277,7 +277,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Version) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -316,7 +316,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_ServiceType) { malformed_serv_types.push_back(0x0D); malformed_serv_types.push_back(0x0E); for (size_t i = 0; i < malformed_serv_types.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL, @@ -325,7 +325,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_ServiceType) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -360,7 +360,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) { malformed_frame_types.push_back(frame_type); } for (size_t i = 0; i < malformed_frame_types.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, malformed_frame_types[i], @@ -369,7 +369,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -404,7 +404,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_ControlFrame) { malformed_frame_data.push_back(frame_type); } for (size_t i = 0; i < malformed_frame_data.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL, @@ -413,7 +413,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_ControlFrame) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -448,7 +448,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_SingleFrame) { } malformed_frame_data.push_back(FRAME_DATA_MAX_VALUE); for (size_t i = 0; i < malformed_frame_data.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -457,7 +457,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_SingleFrame) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -492,7 +492,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) { } malformed_frame_data.push_back(FRAME_DATA_MAX_VALUE); for (size_t i = 0; i < malformed_frame_data.size(); ++i) { - malformed_packets.push_back(new ProtocolPacket(uid1, + malformed_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -501,7 +501,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) { some_session_id, 0u, some_message_id, - NULL)); + nullptr)); } // We count malformed only first time when it occurs after correct message @@ -529,7 +529,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) { TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { FrameList mobile_packets; // single packet RPC - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -544,7 +544,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 1, 0x1); // consecutive packet Audio - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_2, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -559,7 +559,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 2, 0x2); // single packet Nav - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_ON, FRAME_TYPE_SINGLE, @@ -574,7 +574,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 3, 0x3); // consecutive packet Bulk - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -589,7 +589,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 4, 0x4); // single packet RPC - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_CONTROL, @@ -604,7 +604,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 5, 0x5); // single packet Audio - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_CONTROL, @@ -619,7 +619,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { tm_data.insert(tm_data.end(), 6, 0x6); // single packet RPC - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -651,7 +651,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_AdditionalByte) { TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) { FrameList mobile_packets; // single packet RPC - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_1, PROTECTION_OFF, FRAME_TYPE_SINGLE, @@ -664,7 +664,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) { AppendPacketToTMData(*mobile_packets.back()); // consecutive packet Audio - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_2, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -691,7 +691,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) { AppendPacketToTMData(malformed_packet1); // consecutive packet Bulk - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_ON, FRAME_TYPE_CONSECUTIVE, @@ -718,7 +718,7 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_Mix) { AppendPacketToTMData(malformed_packet2); // Audio packet - mobile_packets.push_back(new ProtocolPacket(uid1, + mobile_packets.push_back(std::make_shared<ProtocolPacket>(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL, diff --git a/src/components/protocol_handler/test/multiframe_builder_test.cc b/src/components/protocol_handler/test/multiframe_builder_test.cc index ad8a39f79a..f919ec92af 100644 --- a/src/components/protocol_handler/test/multiframe_builder_test.cc +++ b/src/components/protocol_handler/test/multiframe_builder_test.cc @@ -35,7 +35,7 @@ #include <algorithm> #include <utility> #include <limits> -#include "utils/make_shared.h" + #include "protocol_handler/multiframe_builder.h" namespace test { @@ -149,7 +149,7 @@ class MultiFrameBuilderTest : public ::testing::Test { const ProtocolFramePtrList::const_iterator it_last = --(multiframes.end()); while (it != it_last) { const ProtocolFramePtr frame = *it; - ASSERT_TRUE(frame); + ASSERT_TRUE((bool)frame); EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(frame)) << "Non final CONSECUTIVE frame: " << frame; EXPECT_EQ(ProtocolFramePtrList(), multiframe_builder_.PopMultiframes()) @@ -331,7 +331,7 @@ TEST_F(MultiFrameBuilderTest, Add_FirstFrames_NoConnections) { const ProtocolFramePtrList& multiframes = multiframe_data.multiframes; ASSERT_FALSE(multiframes.empty()); const ProtocolFramePtr first_frame = multiframes.front(); - ASSERT_TRUE(first_frame); + ASSERT_TRUE((bool)first_frame); EXPECT_EQ(RESULT_FAIL, multiframe_builder_.AddFrame(first_frame)) << "Non-existed connection " << connection_id << "- to be skipped first frame: " << first_frame; @@ -365,7 +365,7 @@ TEST_F(MultiFrameBuilderTest, Add_FirstFrames_only) { const ProtocolFramePtrList& multiframes = multiframe_data.multiframes; ASSERT_FALSE(multiframes.empty()); const ProtocolFramePtr first_frame = multiframes.front(); - ASSERT_TRUE(first_frame); + ASSERT_TRUE((bool)first_frame); EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(first_frame)) << "First frame: " << first_frame; @@ -440,7 +440,7 @@ TEST_F(MultiFrameBuilderTest, Add_ConsecutiveFrames_per1) { ASSERT_FALSE(multiframes.empty()); const ProtocolFramePtr frame = multiframes.front(); - ASSERT_TRUE(frame); + ASSERT_TRUE((bool)frame); EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(frame)) << "Frame: " << frame; @@ -501,7 +501,7 @@ TEST_F(MultiFrameBuilderTest, FrameExpired_OneMSec) { const ProtocolFramePtrList& multiframes = multiframe_data.multiframes; ASSERT_FALSE(multiframes.empty()); const ProtocolFramePtr first_frame = multiframes.front(); - ASSERT_TRUE(first_frame); + ASSERT_TRUE((bool)first_frame); EXPECT_EQ(RESULT_OK, multiframe_builder_.AddFrame(first_frame)) << "First frame: " << first_frame; diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc index 2e06cd702e..6ee57548b4 100644 --- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc +++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc @@ -48,7 +48,7 @@ #endif // ENABLE_SECURITY #include "transport_manager/mock_transport_manager.h" #include "utils/mock_system_time_handler.h" -#include "utils/make_shared.h" + #include "utils/test_async_waiter.h" #include <bson_object.h> @@ -243,7 +243,7 @@ class ProtocolHandlerImplTest : public ::testing::Test { protection_flag); } - void AddSession(const ::utils::SharedPtr<TestAsyncWaiter>& waiter, + void AddSession(const std::shared_ptr<TestAsyncWaiter>& waiter, uint32_t& times) { using namespace protocol_handler; ASSERT_TRUE(NULL != waiter.get()); @@ -368,7 +368,7 @@ class ProtocolHandlerImplTest : public ::testing::Test { const std::vector<int32_t>& expected_video_service_transports); testing::NiceMock<MockProtocolHandlerSettings> protocol_handler_settings_mock; - ::utils::SharedPtr<ProtocolHandlerImpl> protocol_handler_impl; + std::shared_ptr<ProtocolHandlerImpl> protocol_handler_impl; TransportManagerListener* tm_listener; // Uniq connection ::transport_manager::ConnectionUID connection_id; @@ -621,8 +621,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) { SetProtocolVersion2(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -836,8 +836,8 @@ TEST_F(ProtocolHandlerImplTest, * ProtocolHandler shall send NAck on session_observer rejection */ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) { - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -870,8 +870,8 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) { * ProtocolHandler shall send NAck on wrong hash code */ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -904,8 +904,8 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) { #ifdef ENABLE_SECURITY TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) { using namespace protocol_handler; - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2653,8 +2653,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification) { InitProtocolHandlerImpl(period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2691,8 +2691,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_ThresholdValue) { InitProtocolHandlerImpl(period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2728,8 +2728,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_VideoFrameSkip) { InitProtocolHandlerImpl(period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2757,8 +2757,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerification_AudioFrameSkip) { InitProtocolHandlerImpl(period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2786,8 +2786,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_FloodVerificationDisable) { InitProtocolHandlerImpl(period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2815,8 +2815,8 @@ TEST_F(ProtocolHandlerImplTest, MalformedVerificationDisable) { InitProtocolHandlerImpl(0u, 0u, false, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2848,8 +2848,8 @@ TEST_F(ProtocolHandlerImplTest, DISABLED_MalformedLimitVerification) { InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2896,8 +2896,8 @@ TEST_F(ProtocolHandlerImplTest, InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -2968,8 +2968,8 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_MalformedOnly) { InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3029,8 +3029,8 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullTimePeriod) { InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3063,8 +3063,8 @@ TEST_F(ProtocolHandlerImplTest, MalformedLimitVerification_NullCount) { InitProtocolHandlerImpl(0u, 0u, true, period_msec, max_messages); AddConnection(); - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3107,8 +3107,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, DISABLED_SendEndServicePrivate_EndSession_MessageSent) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3132,8 +3132,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, SendEndServicePrivate_ServiceTypeControl_MessageSent) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3172,8 +3172,8 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_NoConnection_NotSent) { TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3198,8 +3198,8 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeat_Successful) { TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3228,8 +3228,8 @@ TEST_F(ProtocolHandlerImplTest, SendHeartBeatAck_Successful) { TEST_F(ProtocolHandlerImplTest, DISABLED_SendHeartBeatAck_WrongProtocolVersion_NotSent) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3258,8 +3258,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendSingleControlMessage) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3267,7 +3267,7 @@ TEST_F(ProtocolHandlerImplTest, const bool is_final = true; const uint32_t total_data_size = 1; UCharDataVector data(total_data_size); - RawMessagePtr message = utils::MakeShared<RawMessage>( + RawMessagePtr message = std::make_shared<RawMessage>( connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kControl); // Expect getting pair from key from session observer EXPECT_CALL(session_observer_mock, @@ -3297,8 +3297,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendSingleNonControlMessage) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3306,7 +3306,7 @@ TEST_F(ProtocolHandlerImplTest, const bool is_final = true; const uint32_t total_data_size = 1; UCharDataVector data(total_data_size); - RawMessagePtr message = utils::MakeShared<RawMessage>( + RawMessagePtr message = std::make_shared<RawMessage>( connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kRpc); // Expect getting pair from key from session observer EXPECT_CALL(session_observer_mock, @@ -3340,8 +3340,8 @@ TEST_F(ProtocolHandlerImplTest, TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) { // Arrange - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3350,7 +3350,7 @@ TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) { const uint32_t total_data_size = MAXIMUM_FRAME_DATA_V2_SIZE * 2; UCharDataVector data(total_data_size); const uint8_t first_consecutive_frame = 0x01; - RawMessagePtr message = utils::MakeShared<RawMessage>( + RawMessagePtr message = std::make_shared<RawMessage>( connection_key, PROTOCOL_VERSION_3, &data[0], total_data_size, kBulk); // Expect getting pair from key from session observer EXPECT_CALL(session_observer_mock, @@ -3395,8 +3395,8 @@ TEST_F(ProtocolHandlerImplTest, SendMessageToMobileApp_SendMultiframeMessage) { } TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) { - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); @@ -3422,8 +3422,8 @@ TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_PreVersion5) { } TEST_F(ProtocolHandlerImplTest, SendServiceDataAck_AfterVersion5) { - ::utils::SharedPtr<TestAsyncWaiter> waiter = - utils::MakeShared<TestAsyncWaiter>(); + std::shared_ptr<TestAsyncWaiter> waiter = + std::make_shared<TestAsyncWaiter>(); uint32_t times = 0; AddSession(waiter, times); diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h index aa3be0f430..7a42c3d773 100644 --- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h +++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h @@ -46,7 +46,7 @@ #include "utils/macro.h" #include "utils/lock.h" -#include "utils/shared_ptr.h" + namespace security_manager { class CryptoManagerImpl : public CryptoManager { @@ -138,7 +138,7 @@ class CryptoManagerImpl : public CryptoManager { public: explicit CryptoManagerImpl( - const utils::SharedPtr<const CryptoManagerSettings> set); + const std::shared_ptr<const CryptoManagerSettings> set); ~CryptoManagerImpl(); bool Init() OVERRIDE; @@ -203,7 +203,7 @@ class CryptoManagerImpl : public CryptoManager { */ bool SaveModuleKeyToFile(EVP_PKEY* key) const; - const utils::SharedPtr<const CryptoManagerSettings> settings_; + const std::shared_ptr<const CryptoManagerSettings> settings_; SSL_CTX* context_; static uint32_t instance_count_; static sync_primitives::Lock instance_lock_; diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc index 84c5db7c0e..1dabb00bcd 100644 --- a/src/components/security_manager/src/crypto_manager_impl.cc +++ b/src/components/security_manager/src/crypto_manager_impl.cc @@ -87,7 +87,7 @@ void free_ctx(SSL_CTX** ctx) { } CryptoManagerImpl::CryptoManagerImpl( - const utils::SharedPtr<const CryptoManagerSettings> set) + const std::shared_ptr<const CryptoManagerSettings> set) : settings_(set), context_(NULL) { LOG4CXX_AUTO_TRACE(logger_); sync_primitives::AutoLock lock(instance_lock_); diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc index 1faaddee1c..c5d14406a9 100644 --- a/src/components/security_manager/src/security_manager_impl.cc +++ b/src/components/security_manager/src/security_manager_impl.cc @@ -69,7 +69,7 @@ void SecurityManagerImpl::OnMessageReceived( return; } - SecurityMessage securityMessagePtr(new SecurityQuery()); + SecurityMessage securityMessagePtr(std::make_shared<SecurityQuery>()); const bool result = securityMessagePtr->SerializeQuery(message->data(), message->data_size()); if (!result) { diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc index 74b071793d..9b1cd28539 100644 --- a/src/components/security_manager/test/crypto_manager_impl_test.cc +++ b/src/components/security_manager/test/crypto_manager_impl_test.cc @@ -39,7 +39,7 @@ #include <fstream> #include <sstream> -#include "utils/make_shared.h" + #include "gtest/gtest.h" #include "security_manager/crypto_manager_impl.h" #include "security_manager/mock_security_manager_settings.h" @@ -90,9 +90,9 @@ class CryptoManagerTest : public testing::Test { void SetUp() OVERRIDE { ASSERT_FALSE(certificate_data_base64_.empty()); mock_security_manager_settings_ = - utils::MakeShared<MockCryptoManagerSettings>(); + std::make_shared<MockCryptoManagerSettings>(); crypto_manager_ = - utils::MakeShared<CryptoManagerImpl>(mock_security_manager_settings_); + std::make_shared<CryptoManagerImpl>(mock_security_manager_settings_); forced_protected_services_.reserve(kMaxSizeVector); forced_unprotected_services_.reserve(kMaxSizeVector); } @@ -129,8 +129,8 @@ class CryptoManagerTest : public testing::Test { .WillByDefault(Return(false)); } - utils::SharedPtr<CryptoManagerImpl> crypto_manager_; - utils::SharedPtr<MockCryptoManagerSettings> mock_security_manager_settings_; + std::shared_ptr<CryptoManagerImpl> crypto_manager_; + std::shared_ptr<MockCryptoManagerSettings> mock_security_manager_settings_; static std::string certificate_data_base64_; std::vector<int> forced_protected_services_; std::vector<int> forced_unprotected_services_; diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc index 3523bb7f44..aff7cbca2d 100644 --- a/src/components/security_manager/test/security_manager_test.cc +++ b/src/components/security_manager/test/security_manager_test.cc @@ -45,7 +45,7 @@ #include "security_manager/mock_crypto_manager.h" #include "security_manager/mock_security_manager_listener.h" #include "utils/mock_system_time_handler.h" -#include "utils/make_shared.h" + #include "utils/test_async_waiter.h" namespace test { @@ -120,7 +120,7 @@ class SecurityManagerTest : public ::testing::Test { void call_OnMessageReceived(const uint8_t* const data, uint32_t dataSize, const ServiceType serviceType) { - const RawMessagePtr rawMessagePtr(utils::MakeShared<RawMessage>( + const RawMessagePtr rawMessagePtr(std::make_shared<RawMessage>( kKey, kProtocolVersion, data, dataSize, serviceType)); security_manager_->OnMessageReceived(rawMessagePtr); } @@ -305,7 +305,7 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) { TEST_F(SecurityManagerTest, OnMobileMessageSent) { const uint8_t* data_param = NULL; const RawMessagePtr rawMessagePtr( - utils::MakeShared<RawMessage>(kKey, kProtocolVersion, data_param, 0)); + std::make_shared<RawMessage>(kKey, kProtocolVersion, data_param, 0)); security_manager_->OnMobileMessageSent(rawMessagePtr); } /* diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc index 83ffa33b44..1034bb3c83 100644 --- a/src/components/security_manager/test/ssl_certificate_handshake_test.cc +++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc @@ -87,14 +87,14 @@ class SSLHandshakeTest : public testing::TestWithParam<Protocol> { security_manager_test::MockCryptoManagerSettings>(); server_manager_ = new security_manager::CryptoManagerImpl( - utils::SharedPtr<security_manager::CryptoManagerSettings>( + std::shared_ptr<security_manager::CryptoManagerSettings>( mock_server_manager_settings_)); ASSERT_TRUE(server_manager_); mock_client_manager_settings_ = new testing::NiceMock< security_manager_test::MockCryptoManagerSettings>(); client_manager_ = new security_manager::CryptoManagerImpl( - utils::SharedPtr<security_manager::CryptoManagerSettings>( + std::shared_ptr<security_manager::CryptoManagerSettings>( mock_client_manager_settings_)); ASSERT_TRUE(client_manager_); server_ctx_ = NULL; diff --git a/src/components/security_manager/test/ssl_context_test.cc b/src/components/security_manager/test/ssl_context_test.cc index 20e509ebc6..47fa3c5560 100644 --- a/src/components/security_manager/test/ssl_context_test.cc +++ b/src/components/security_manager/test/ssl_context_test.cc @@ -41,8 +41,8 @@ #include "security_manager/ssl_context.h" #include "utils/custom_string.h" #include "security_manager/mock_security_manager_settings.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + using ::testing::Return; using ::testing::ReturnRef; @@ -111,9 +111,9 @@ class SSLTest : public testing::Test { } virtual void SetUp() OVERRIDE { - mock_crypto_manager_settings_ = utils::MakeShared< + mock_crypto_manager_settings_ = std::make_shared< NiceMock<security_manager_test::MockCryptoManagerSettings> >(); - utils::SharedPtr<security_manager::CryptoManagerSettings> crypto_set( + std::shared_ptr<security_manager::CryptoManagerSettings> crypto_set( mock_crypto_manager_settings_); crypto_manager_ = new security_manager::CryptoManagerImpl(crypto_set); @@ -143,9 +143,9 @@ class SSLTest : public testing::Test { const bool crypto_manager_initialization = crypto_manager_->Init(); EXPECT_TRUE(crypto_manager_initialization); - mock_client_manager_settings_ = utils::MakeShared< + mock_client_manager_settings_ = std::make_shared< NiceMock<security_manager_test::MockCryptoManagerSettings> >(); - utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto( + std::shared_ptr<security_manager::CryptoManagerSettings> client_crypto( mock_client_manager_settings_); client_manager_ = new security_manager::CryptoManagerImpl(client_crypto); @@ -213,9 +213,9 @@ class SSLTest : public testing::Test { const size_t kMaximumPayloadSize = 1000u; security_manager::CryptoManager* crypto_manager_; security_manager::CryptoManager* client_manager_; - utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> > + std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> > mock_crypto_manager_settings_; - utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> > + std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> > mock_client_manager_settings_; security_manager::SSLContext* server_ctx_; security_manager::SSLContext* client_ctx_; @@ -244,9 +244,9 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> { ASSERT_FALSE(certificate.empty()) << "Certificate data file is empty"; certificate_data_base64_ = certificate; - mock_crypto_manager_settings_ = utils::MakeShared< + mock_crypto_manager_settings_ = std::make_shared< NiceMock<security_manager_test::MockCryptoManagerSettings> >(); - utils::SharedPtr<security_manager::CryptoManagerSettings> server_crypto( + std::shared_ptr<security_manager::CryptoManagerSettings> server_crypto( mock_crypto_manager_settings_); crypto_manager_ = new security_manager::CryptoManagerImpl(server_crypto); @@ -256,10 +256,10 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> { const bool crypto_manager_initialization = crypto_manager_->Init(); EXPECT_TRUE(crypto_manager_initialization); - mock_client_manager_settings_ = utils::MakeShared< + mock_client_manager_settings_ = std::make_shared< NiceMock<security_manager_test::MockCryptoManagerSettings> >(); - utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto( + std::shared_ptr<security_manager::CryptoManagerSettings> client_crypto( mock_client_manager_settings_); client_manager_ = new security_manager::CryptoManagerImpl(client_crypto); @@ -343,9 +343,9 @@ class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> { .WillByDefault(ReturnRef(kClientPrivateKeyPath)); } - utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> > + std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> > mock_crypto_manager_settings_; - utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings> > + std::shared_ptr<NiceMock<security_manager_test::MockCryptoManagerSettings> > mock_client_manager_settings_; security_manager::CryptoManager* crypto_manager_; security_manager::CryptoManager* client_manager_; diff --git a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h index cdddcfed55..a25155afad 100644 --- a/src/components/smart_objects/include/smart_objects/always_false_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/always_false_schema_item.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_FALSE_SCHEMA_ITEM_H_ #define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_FALSE_SCHEMA_ITEM_H_ -#include "utils/shared_ptr.h" + #include "smart_objects/schema_item.h" namespace NsSmartDeviceLink { @@ -47,7 +47,7 @@ class CAlwaysFalseSchemaItem : public ISchemaItem { * @brief Create a new schema item. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CAlwaysFalseSchemaItem> create(); + static std::shared_ptr<CAlwaysFalseSchemaItem> create(); /** * @deprecated * @brief Validate smart object. diff --git a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h index e078ae3240..c99cf97fb1 100644 --- a/src/components/smart_objects/include/smart_objects/always_true_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/always_true_schema_item.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_TRUE_SCHEMA_ITEM_H_ #define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_ALWAYS_TRUE_SCHEMA_ITEM_H_ -#include "utils/shared_ptr.h" + #include "smart_objects/schema_item.h" namespace NsSmartDeviceLink { @@ -47,7 +47,7 @@ class CAlwaysTrueSchemaItem : public ISchemaItem { * @brief Create a new schema item. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CAlwaysTrueSchemaItem> create(); + static std::shared_ptr<CAlwaysTrueSchemaItem> create(); /** * @deprecated * @brief Validate smart object. diff --git a/src/components/smart_objects/include/smart_objects/array_schema_item.h b/src/components/smart_objects/include/smart_objects/array_schema_item.h index 937979f2fa..27d7180d5a 100644 --- a/src/components/smart_objects/include/smart_objects/array_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/array_schema_item.h @@ -34,7 +34,7 @@ #include <stddef.h> -#include "utils/shared_ptr.h" + #include "smart_objects/schema_item.h" #include "smart_objects/always_true_schema_item.h" #include "smart_objects/schema_item_parameter.h" @@ -55,7 +55,7 @@ class CArraySchemaItem : public ISchemaItem { * * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CArraySchemaItem> create( + static std::shared_ptr<CArraySchemaItem> create( const ISchemaItemPtr ElementSchemaItem = CAlwaysTrueSchemaItem::create(), const TSchemaItemParameter<size_t>& MinSize = TSchemaItemParameter<size_t>(), diff --git a/src/components/smart_objects/include/smart_objects/bool_schema_item.h b/src/components/smart_objects/include/smart_objects/bool_schema_item.h index eca5a0e063..a4db49c95f 100644 --- a/src/components/smart_objects/include/smart_objects/bool_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/bool_schema_item.h @@ -33,7 +33,7 @@ #ifndef SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_BOOL_SCHEMA_ITEM_H_ #define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_BOOL_SCHEMA_ITEM_H_ -#include "utils/shared_ptr.h" + #include "smart_objects/default_shema_item.h" @@ -49,7 +49,7 @@ class CBoolSchemaItem : public CDefaultSchemaItem<bool> { * @param DefaultValue Default value of a parameter. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CBoolSchemaItem> create( + static std::shared_ptr<CBoolSchemaItem> create( const TSchemaItemParameter<bool>& DefaultValue = TSchemaItemParameter<bool>()); diff --git a/src/components/smart_objects/include/smart_objects/default_shema_item.h b/src/components/smart_objects/include/smart_objects/default_shema_item.h index 56952dbac1..b364fe7982 100644 --- a/src/components/smart_objects/include/smart_objects/default_shema_item.h +++ b/src/components/smart_objects/include/smart_objects/default_shema_item.h @@ -33,7 +33,7 @@ #define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_DEFAULT_SHEMA_ITEM_H_ #include "utils/macro.h" -#include "utils/shared_ptr.h" + #include "smart_objects/schema_item.h" #include "smart_objects/schema_item_parameter.h" diff --git a/src/components/smart_objects/include/smart_objects/enum_schema_item.h b/src/components/smart_objects/include/smart_objects/enum_schema_item.h index 524d966188..8679d7e9dd 100644 --- a/src/components/smart_objects/include/smart_objects/enum_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/enum_schema_item.h @@ -39,7 +39,7 @@ #include <set> #include <string> -#include "utils/shared_ptr.h" + #include "smart_objects/default_shema_item.h" namespace NsSmartDeviceLink { @@ -60,7 +60,7 @@ class TEnumSchemaItem : public CDefaultSchemaItem<EnumType> { * @param DefaultValue Default value. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<TEnumSchemaItem> create( + static std::shared_ptr<TEnumSchemaItem> create( const std::set<EnumType>& AllowedElements, const TSchemaItemParameter<EnumType>& DefaultValue = TSchemaItemParameter<EnumType>()); @@ -208,10 +208,10 @@ class EnumConversionHelper { }; template <typename EnumType> -utils::SharedPtr<TEnumSchemaItem<EnumType> > TEnumSchemaItem<EnumType>::create( +std::shared_ptr<TEnumSchemaItem<EnumType>> TEnumSchemaItem<EnumType>::create( const std::set<EnumType>& AllowedElements, const TSchemaItemParameter<EnumType>& DefaultValue) { - return new TEnumSchemaItem<EnumType>(AllowedElements, DefaultValue); + return std::shared_ptr<TEnumSchemaItem<EnumType>> (new TEnumSchemaItem<EnumType>(AllowedElements, DefaultValue)); } template <typename EnumType> diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h index 34c5e3a8a6..c6d42066b5 100644 --- a/src/components/smart_objects/include/smart_objects/number_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h @@ -35,7 +35,7 @@ #include <typeinfo> #include <limits> -#include "utils/shared_ptr.h" + #include "smart_objects/default_shema_item.h" #include "smart_objects/schema_item_parameter.h" #include "utils/convert_utils.h" @@ -57,7 +57,7 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> { * @param DefaultValue Default value. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<TNumberSchemaItem> create( + static std::shared_ptr<TNumberSchemaItem> create( const TSchemaItemParameter<NumberType>& MinValue = TSchemaItemParameter<NumberType>(), const TSchemaItemParameter<NumberType>& MaxValue = @@ -112,11 +112,11 @@ class TNumberSchemaItem : public CDefaultSchemaItem<NumberType> { }; template <typename NumberType> -utils::SharedPtr<TNumberSchemaItem<NumberType> > TNumberSchemaItem< +std::shared_ptr<TNumberSchemaItem<NumberType>> TNumberSchemaItem< NumberType>::create(const TSchemaItemParameter<NumberType>& MinValue, const TSchemaItemParameter<NumberType>& MaxValue, const TSchemaItemParameter<NumberType>& DefaultValue) { - return new TNumberSchemaItem<NumberType>(MinValue, MaxValue, DefaultValue); + return std::shared_ptr<TNumberSchemaItem<NumberType>>(new TNumberSchemaItem<NumberType>(MinValue, MaxValue, DefaultValue)); } template <typename NumberType> diff --git a/src/components/smart_objects/include/smart_objects/object_schema_item.h b/src/components/smart_objects/include/smart_objects/object_schema_item.h index 8922caba45..4c0def558b 100644 --- a/src/components/smart_objects/include/smart_objects/object_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/object_schema_item.h @@ -37,7 +37,6 @@ #include <set> #include "utils/macro.h" -#include "utils/shared_ptr.h" #include "smart_objects/schema_item.h" #include "smart_objects/schema_item_parameter.h" @@ -82,7 +81,7 @@ class CObjectSchemaItem : public ISchemaItem { * * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CObjectSchemaItem> create(const Members& Members); + static std::shared_ptr<CObjectSchemaItem> create(const Members& Members); /** * @deprecated * @brief Validate smart object. diff --git a/src/components/smart_objects/include/smart_objects/schema_item.h b/src/components/smart_objects/include/smart_objects/schema_item.h index 446c7fa65f..2b15a1d47a 100644 --- a/src/components/smart_objects/include/smart_objects/schema_item.h +++ b/src/components/smart_objects/include/smart_objects/schema_item.h @@ -33,11 +33,14 @@ #define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SCHEMA_ITEM_H_ #include <stdlib.h> -#include "utils/shared_ptr.h" + #include "rpc_base/validation_report.h" #include "smart_objects/errors.h" +#include <memory> +#include "utils/macro.h" + namespace NsSmartDeviceLink { namespace NsSmartObjects { class SmartObject; @@ -126,7 +129,7 @@ class ISchemaItem { virtual ~ISchemaItem() {} }; -typedef utils::SharedPtr<ISchemaItem> ISchemaItemPtr; +typedef std::shared_ptr<ISchemaItem> ISchemaItemPtr; } // namespace NsSmartObjects } // namespace NsSmartDeviceLink #endif // SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_SCHEMA_ITEM_H_ diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h index cc2bc7e22c..6a2cbdb911 100644 --- a/src/components/smart_objects/include/smart_objects/smart_object.h +++ b/src/components/smart_objects/include/smart_objects/smart_object.h @@ -126,7 +126,7 @@ typedef std::map<std::string, SmartObject> SmartMap; **/ typedef std::vector<uint8_t> SmartBinary; -typedef utils::SharedPtr<SmartObject> SmartObjectSPtr; +typedef std::shared_ptr<SmartObject> SmartObjectSPtr; /** * @brief List of SmartObjects diff --git a/src/components/smart_objects/include/smart_objects/string_schema_item.h b/src/components/smart_objects/include/smart_objects/string_schema_item.h index 6c98dcc3b3..4783a91fea 100644 --- a/src/components/smart_objects/include/smart_objects/string_schema_item.h +++ b/src/components/smart_objects/include/smart_objects/string_schema_item.h @@ -36,7 +36,7 @@ #include <stddef.h> #include <string> -#include "utils/shared_ptr.h" + #include "smart_objects/default_shema_item.h" #include "smart_objects/schema_item_parameter.h" @@ -54,7 +54,7 @@ class CStringSchemaItem : public CDefaultSchemaItem<std::string> { * @param DefaultValue Default value. * @return Shared pointer to a new schema item. **/ - static utils::SharedPtr<CStringSchemaItem> create( + static std::shared_ptr<CStringSchemaItem> create( const TSchemaItemParameter<size_t>& MinLength = TSchemaItemParameter<size_t>(), const TSchemaItemParameter<size_t>& MaxLength = diff --git a/src/components/smart_objects/src/always_false_schema_item.cc b/src/components/smart_objects/src/always_false_schema_item.cc index 1893ed24d1..203ae11236 100644 --- a/src/components/smart_objects/src/always_false_schema_item.cc +++ b/src/components/smart_objects/src/always_false_schema_item.cc @@ -37,8 +37,8 @@ namespace NsSmartObjects { CAlwaysFalseSchemaItem::CAlwaysFalseSchemaItem() {} -utils::SharedPtr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() { - return new CAlwaysFalseSchemaItem(); +std::shared_ptr<CAlwaysFalseSchemaItem> CAlwaysFalseSchemaItem::create() { + return std::shared_ptr<CAlwaysFalseSchemaItem>(new CAlwaysFalseSchemaItem()); } Errors::eType CAlwaysFalseSchemaItem::validate(const SmartObject& object) { diff --git a/src/components/smart_objects/src/always_true_schema_item.cc b/src/components/smart_objects/src/always_true_schema_item.cc index 1e7115316d..774bcea121 100644 --- a/src/components/smart_objects/src/always_true_schema_item.cc +++ b/src/components/smart_objects/src/always_true_schema_item.cc @@ -35,8 +35,8 @@ namespace NsSmartObjects { CAlwaysTrueSchemaItem::CAlwaysTrueSchemaItem() {} -utils::SharedPtr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() { - return new CAlwaysTrueSchemaItem(); +std::shared_ptr<CAlwaysTrueSchemaItem> CAlwaysTrueSchemaItem::create() { + return std::shared_ptr<CAlwaysTrueSchemaItem>(new CAlwaysTrueSchemaItem()); } Errors::eType CAlwaysTrueSchemaItem::validate(const SmartObject& object) { diff --git a/src/components/smart_objects/src/array_schema_item.cc b/src/components/smart_objects/src/array_schema_item.cc index dca0a815e0..9bd3a9a70d 100644 --- a/src/components/smart_objects/src/array_schema_item.cc +++ b/src/components/smart_objects/src/array_schema_item.cc @@ -34,11 +34,11 @@ namespace NsSmartDeviceLink { namespace NsSmartObjects { -utils::SharedPtr<CArraySchemaItem> CArraySchemaItem::create( +std::shared_ptr<CArraySchemaItem> CArraySchemaItem::create( const ISchemaItemPtr ElementSchemaItem, const TSchemaItemParameter<size_t>& MinSize, const TSchemaItemParameter<size_t>& MaxSize) { - return new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize); + return std::shared_ptr<CArraySchemaItem>(new CArraySchemaItem(ElementSchemaItem, MinSize, MaxSize)); } Errors::eType CArraySchemaItem::validate(const SmartObject& Object) { diff --git a/src/components/smart_objects/src/bool_schema_item.cc b/src/components/smart_objects/src/bool_schema_item.cc index c1da95528a..dcf1e13918 100644 --- a/src/components/smart_objects/src/bool_schema_item.cc +++ b/src/components/smart_objects/src/bool_schema_item.cc @@ -35,9 +35,9 @@ namespace NsSmartDeviceLink { namespace NsSmartObjects { -utils::SharedPtr<CBoolSchemaItem> CBoolSchemaItem::create( +std::shared_ptr<CBoolSchemaItem> CBoolSchemaItem::create( const TSchemaItemParameter<bool>& DefaultValue) { - return new CBoolSchemaItem(DefaultValue); + return std::shared_ptr<CBoolSchemaItem>(new CBoolSchemaItem(DefaultValue)); } CBoolSchemaItem::CBoolSchemaItem(const TSchemaItemParameter<bool>& DefaultValue) diff --git a/src/components/smart_objects/src/object_schema_item.cc b/src/components/smart_objects/src/object_schema_item.cc index 2bed3d9a26..c79b97689d 100644 --- a/src/components/smart_objects/src/object_schema_item.cc +++ b/src/components/smart_objects/src/object_schema_item.cc @@ -51,9 +51,9 @@ CObjectSchemaItem::SMember::SMember(const ISchemaItemPtr SchemaItem, const bool IsMandatory) : mSchemaItem(SchemaItem), mIsMandatory(IsMandatory) {} -utils::SharedPtr<CObjectSchemaItem> CObjectSchemaItem::create( +std::shared_ptr<CObjectSchemaItem> CObjectSchemaItem::create( const Members& members) { - return new CObjectSchemaItem(members); + return std::shared_ptr<CObjectSchemaItem>(new CObjectSchemaItem(members)); } Errors::eType CObjectSchemaItem::validate(const SmartObject& object) { diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc index 1e4c8372f0..2f71533b53 100644 --- a/src/components/smart_objects/src/string_schema_item.cc +++ b/src/components/smart_objects/src/string_schema_item.cc @@ -38,11 +38,11 @@ namespace NsSmartObjects { namespace custom_str = utils::custom_string; -utils::SharedPtr<CStringSchemaItem> CStringSchemaItem::create( +std::shared_ptr<CStringSchemaItem> CStringSchemaItem::create( const TSchemaItemParameter<size_t>& MinLength, const TSchemaItemParameter<size_t>& MaxLength, const TSchemaItemParameter<std::string>& DefaultValue) { - return new CStringSchemaItem(MinLength, MaxLength, DefaultValue); + return std::shared_ptr<CStringSchemaItem>(new CStringSchemaItem(MinLength, MaxLength, DefaultValue)); } Errors::eType CStringSchemaItem::validate(const SmartObject& Object) { diff --git a/src/components/smart_objects/test/BoolSchemaItem_test.cc b/src/components/smart_objects/test/BoolSchemaItem_test.cc index 8d67aa59b2..8299635c6a 100644 --- a/src/components/smart_objects/test/BoolSchemaItem_test.cc +++ b/src/components/smart_objects/test/BoolSchemaItem_test.cc @@ -34,7 +34,7 @@ #include "gmock/gmock.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "smart_objects/bool_schema_item.h" diff --git a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc index b11560914e..1eb0b31cb3 100644 --- a/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc +++ b/src/components/smart_objects/test/SmartObjectConvertionTime_test.cc @@ -36,7 +36,7 @@ #include "gmock/gmock.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "smart_objects/smart_schema.h" diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h index 3c3de20e0e..eabaf0a5e4 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h @@ -44,7 +44,7 @@ class ApplicationManagerObserver; class ApplicationManagerMetricWrapper : public MetricWrapper { public: - utils::SharedPtr<application_manager::AMTelemetryObserver::MessageMetric> + std::shared_ptr<application_manager::AMTelemetryObserver::MessageMetric> message_metric; virtual Json::Value GetJsonMetric(); }; diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h index ecb9c8002a..31a3ceea12 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h @@ -45,7 +45,7 @@ class ApplicationManagerObserver : public application_manager::AMTelemetryObserver { public: explicit ApplicationManagerObserver(TelemetryMonitor* telemetry_monitor); - virtual void OnMessage(utils::SharedPtr<MessageMetric> metric); + virtual void OnMessage(std::shared_ptr<MessageMetric> metric); private: TelemetryMonitor* telemetry_monitor_; diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h index daf602e9ca..dfe7f4b964 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h @@ -34,7 +34,7 @@ #define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_METRIC_WRAPPER_H_ #include <string> -#include "utils/shared_ptr.h" + #include "telemetry_monitor/metric_wrapper.h" #include "protocol_handler_observer.h" @@ -42,7 +42,7 @@ namespace telemetry_monitor { class ProtocolHandlerMecticWrapper : public MetricWrapper { public: - utils::SharedPtr<protocol_handler::PHTelemetryObserver::MessageMetric> + std::shared_ptr<protocol_handler::PHTelemetryObserver::MessageMetric> message_metric; virtual Json::Value GetJsonMetric(); }; diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h index 69e5658382..fabf8042d0 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h @@ -47,7 +47,7 @@ class ProtocolHandlerObserver : public protocol_handler::PHTelemetryObserver { virtual void StartMessageProcess(uint32_t message_id, const TimevalStruct& start_time); - virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m); + virtual void EndMessageProcess(std::shared_ptr<MessageMetric> m); private: TelemetryMonitor* telemetry_monitor_; diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h index 618901ffa8..ccdfe3ea2e 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h @@ -46,11 +46,6 @@ #include "protocol_handler_observer.h" #include "protocol_handler/protocol_handler_impl.h" -namespace utils { -template <typename T> -class SharedPtr; -} - namespace telemetry_monitor { using ::utils::MessageQueue; @@ -62,7 +57,7 @@ class Streamer : public threads::ThreadDelegate { void threadMain() OVERRIDE; void exitThreadMain() OVERRIDE; - virtual void PushMessage(utils::SharedPtr<MetricWrapper> metric); + virtual void PushMessage(std::shared_ptr<MetricWrapper> metric); volatile bool is_client_connected_; private: @@ -75,7 +70,7 @@ class Streamer : public threads::ThreadDelegate { int32_t server_socket_fd_; int32_t client_socket_fd_; volatile bool stop_flag_; - MessageQueue<utils::SharedPtr<MetricWrapper> > messages_; + MessageQueue<std::shared_ptr<MetricWrapper> > messages_; DISALLOW_COPY_AND_ASSIGN(Streamer); }; @@ -91,9 +86,9 @@ class TelemetryMonitor { transport_manager); virtual void Stop(); virtual void Start(); - virtual void SendMetric(utils::SharedPtr<MetricWrapper> metric); + virtual void SendMetric(std::shared_ptr<MetricWrapper> metric); DEPRECATED void set_streamer(Streamer* streamer); - void set_streamer(utils::SharedPtr<Streamer> streamer); + void set_streamer(std::shared_ptr<Streamer> streamer); const std::string& ip() const; int16_t port() const; @@ -101,7 +96,7 @@ class TelemetryMonitor { std::string server_address_; int16_t port_; threads::Thread* thread_; - utils::SharedPtr<Streamer> streamer_; + std::shared_ptr<Streamer> streamer_; ApplicationManagerObserver app_observer; TransportManagerObserver tm_observer; ProtocolHandlerObserver ph_observer; diff --git a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h index b601e89b18..d1239c9d1b 100644 --- a/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h +++ b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h @@ -41,7 +41,7 @@ namespace telemetry_monitor { class TransportManagerMecticWrapper : public MetricWrapper { public: - utils::SharedPtr<transport_manager::TMTelemetryObserver::MessageMetric> + std::shared_ptr<transport_manager::TMTelemetryObserver::MessageMetric> message_metric; virtual Json::Value GetJsonMetric(); }; diff --git a/src/components/telemetry_monitor/src/application_manager_observer.cc b/src/components/telemetry_monitor/src/application_manager_observer.cc index cb390eddeb..1e621c8a6e 100644 --- a/src/components/telemetry_monitor/src/application_manager_observer.cc +++ b/src/components/telemetry_monitor/src/application_manager_observer.cc @@ -30,7 +30,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include "telemetry_monitor/application_manager_observer.h" -#include "utils/shared_ptr.h" + #include "telemetry_monitor/telemetry_monitor.h" #include "telemetry_monitor/application_manager_metric_wrapper.h" @@ -41,8 +41,8 @@ ApplicationManagerObserver::ApplicationManagerObserver( : telemetry_monitor_(telemetry_monitor) {} void ApplicationManagerObserver::OnMessage( - utils::SharedPtr<MessageMetric> metric) { - ApplicationManagerMetricWrapper* m = new ApplicationManagerMetricWrapper(); + std::shared_ptr<MessageMetric> metric) { + auto m = std::make_shared<ApplicationManagerMetricWrapper>(); m->message_metric = metric; m->grabResources(); telemetry_monitor_->SendMetric(m); diff --git a/src/components/telemetry_monitor/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc index 2244cb2259..95f1a87b67 100644 --- a/src/components/telemetry_monitor/src/protocol_handler_observer.cc +++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc @@ -58,7 +58,7 @@ void ProtocolHandlerObserver::StartMessageProcess( } void ProtocolHandlerObserver::EndMessageProcess( - utils::SharedPtr<MessageMetric> m) { + std::shared_ptr<MessageMetric> m) { uint32_t message_id = m->message_id; std::map<uint32_t, TimevalStruct>::const_iterator it = time_starts.find(message_id); @@ -68,7 +68,7 @@ void ProtocolHandlerObserver::EndMessageProcess( } m->begin = time_starts[message_id]; m->end = date_time::DateTime::getCurrentTime(); - ProtocolHandlerMecticWrapper* metric = new ProtocolHandlerMecticWrapper(); + auto metric = std::make_shared<ProtocolHandlerMecticWrapper>(); metric->message_metric = m; metric->grabResources(); telemetry_monitor_->SendMetric(metric); diff --git a/src/components/telemetry_monitor/src/telemetry_monitor.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc index 53a5a2dc70..6d95553a59 100644 --- a/src/components/telemetry_monitor/src/telemetry_monitor.cc +++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc @@ -42,8 +42,8 @@ #include "transport_manager/transport_manager_default.h" #include "utils/resource_usage.h" -#include "utils/make_shared.h" -#include "utils/shared_ptr.h" + + #include "telemetry_monitor/telemetry_observable.h" namespace telemetry_monitor { @@ -60,13 +60,13 @@ TelemetryMonitor::TelemetryMonitor(const std::string& server_address, , ph_observer(this) {} void TelemetryMonitor::Start() { - streamer_ = streamer_ ? streamer_ : utils::MakeShared<Streamer>(this); + streamer_ = streamer_ ? streamer_ : std::make_shared<Streamer>(this); thread_ = threads::CreateThread("TelemetryMonitor", streamer_.get()); } void TelemetryMonitor::set_streamer(Streamer* streamer) {} -void TelemetryMonitor::set_streamer(utils::SharedPtr<Streamer> streamer) { +void TelemetryMonitor::set_streamer(std::shared_ptr<Streamer> streamer) { LOG4CXX_AUTO_TRACE(logger_); if (thread_ && !thread_->is_running()) { streamer_ = streamer; @@ -115,7 +115,7 @@ void TelemetryMonitor::Stop() { thread_ = NULL; } -void TelemetryMonitor::SendMetric(utils::SharedPtr<MetricWrapper> metric) { +void TelemetryMonitor::SendMetric(std::shared_ptr<MetricWrapper> metric) { if (streamer_ && streamer_->is_client_connected_) { streamer_->PushMessage(metric); } @@ -149,7 +149,7 @@ void Streamer::threadMain() { is_client_connected_ = true; while (is_client_connected_) { while (!messages_.empty()) { - utils::SharedPtr<MetricWrapper> metric; + std::shared_ptr<MetricWrapper> metric; if (!messages_.pop(metric)) { continue; } @@ -282,7 +282,7 @@ bool Streamer::Send(const std::string& msg) { return true; } -void Streamer::PushMessage(utils::SharedPtr<MetricWrapper> metric) { +void Streamer::PushMessage(std::shared_ptr<MetricWrapper> metric) { messages_.push(metric); } } // namespace telemetry_monitor diff --git a/src/components/telemetry_monitor/src/transport_manager_observer.cc b/src/components/telemetry_monitor/src/transport_manager_observer.cc index b3e57ac22a..d0c7fe42d9 100644 --- a/src/components/telemetry_monitor/src/transport_manager_observer.cc +++ b/src/components/telemetry_monitor/src/transport_manager_observer.cc @@ -53,9 +53,9 @@ void TransportManagerObserver::StopRawMsg( it; it = time_starts.find(ptr); if (it != time_starts.end()) { - TransportManagerMecticWrapper* m = new TransportManagerMecticWrapper(); + auto m = std::make_shared<TransportManagerMecticWrapper>(); m->message_metric = - new transport_manager::TMTelemetryObserver::MessageMetric(); + std::make_shared<transport_manager::TMTelemetryObserver::MessageMetric>(); m->message_metric->begin = it->second; m->message_metric->end = date_time::DateTime::getCurrentTime(); m->message_metric->data_size = ptr->data_size(); diff --git a/src/components/telemetry_monitor/test/application_manager_metric_test.cc b/src/components/telemetry_monitor/test/application_manager_metric_test.cc index 9029c41bc4..cd0d599690 100644 --- a/src/components/telemetry_monitor/test/application_manager_metric_test.cc +++ b/src/components/telemetry_monitor/test/application_manager_metric_test.cc @@ -58,14 +58,14 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetric) { end_time.tv_sec = 10; end_time.tv_usec = 0; metric_test.message_metric = - new application_manager::AMTelemetryObserver::MessageMetric(); + std::make_shared<application_manager::AMTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; NsSmartDeviceLink::NsSmartObjects::SmartObject obj; obj["params"][application_manager::strings::correlation_id] = 11; obj["params"][application_manager::strings::connection_key] = 12; metric_test.message_metric->message = - new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj); + std::make_shared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(obj); Json::Value jvalue = metric_test.GetJsonMetric(); EXPECT_EQ("null\n", @@ -99,14 +99,14 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) { end_time.tv_usec = 0; metric_test.message_metric = - new application_manager::AMTelemetryObserver::MessageMetric(); + std::make_shared<application_manager::AMTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; NsSmartDeviceLink::NsSmartObjects::SmartObject obj; obj["params"][application_manager::strings::correlation_id] = 11; obj["params"][application_manager::strings::connection_key] = 12; metric_test.message_metric->message = - new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj); + std::make_shared<NsSmartDeviceLink::NsSmartObjects::SmartObject>(obj); Json::Value jvalue = metric_test.GetJsonMetric(); EXPECT_EQ(date_time::DateTime::getuSecs(start_time), diff --git a/src/components/telemetry_monitor/test/application_manager_observer_test.cc b/src/components/telemetry_monitor/test/application_manager_observer_test.cc index 5b7a551247..deecfa57b7 100644 --- a/src/components/telemetry_monitor/test/application_manager_observer_test.cc +++ b/src/components/telemetry_monitor/test/application_manager_observer_test.cc @@ -35,7 +35,7 @@ #include "application_manager/telemetry_observer.h" #include "telemetry_monitor/application_manager_metric_wrapper.h" #include "telemetry_monitor/application_manager_observer.h" -#include "utils/shared_ptr.h" + #include "telemetry_monitor/telemetry_monitor.h" namespace test { @@ -49,7 +49,7 @@ TEST(ApplicationManagerObserver, CallOnMessage) { MockTelemetryMonitor mock_telemetry_monitor; ApplicationManagerObserver app_observer(&mock_telemetry_monitor); typedef application_manager::AMTelemetryObserver::MessageMetric AMMetric; - utils::SharedPtr<AMMetric> ptr = + std::shared_ptr<AMMetric> ptr = application_manager::AMTelemetryObserver::MessageMetricSharedPtr(); EXPECT_CALL(mock_telemetry_monitor, SendMetric(_)); app_observer.OnMessage(ptr); diff --git a/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h index fdda58bd08..201220c863 100644 --- a/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h +++ b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h @@ -37,7 +37,7 @@ #include "gmock/gmock.h" #include "telemetry_monitor/telemetry_monitor.h" #include "telemetry_monitor/metric_wrapper.h" -#include "utils/shared_ptr.h" + namespace test { namespace components { @@ -50,7 +50,7 @@ class MockTelemetryMonitor : public telemetry_monitor::TelemetryMonitor { MOCK_METHOD0(Stop, void()); MOCK_METHOD0(Start, void()); MOCK_METHOD1(SendMetric, - void(utils::SharedPtr<telemetry_monitor::MetricWrapper> metric)); + void(std::shared_ptr<telemetry_monitor::MetricWrapper> metric)); }; } // namespace transport_manager_test } // namespace components diff --git a/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc index 8253cf2553..f247f76866 100644 --- a/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc +++ b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc @@ -59,7 +59,7 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetric) { end_time.tv_sec = 10; end_time.tv_usec = 0; metric_test.message_metric = - new protocol_handler::PHTelemetryObserver::MessageMetric(); + std::make_shared<protocol_handler::PHTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; metric_test.message_metric->message_id = 5; @@ -93,7 +93,7 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetricWithGrabResources) { end_time.tv_sec = 10; end_time.tv_usec = 0; metric_test.message_metric = - new protocol_handler::PHTelemetryObserver::MessageMetric(); + std::make_shared<protocol_handler::PHTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; metric_test.message_metric->message_id = 5; diff --git a/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc index 784e809da6..3b2691bf72 100644 --- a/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc +++ b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc @@ -53,7 +53,7 @@ TEST(ProtocolHandlerObserverTest, MessageProcess) { pr_handler.StartMessageProcess(message_id, start_time); typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType; - utils::SharedPtr<MetricType> message_metric = new MetricType(); + std::shared_ptr<MetricType> message_metric = std::make_shared<MetricType>(); message_metric->message_id = 1; EXPECT_CALL(mock_telemetry_monitor, SendMetric(_)); pr_handler.EndMessageProcess(message_metric); @@ -70,7 +70,7 @@ TEST(ProtocolHandlerObserverTest, MessageProcessWithZeroMessageId) { pr_handler.StartMessageProcess(message_id, start_time); typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType; - utils::SharedPtr<MetricType> message_metric = new MetricType(); + std::shared_ptr<MetricType> message_metric = std::make_shared<MetricType>(); message_metric->message_id = 0; EXPECT_CALL(mock_telemetry_monitor, SendMetric(_)).Times(0); pr_handler.EndMessageProcess(message_metric); diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc index 5235f0a469..d0f82103d4 100644 --- a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc +++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc @@ -40,8 +40,8 @@ #include "connection_handler/mock_connection_handler.h" #include "transport_manager/mock_transport_manager.h" #include "telemetry_monitor/mock_telemetry_observable.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + using testing::Return; using testing::_; @@ -57,7 +57,7 @@ class StreamerMock : public Streamer { StreamerMock(TelemetryMonitor* const server) : Streamer(server) { is_client_connected_ = true; } - MOCK_METHOD1(PushMessage, void(utils::SharedPtr<MetricWrapper> metric)); + MOCK_METHOD1(PushMessage, void(std::shared_ptr<MetricWrapper> metric)); }; TEST(TelemetryMonitorTest, MessageProcess) { @@ -92,14 +92,14 @@ TEST(TelemetryMonitorTest, MessageProcess) { EXPECT_CALL(am_observeble, SetTelemetryObserver(_)); EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_)); telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port); - utils::SharedPtr<StreamerMock> streamer_mock = - utils::MakeShared<StreamerMock>(&telemetry_monitor); + std::shared_ptr<StreamerMock> streamer_mock = + std::make_shared<StreamerMock>(&telemetry_monitor); // streamer_mock will be freed by telemetry_monitor on destruction telemetry_monitor.Start(); telemetry_monitor.set_streamer(streamer_mock); telemetry_monitor.Init( &protocol_handler_mock, &am_observeble, &transport_manager_mock); - utils::SharedPtr<telemetry_monitor::MetricWrapper> test_metric; + std::shared_ptr<telemetry_monitor::MetricWrapper> test_metric; EXPECT_CALL(*streamer_mock, PushMessage(test_metric)); telemetry_monitor.SendMetric(test_metric); } diff --git a/src/components/telemetry_monitor/test/transport_manager_metric_test.cc b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc index 6eb479387a..99006c03ba 100644 --- a/src/components/telemetry_monitor/test/transport_manager_metric_test.cc +++ b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc @@ -59,7 +59,7 @@ TEST(TransportManagerMetricWrapper, GetJsonMetric) { end_time.tv_sec = 10; end_time.tv_usec = 0; metric_test.message_metric = - new transport_manager::TMTelemetryObserver::MessageMetric(); + std::make_shared<transport_manager::TMTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; metric_test.message_metric->data_size = 1000; @@ -90,7 +90,7 @@ TEST(TransportManagerMetricWrapper, GetJsonMetricWithGrabResources) { end_time.tv_sec = 10; end_time.tv_usec = 0; metric_test.message_metric = - new transport_manager::TMTelemetryObserver::MessageMetric(); + std::make_shared<transport_manager::TMTelemetryObserver::MessageMetric>(); metric_test.message_metric->begin = start_time; metric_test.message_metric->end = end_time; diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h index 537e94b055..e3be189b50 100644 --- a/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h +++ b/src/components/transport_manager/include/transport_manager/transport_adapter/connection.h @@ -35,7 +35,7 @@ #ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_CONNECTION_H_ #define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_CONNECTION_H_ -#include "utils/shared_ptr.h" + #include "transport_manager/transport_adapter/transport_adapter.h" namespace transport_manager { @@ -67,7 +67,7 @@ class Connection { virtual TransportAdapter::Error Disconnect() = 0; }; -typedef utils::SharedPtr<Connection> ConnectionSPtr; +typedef std::shared_ptr<Connection> ConnectionSPtr; } // namespace transport_adapter } // namespace transport_manager diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h index eaa71ce3bb..356776cea9 100644 --- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h +++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h @@ -64,7 +64,7 @@ typedef threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> > RawMessageLoopThread; typedef threads::MessageLoopThread<std::queue<TransportAdapterEvent> > TransportAdapterEventLoopThread; -typedef utils::SharedPtr<timer::Timer> TimerSPtr; +typedef std::shared_ptr<timer::Timer> TimerSPtr; typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap; /** diff --git a/src/components/transport_manager/include/transport_manager/usb/common.h b/src/components/transport_manager/include/transport_manager/usb/common.h index 1c6011dbb2..8fa0d8468e 100644 --- a/src/components/transport_manager/include/transport_manager/usb/common.h +++ b/src/components/transport_manager/include/transport_manager/usb/common.h @@ -35,7 +35,7 @@ #include <stdint.h> -#include "utils/shared_ptr.h" + #if defined(__QNXNTO__) #include "transport_manager/usb/qnx/usb_handler.h" @@ -64,7 +64,7 @@ static const uint16_t kApplePid8 = 0x12a8; // iPhone 5 static const int kUsbConfiguration = 1; -typedef utils::SharedPtr<UsbHandler> UsbHandlerSptr; +typedef std::shared_ptr<UsbHandler> UsbHandlerSptr; class UsbDeviceListener { public: diff --git a/src/components/transport_manager/include/transport_manager/usb/usb_device.h b/src/components/transport_manager/include/transport_manager/usb/usb_device.h index 8ca1a32a28..b66943561b 100644 --- a/src/components/transport_manager/include/transport_manager/usb/usb_device.h +++ b/src/components/transport_manager/include/transport_manager/usb/usb_device.h @@ -54,8 +54,8 @@ class UsbDevice : public Device { return usb_device_; } - protected: virtual ~UsbDevice() {} + protected: virtual bool IsSameAs(const Device* other_device) const { return unique_device_id() == other_device->unique_device_id(); @@ -69,6 +69,7 @@ class UsbDevice : public Device { private: PlatformUsbDevice* usb_device_; + }; } // namespace transport_adapter diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc index 0d8a77c88f..f5dc498db9 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_connection_factory.cc @@ -37,7 +37,7 @@ #include "transport_manager/bluetooth/bluetooth_connection_factory.h" #include "transport_manager/bluetooth/bluetooth_socket_connection.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace transport_manager { namespace transport_adapter { @@ -55,8 +55,8 @@ TransportAdapter::Error BluetoothConnectionFactory::Init() { TransportAdapter::Error BluetoothConnectionFactory::CreateConnection( const DeviceUID& device_uid, const ApplicationHandle& app_handle) { LOG4CXX_AUTO_TRACE(logger_); - utils::SharedPtr<BluetoothSocketConnection> connection = - utils::MakeShared<BluetoothSocketConnection>( + std::shared_ptr<BluetoothSocketConnection> connection = + std::make_shared<BluetoothSocketConnection>( device_uid, app_handle, controller_); controller_->ConnectionCreated(connection, device_uid, app_handle); TransportAdapter::Error error = connection->Start(); diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc index 743c95f2e6..4a214a7610 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_device_scanner.cc @@ -262,8 +262,8 @@ void BluetoothDeviceScanner::CheckSDLServiceOnDevices( deviceName[name_len - 1] = '\0'; } - Device* bluetooth_device = - new BluetoothDevice(bd_address, deviceName, sdl_rfcomm_channels[i]); + auto bluetooth_device = + std::make_shared<BluetoothDevice>(bd_address, deviceName, sdl_rfcomm_channels[i]); if (bluetooth_device) { LOG4CXX_INFO(logger_, "Bluetooth device created successfully"); discovered_devices->push_back(bluetooth_device); diff --git a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc index 0f83f32c60..b373744f79 100644 --- a/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc +++ b/src/components/transport_manager/src/bluetooth/bluetooth_transport_adapter.cc @@ -80,8 +80,8 @@ void BluetoothTransportAdapter::Store() const { if (!device) { // device could have been disconnected continue; } - utils::SharedPtr<BluetoothDevice> bluetooth_device = - DeviceSptr::static_pointer_cast<BluetoothDevice>(device); + std::shared_ptr<BluetoothDevice> bluetooth_device = + std::static_pointer_cast<BluetoothDevice>(device); Json::Value device_dictionary; device_dictionary["name"] = bluetooth_device->name(); char address[18]; diff --git a/src/components/transport_manager/src/tcp/tcp_client_listener.cc b/src/components/transport_manager/src/tcp/tcp_client_listener.cc index 4b590318e6..1697165d08 100644 --- a/src/components/transport_manager/src/tcp/tcp_client_listener.cc +++ b/src/components/transport_manager/src/tcp/tcp_client_listener.cc @@ -59,7 +59,7 @@ #include <sstream> #include "utils/logger.h" -#include "utils/make_shared.h" + #include "utils/threads/thread.h" #include "transport_manager/transport_adapter/transport_adapter_controller.h" #include "transport_manager/tcp/network_interface_listener_impl.h" @@ -303,20 +303,20 @@ void TcpClientListener::Loop() { device_name + std::string(":") + std::to_string(port_); #if defined(BUILD_TESTS) - TcpDevice* tcp_device = new TcpDevice( + auto tcp_device = std::make_shared<TcpDevice>( client_address.sin_addr.s_addr, device_uid, device_name); #else - TcpDevice* tcp_device = - new TcpDevice(client_address.sin_addr.s_addr, device_uid); + auto tcp_device = + std::make_shared<TcpDevice>(client_address.sin_addr.s_addr, device_uid); #endif // BUILD_TESTS DeviceSptr device = controller_->AddDevice(tcp_device); - tcp_device = static_cast<TcpDevice*>(device.get()); + auto tcp_device_raw = static_cast<TcpDevice*>(device.get()); const ApplicationHandle app_handle = - tcp_device->AddIncomingApplication(connection_fd); + tcp_device_raw->AddIncomingApplication(connection_fd); - utils::SharedPtr<TcpSocketConnection> connection = - utils::MakeShared<TcpSocketConnection>( + std::shared_ptr<TcpSocketConnection> connection = + std::make_shared<TcpSocketConnection>( device->unique_device_id(), app_handle, controller_); controller_->ConnectionCreated( connection, device->unique_device_id(), app_handle); diff --git a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc index 114425076a..e76fadfd35 100644 --- a/src/components/transport_manager/src/tcp/tcp_connection_factory.cc +++ b/src/components/transport_manager/src/tcp/tcp_connection_factory.cc @@ -35,7 +35,7 @@ #include "transport_manager/tcp/tcp_server_originated_socket_connection.h" #include "utils/logger.h" -#include "utils/make_shared.h" + namespace transport_manager { namespace transport_adapter { @@ -56,8 +56,8 @@ TransportAdapter::Error TcpConnectionFactory::CreateConnection( LOG4CXX_DEBUG(logger_, "DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle); - utils::SharedPtr<TcpServerOriginatedSocketConnection> connection = - utils::MakeShared<TcpServerOriginatedSocketConnection>( + std::shared_ptr<TcpServerOriginatedSocketConnection> connection = + std::make_shared<TcpServerOriginatedSocketConnection>( device_uid, app_handle, controller_); controller_->ConnectionCreated(connection, device_uid, app_handle); const TransportAdapter::Error error = connection->Start(); diff --git a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc index 516f2d3ec4..2f10bd9454 100644 --- a/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc +++ b/src/components/transport_manager/src/tcp/tcp_server_originated_socket_connection.cc @@ -56,7 +56,7 @@ bool TcpServerOriginatedSocketConnection::Establish(ConnectError** error) { DCHECK(error); LOG4CXX_DEBUG(logger_, "error " << error); DeviceSptr device = controller()->FindDevice(device_handle()); - if (!device.valid()) { + if (device.use_count() == 0) { LOG4CXX_ERROR(logger_, "Device " << device_handle() << " not found"); *error = new ConnectError(); return false; diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc index f475912401..27ff893df3 100644 --- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc +++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc @@ -103,8 +103,8 @@ void TcpTransportAdapter::Store() const { if (!device) { // device could have been disconnected continue; } - utils::SharedPtr<TcpDevice> tcp_device = - DeviceSptr::static_pointer_cast<TcpDevice>(device); + std::shared_ptr<TcpDevice> tcp_device = + std::static_pointer_cast<TcpDevice>(device); Json::Value device_dictionary; device_dictionary["name"] = tcp_device->name(); struct in_addr address; diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc index 89459b8ebb..96f8afd2ea 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc @@ -826,16 +826,16 @@ ApplicationList TransportAdapterImpl::GetApplicationList( const DeviceUID& device_id) const { LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id); DeviceSptr device = FindDevice(device_id); - if (device.valid()) { + if (device.use_count() != 0) { ApplicationList lst = device->GetApplicationList(); LOG4CXX_TRACE(logger_, "exit with ApplicationList. It's size = " - << lst.size() << " Condition: device.valid()"); + << lst.size() << " Condition: device.use_count() != 0"); return lst; } LOG4CXX_TRACE( logger_, - "exit with empty ApplicationList. Condition: NOT device.valid()"); + "exit with empty ApplicationList. Condition: NOT device.use_count() != 0"); return ApplicationList(); } @@ -898,7 +898,7 @@ bool TransportAdapterImpl::IsInitialised() const { std::string TransportAdapterImpl::DeviceName(const DeviceUID& device_id) const { DeviceSptr device = FindDevice(device_id); - if (device.valid()) { + if (device.use_count() != 0) { return device->name(); } else { return ""; diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc index b0ec3c8f8e..5bf9036a4e 100644 --- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc +++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc @@ -278,7 +278,7 @@ void TransportAdapterListenerImpl::OnDataSendDone( device, app_id, data_container, - new BaseError()); + std::make_shared<BaseError>()); if (transport_manager_ != NULL && transport_manager::E_SUCCESS != transport_manager_->ReceiveEventFromDevice(event)) { diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc index 764accf7fe..68cfb0bc8d 100644 --- a/src/components/transport_manager/src/transport_manager_impl.cc +++ b/src/components/transport_manager/src/transport_manager_impl.cc @@ -47,7 +47,7 @@ #include "utils/macro.h" #include "utils/logger.h" -#include "utils/make_shared.h" + #include "utils/timer_task_impl.h" #include "transport_manager/common.h" #include "transport_manager/transport_manager_listener.h" @@ -1069,7 +1069,7 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) { LOG4CXX_ERROR(logger_, "Transport adapter failed to send data"); // TODO(YK): potential error case -> thread unsafe // update of message content - if (event.event_data.valid()) { + if (event.event_data.use_count() != 0) { event.event_data->set_waiting(true); } else { LOG4CXX_DEBUG(logger_, "Data is invalid"); @@ -1213,7 +1213,7 @@ TransportManagerImpl::ConnectionInternal::ConnectionInternal( const DeviceHandle device_handle) : transport_manager(transport_manager) , transport_adapter(transport_adapter) - , timer(utils::MakeShared<timer::Timer, + , timer(std::make_shared<timer::Timer, const char*, ::timer::TimerTaskImpl<ConnectionInternal>*>( "TM DiscRoutine", diff --git a/src/components/transport_manager/src/usb/libusb/usb_connection.cc b/src/components/transport_manager/src/usb/libusb/usb_connection.cc index e9ab2bae8e..212e6e0ec3 100644 --- a/src/components/transport_manager/src/usb/libusb/usb_connection.cc +++ b/src/components/transport_manager/src/usb/libusb/usb_connection.cc @@ -224,7 +224,7 @@ void UsbConnection::OnOutTransfer(libusb_transfer* transfer) { device_uid_, app_handle_, current_out_message_, DataSendError()); PopOutMessage(); } - if (!current_out_message_.valid()) { + if (current_out_message_.use_count() == 0) { libusb_free_transfer(transfer); out_transfer_ = NULL; waiting_out_transfer_cancel_ = false; @@ -242,7 +242,7 @@ TransportAdapter::Error UsbConnection::SendData( return TransportAdapter::BAD_STATE; } sync_primitives::AutoLock locker(out_messages_mutex_); - if (current_out_message_.valid()) { + if (current_out_message_.use_count() != 0) { out_messages_.push_back(message); } else { current_out_message_ = message; diff --git a/src/components/transport_manager/src/usb/qnx/usb_connection.cc b/src/components/transport_manager/src/usb/qnx/usb_connection.cc index 516a367ebc..b9386c5d9f 100644 --- a/src/components/transport_manager/src/usb/qnx/usb_connection.cc +++ b/src/components/transport_manager/src/usb/qnx/usb_connection.cc @@ -230,7 +230,7 @@ void UsbConnection::OnOutTransfer(usbd_urb* urb) { } } - if ((!disconnecting_) && current_out_message_.valid()) { + if ((!disconnecting_) && (current_out_message_.use_count() != 0)) { PostOutTransfer(); } else { pending_out_transfer_ = false; @@ -243,7 +243,7 @@ TransportAdapter::Error UsbConnection::SendData( return TransportAdapter::BAD_STATE; } sync_primitives::AutoLock locker(out_messages_mutex_); - if (current_out_message_.valid()) { + if (current_out_message_.use_count() != 0) { out_messages_.push_back(message); } else { current_out_message_ = message; diff --git a/src/components/transport_manager/src/usb/usb_connection_factory.cc b/src/components/transport_manager/src/usb/usb_connection_factory.cc index 1136dfad21..c34292e758 100644 --- a/src/components/transport_manager/src/usb/usb_connection_factory.cc +++ b/src/components/transport_manager/src/usb/usb_connection_factory.cc @@ -34,7 +34,7 @@ #include "transport_manager/usb/usb_device.h" #include "transport_manager/transport_adapter/transport_adapter_impl.h" #include "utils/logger.h" -#include "utils/make_shared.h" + #if defined(__QNXNTO__) #include "transport_manager/usb/qnx/usb_connection.h" @@ -65,17 +65,17 @@ TransportAdapter::Error UsbConnectionFactory::CreateConnection( "enter DeviceUID: " << &device_uid << ", ApplicationHandle: " << &app_handle); DeviceSptr device = controller_->FindDevice(device_uid); - if (!device.valid()) { + if (device.use_count() == 0) { LOG4CXX_ERROR(logger_, "device " << device_uid << " not found"); LOG4CXX_TRACE( logger_, - "exit with TransportAdapter::BAD_PARAM. Condition: !device.valid()"); + "exit with TransportAdapter::BAD_PARAM. Condition: device.use_count() == 0"); return TransportAdapter::BAD_PARAM; } UsbDevice* usb_device = static_cast<UsbDevice*>(device.get()); - utils::SharedPtr<UsbConnection> connection = - utils::MakeShared<UsbConnection>(device_uid, + std::shared_ptr<UsbConnection> connection = + std::make_shared<UsbConnection>(device_uid, app_handle, controller_, usb_handler_, diff --git a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h index bb15c19d3b..9c7327e6fb 100644 --- a/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h +++ b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h @@ -57,8 +57,8 @@ class RawMessageMatcher : public MatcherInterface<RawMessagePtr> { virtual bool MatchAndExplain(const RawMessagePtr ptr, MatchResultListener* listener) const; - virtual void DescribeTo(::std::ostream* os) const; - virtual void DescribeNegationTo(::std::ostream* os) const; + virtual void DescribeTo(std::ostream* os) const; + virtual void DescribeNegationTo(std::ostream* os) const; private: const RawMessagePtr ptr_; diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc index 7ab53915fe..496851c0ef 100644 --- a/src/components/transport_manager/test/tcp_client_listener_test.cc +++ b/src/components/transport_manager/test/tcp_client_listener_test.cc @@ -46,7 +46,7 @@ #include "transport_manager/mock_transport_manager.h" #include "transport_manager/transport_adapter/transport_adapter_controller.h" #include "transport_manager/transport_adapter/mock_device.h" -#include "utils/make_shared.h" + #include "utils/test_async_waiter.h" #include "utils/threads/thread.h" @@ -310,7 +310,7 @@ TEST_P(TcpClientListenerTest, ClientConnection) { TestAsyncWaiter waiter; // controller should be notified of AddDevice event - DeviceSptr mock_device = utils::MakeShared<MockTCPDevice>( + DeviceSptr mock_device = std::make_shared<MockTCPDevice>( htonl(INADDR_LOOPBACK), "dummy_tcp_device"); EXPECT_CALL(adapter_controller_mock_, AddDevice(_)) .WillOnce(Return(mock_device)); diff --git a/src/components/transport_manager/test/tcp_transport_adapter_test.cc b/src/components/transport_manager/test/tcp_transport_adapter_test.cc index a6896dc48a..d56cb5dbdd 100644 --- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc +++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc @@ -41,7 +41,7 @@ #include "transport_manager/tcp/mock_tcp_transport_adapter.h" #include "transport_manager/mock_transport_manager_settings.h" -#include "utils/make_shared.h" + namespace test { namespace components { @@ -76,7 +76,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) { MockTCPTransportAdapter transport_adapter( port, last_state_, transport_manager_settings); std::string uniq_id = "unique_device_name"; - utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id); + std::shared_ptr<MockTCPDevice> mockdev = std::make_shared<MockTCPDevice>(port, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -87,7 +87,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) { std::vector<int> intList = {app_handle}; EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); EXPECT_CALL(transport_adapter, FindEstablishedConnection(uniq_id, app_handle)) .WillOnce(Return(mock_connection)); @@ -115,13 +115,13 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) { MockTCPTransportAdapter transport_adapter( port, last_state_, transport_manager_settings); const uint32_t count_dev = 10; - utils::SharedPtr<MockTCPDevice> mockdev[count_dev]; + std::shared_ptr<MockTCPDevice> mockdev[count_dev]; std::string uniq_id[count_dev]; for (uint32_t i = 0; i < count_dev; i++) { char numb[12]; std::snprintf(numb, 12, "%d", i); uniq_id[i] = "unique_device_name" + std::string(numb); - mockdev[i] = new MockTCPDevice(port, uniq_id[i]); + mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]); EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false)); transport_adapter.AddDevice(mockdev[i]); } @@ -133,7 +133,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) { const int app_handle = 1; std::vector<int> intList = {app_handle}; - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); for (uint32_t i = 0; i < count_dev; i++) { EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i])) .WillOnce(Return(mockdev[i])); @@ -170,13 +170,13 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) { port, last_state_, transport_manager_settings); const uint32_t count_dev = 10; - utils::SharedPtr<MockTCPDevice> mockdev[count_dev]; + std::shared_ptr<MockTCPDevice> mockdev[count_dev]; std::string uniq_id[count_dev]; for (uint32_t i = 0; i < count_dev; i++) { char numb[12]; std::snprintf(numb, 12, "%d", i); uniq_id[i] = "unique_device_name" + std::string(numb); - mockdev[i] = new MockTCPDevice(port, uniq_id[i]); + mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]); EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false)); transport_adapter.AddDevice(mockdev[i]); } @@ -190,7 +190,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) { std::vector<int> intList = {app_handle[0], app_handle[1], app_handle[2]}; const std::string ports[connection_count] = {"11111", "67890", "98765"}; const int int_port[connection_count] = {11111, 67890, 98765}; - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); for (uint32_t i = 0; i < count_dev; i++) { EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i])) .WillOnce(Return(mockdev[i])); @@ -228,7 +228,7 @@ TEST_F(TcpAdapterTest, StoreData_ConnectionNotExist_DataNotStored) { MockTCPTransportAdapter transport_adapter( port, last_state_, transport_manager_settings); std::string uniq_id = "unique_device_name"; - utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id); + auto mockdev = std::make_shared<MockTCPDevice>(port, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -265,7 +265,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) { MockTCPTransportAdapter transport_adapter( port, last_state_, transport_manager_settings); std::string uniq_id = "unique_device_name"; - utils::SharedPtr<MockTCPDevice> mockdev = new MockTCPDevice(port, uniq_id); + std::shared_ptr<MockTCPDevice> mockdev = std::make_shared<MockTCPDevice>(port, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -276,7 +276,7 @@ TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) { std::vector<int> intList = {app_handle}; EXPECT_CALL(*mockdev, GetApplicationList()).WillOnce(Return(intList)); - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); EXPECT_CALL(transport_adapter, FindEstablishedConnection(uniq_id, app_handle)) .WillOnce(Return(mock_connection)); @@ -300,13 +300,13 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) { port, last_state_, transport_manager_settings); const uint32_t count_dev = 10; - utils::SharedPtr<MockTCPDevice> mockdev[count_dev]; + std::shared_ptr<MockTCPDevice> mockdev[count_dev]; std::string uniq_id[count_dev]; for (uint32_t i = 0; i < count_dev; i++) { char numb[12]; std::snprintf(numb, 12, "%d", i); uniq_id[i] = "unique_device_name" + std::string(numb); - mockdev[i] = new MockTCPDevice(port, uniq_id[i]); + mockdev[i] = std::make_shared<MockTCPDevice>(port, uniq_id[i]); EXPECT_CALL(*(mockdev[i]), IsSameAs(_)).WillRepeatedly(Return(false)); transport_adapter.AddDevice(mockdev[i]); } @@ -318,7 +318,7 @@ TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) { const int app_handle = 1; std::vector<int> intList = {app_handle}; - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); for (uint32_t i = 0; i < count_dev; i++) { EXPECT_CALL(transport_adapter, FindDevice(uniq_id[i])) .WillOnce(Return(mockdev[i])); diff --git a/src/components/transport_manager/test/transport_adapter_listener_test.cc b/src/components/transport_manager/test/transport_adapter_listener_test.cc index 1494844519..acf9d3dcb3 100644 --- a/src/components/transport_manager/test/transport_adapter_listener_test.cc +++ b/src/components/transport_manager/test/transport_adapter_listener_test.cc @@ -129,7 +129,7 @@ TEST_F(TransportAdapterListenerTest, OnDataReceiveFailed) { TEST_F(TransportAdapterListenerTest, OnDataSendDone) { unsigned char data[3] = {0x20, 0x07, 0x01}; ::protocol_handler::RawMessagePtr data_container = - new ::protocol_handler::RawMessage(1, 1, data, 3); + std::make_shared<::protocol_handler::RawMessage>(1, 1, data, 3); EXPECT_CALL(tr_mock, ReceiveEventFromDevice(IsEvent(EventTypeEnum::ON_SEND_DONE, @@ -145,7 +145,7 @@ TEST_F(TransportAdapterListenerTest, OnDataSendDone) { TEST_F(TransportAdapterListenerTest, OnDataSendFailed) { unsigned char data[3] = {0x20, 0x07, 0x01}; ::protocol_handler::RawMessagePtr data_container = - new ::protocol_handler::RawMessage(1, 1, data, 3); + std::make_shared<::protocol_handler::RawMessage>(1, 1, data, 3); DataSendError err; EXPECT_CALL(tr_mock, diff --git a/src/components/transport_manager/test/transport_adapter_test.cc b/src/components/transport_manager/test/transport_adapter_test.cc index 68758f418f..d5b9c40821 100644 --- a/src/components/transport_manager/test/transport_adapter_test.cc +++ b/src/components/transport_manager/test/transport_adapter_test.cc @@ -45,7 +45,7 @@ #include "transport_manager/transport_adapter/transport_adapter_controller.h" #include "transport_manager/transport_adapter/connection.h" #include "protocol/raw_message.h" -#include "utils/make_shared.h" + #include "resumption/last_state_impl.h" #include "config_profile/profile.h" @@ -156,10 +156,10 @@ TEST_F(TransportAdapterTest, SearchDeviceDone_DeviceExisting) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = new MockDevice(dev_id, uniq_id); + auto mockdev = std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); - std::vector<utils::SharedPtr<Device> > devList; + std::vector<std::shared_ptr<Device> > devList; devList.push_back(mockdev); EXPECT_CALL(*mockdev, IsSameAs(_)).WillOnce(Return(true)); @@ -189,8 +189,8 @@ TEST_F(TransportAdapterTest, AddDevice) { MockTransportAdapterListener mock_listener; transport_adapter.AddListener(&mock_listener); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); transport_adapter.AddDevice(mockdev); @@ -277,8 +277,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_ServerNotAdded_DeviceAdded) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -307,7 +307,7 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceNotAdded) { EXPECT_CALL(*serverMock, IsInitialised()).Times(0); EXPECT_CALL(*serverMock, CreateConnection(_, _)).Times(0); EXPECT_CALL(transport_adapter, FindDevice(uniq_id)) - .WillOnce(Return(utils::SharedPtr<MockDevice>())); + .WillOnce(Return(std::shared_ptr<MockDevice>())); TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::BAD_PARAM, res); @@ -323,8 +323,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAdded) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -354,8 +354,8 @@ TEST_F(TransportAdapterTest, ConnectDevice_DeviceAddedTwice) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -401,7 +401,7 @@ TEST_F(TransportAdapterTest, Disconnect_ConnectDoneSuccess) { TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle); EXPECT_EQ(TransportAdapter::OK, res); - MockConnection* mock_connection = new MockConnection(); + auto mock_connection = std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle); EXPECT_CALL(transport_adapter, Store()); @@ -425,8 +425,8 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -443,7 +443,7 @@ TEST_F(TransportAdapterTest, DisconnectDevice_DeviceAddedConnectionCreated) { TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); - MockConnection* mock_connection = new MockConnection(); + auto mock_connection = std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle); EXPECT_CALL(*mock_connection, Disconnect()) @@ -467,8 +467,8 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) { MockTransportAdapterListener mock_listener; transport_adapter.AddListener(&mock_listener); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); transport_adapter.AddDevice(mockdev); @@ -485,8 +485,8 @@ TEST_F(TransportAdapterTest, DeviceDisconnected) { TransportAdapter::Error res = transport_adapter.ConnectDevice(uniq_id); EXPECT_EQ(TransportAdapter::OK, res); - utils::SharedPtr<MockConnection> mock_connection = - utils::MakeShared<MockConnection>(); + std::shared_ptr<MockConnection> mock_connection = + std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, uniq_id, app_handle); EXPECT_CALL(mock_listener, OnDeviceListUpdated(&transport_adapter)); @@ -545,7 +545,7 @@ TEST_F(TransportAdapterTest, SendData) { TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle); EXPECT_EQ(TransportAdapter::OK, res); - MockConnection* mock_connection = new MockConnection(); + auto mock_connection = std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle); EXPECT_CALL(transport_adapter, Store()); @@ -553,7 +553,7 @@ TEST_F(TransportAdapterTest, SendData) { const unsigned int kSize = 3; unsigned char data[kSize] = {0x20, 0x07, 0x01}; - const RawMessagePtr kMessage = new RawMessage(1, 1, data, kSize); + const RawMessagePtr kMessage = std::make_shared<RawMessage>(1, 1, data, kSize); EXPECT_CALL(*mock_connection, SendData(kMessage)) .WillOnce(Return(TransportAdapter::OK)); @@ -586,12 +586,12 @@ TEST_F(TransportAdapterTest, SendData_ConnectionNotEstablished) { TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle); EXPECT_EQ(TransportAdapter::OK, res); - MockConnection* mock_connection = new MockConnection(); + auto mock_connection = std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle); const unsigned int kSize = 3; unsigned char data[kSize] = {0x20, 0x07, 0x01}; - const RawMessagePtr kMessage = new RawMessage(1, 1, data, kSize); + const RawMessagePtr kMessage = std::make_shared<RawMessage>(1, 1, data, kSize); EXPECT_CALL(*mock_connection, SendData(kMessage)).Times(0); res = transport_adapter.SendData(dev_id, app_handle, kMessage); @@ -712,8 +712,8 @@ TEST_F(TransportAdapterTest, GetDeviceAndApplicationLists) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - utils::SharedPtr<MockDevice> mockdev = - utils::MakeShared<MockDevice>(dev_id, uniq_id); + std::shared_ptr<MockDevice> mockdev = + std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); std::vector<std::string> devList = transport_adapter.GetDeviceList(); @@ -744,7 +744,7 @@ TEST_F(TransportAdapterTest, FindEstablishedConnection) { TransportAdapter::Error res = transport_adapter.Connect(dev_id, app_handle); EXPECT_EQ(TransportAdapter::OK, res); - ConnectionSPtr mock_connection = new MockConnection(); + ConnectionSPtr mock_connection = std::make_shared<MockConnection>(); transport_adapter.ConnectionCreated(mock_connection, dev_id, app_handle); EXPECT_CALL(transport_adapter, Store()); @@ -763,14 +763,14 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_NoDeviseWithAskedId_UNSUCCESS) { MockTransportAdapterImpl transport_adapter( NULL, NULL, NULL, last_state_, transport_manager_settings); - utils::SharedPtr<MockDevice> mock_device = - utils::MakeShared<MockDevice>("test_device_name", "test_device_uid0"); + std::shared_ptr<MockDevice> mock_device = + std::make_shared<MockDevice>("test_device_name", "test_device_uid0"); transport_adapter.AddDevice(mock_device); EXPECT_CALL(*mock_device, LaunchApp(bundle_id)).Times(0); EXPECT_CALL(transport_adapter, FindDevice("test_device_uid1")) - .WillOnce(Return(utils::SharedPtr<MockDevice>())); + .WillOnce(Return(std::shared_ptr<MockDevice>())); transport_adapter.RunAppOnDevice("test_device_uid1", bundle_id); } @@ -782,8 +782,8 @@ TEST_F(TransportAdapterTest, RunAppOnDevice_DeviseWithAskedIdWasFound_SUCCESS) { MockTransportAdapterImpl transport_adapter( NULL, NULL, NULL, last_state_, transport_manager_settings); - utils::SharedPtr<MockDevice> mock_device = - utils::MakeShared<MockDevice>("test_device_name", device_uid); + std::shared_ptr<MockDevice> mock_device = + std::make_shared<MockDevice>("test_device_name", device_uid); transport_adapter.AddDevice(mock_device); @@ -800,7 +800,7 @@ TEST_F(TransportAdapterTest, StopDevice) { EXPECT_CALL(transport_adapter, Restore()).WillOnce(Return(true)); transport_adapter.Init(); - auto mockdev = utils::MakeShared<MockDevice>(dev_id, uniq_id); + auto mockdev = std::make_shared<MockDevice>(dev_id, uniq_id); transport_adapter.AddDevice(mockdev); EXPECT_CALL(transport_adapter, FindDevice(uniq_id)).WillOnce(Return(mockdev)); diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc index 9ba95ea99a..863c32f2ab 100644 --- a/src/components/transport_manager/test/transport_manager_impl_test.cc +++ b/src/components/transport_manager/test/transport_manager_impl_test.cc @@ -42,8 +42,8 @@ #include "transport_manager/mock_transport_manager_impl.h" #include "transport_manager/mock_transport_manager_settings.h" #include "resumption/last_state_impl.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "utils/test_async_waiter.h" using ::testing::_; @@ -55,7 +55,7 @@ using ::testing::DoAll; using ::protocol_handler::RawMessage; using ::protocol_handler::RawMessagePtr; -using utils::MakeShared; +using std::make_shared; namespace test { namespace components { @@ -85,7 +85,7 @@ class TransportManagerImplTest : public ::testing::Test { "app_info_storage"); tm_.Init(last_state_); mock_adapter_ = new MockTransportAdapter(); - tm_listener_ = MakeShared<MockTransportManagerListener>(); + tm_listener_ = std::make_shared<MockTransportManagerListener>(); #ifdef TELEMETRY_MONITOR tm_.SetTelemetryObserver(&mock_metric_observer_); @@ -96,14 +96,14 @@ class TransportManagerImplTest : public ::testing::Test { EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(mock_adapter_)); connection_key_ = 1; - error_ = MakeShared<BaseError>(); + error_ = std::make_shared<BaseError>(); const unsigned int version_protocol_ = 1; const unsigned int kSize = 12; unsigned char data[kSize] = { 0x20, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; test_message_ = - MakeShared<RawMessage>(connection_key_, version_protocol_, data, kSize); + std::make_shared<RawMessage>(connection_key_, version_protocol_, data, kSize); } DeviceInfo ConstructDeviceInfo(const std::string& mac_address, @@ -331,7 +331,7 @@ class TransportManagerImplTest : public ::testing::Test { #endif // TELEMETRY_MONITOR MockTransportAdapter* mock_adapter_; - utils::SharedPtr<MockTransportManagerListener> tm_listener_; + std::shared_ptr<MockTransportManagerListener> tm_listener_; MockTransportManagerImpl tm_; const ApplicationHandle application_id_ = 1; ConnectionUID connection_key_; @@ -1144,7 +1144,7 @@ TEST_F(TransportManagerImplTest, test_message_, error_)); - auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>(); + auto second_mock_adapter = std::make_shared<MockTransportAdapter>(); const auto usb_serial = "USB_serial"; DeviceInfo second_device = @@ -1220,7 +1220,7 @@ TEST_F(TransportManagerImplTest, test_message_, error_)); - auto second_mock_adapter = utils::MakeShared<MockTransportAdapter>(); + auto second_mock_adapter = std::make_shared<MockTransportAdapter>(); DeviceInfo second_device = ConstructDeviceInfo("MA:CA:DR:ES:S", "USB_IOS", "SecondDeviceName"); diff --git a/src/components/utils/test/async_runner_test.cc b/src/components/utils/test/async_runner_test.cc index 65abad65c2..bd6e743291 100644 --- a/src/components/utils/test/async_runner_test.cc +++ b/src/components/utils/test/async_runner_test.cc @@ -36,8 +36,8 @@ #include "utils/lock.h" #include "utils/threads/async_runner.h" #include "utils/conditional_variable.h" -#include "utils/shared_ptr.h" -#include "utils/make_shared.h" + + #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -92,7 +92,7 @@ class AsyncRunnerTest : public ::testing::Test { protected: ThreadDelegate** delegates_; - ::utils::SharedPtr<AsyncRunner> async_runner_; + std::shared_ptr<AsyncRunner> async_runner_; void CreateThreadsArray() { delegates_ = new ThreadDelegate* [kDelegatesAmount]; @@ -103,7 +103,7 @@ class AsyncRunnerTest : public ::testing::Test { } void CreateAsyncRunner() { - async_runner_ = ::utils::MakeShared<AsyncRunner>("test"); + async_runner_ = std::make_shared<AsyncRunner>("test"); } }; @@ -128,8 +128,8 @@ TEST_F(AsyncRunnerTest, StopThenRun_ExpectDelegateNotStarted) { // Check that delegate was not started due to Stop() called before AsyncRun() EXPECT_CALL(mock_thread_delegate, threadMain()).Times(0); { - ::utils::SharedPtr<AsyncRunner> async_runner = - ::utils::MakeShared<AsyncRunner>("test"); + std::shared_ptr<AsyncRunner> async_runner = + std::make_shared<AsyncRunner>("test"); async_runner->Stop(); async_runner->AsyncRun(&mock_thread_delegate); } diff --git a/src/components/utils/test/shared_ptr_test.cc b/src/components/utils/test/shared_ptr_test.cc deleted file mode 100644 index 99fe4f7dd7..0000000000 --- a/src/components/utils/test/shared_ptr_test.cc +++ /dev/null @@ -1,542 +0,0 @@ -/* - * Copyright (c) 2015, 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 <stdlib.h> -#include <vector> -#include <iostream> -#include "gmock/gmock.h" -#include "utils/shared_ptr.h" - -namespace test { -namespace components { -namespace utils_test { - -class CMockObject { - public: - CMockObject(int id); - virtual ~CMockObject(); - virtual int getId() const; - - MOCK_METHOD0(destructor, void()); - - private: - int mId_; -}; - -class CExtendedMockObject : public CMockObject { - public: - CExtendedMockObject(int id); -}; - -using ::testing::NiceMock; - -CMockObject::CMockObject(int id) : mId_(id) {} - -CMockObject::~CMockObject() { - destructor(); -} - -int CMockObject::getId() const { - return mId_; -} - -CExtendedMockObject::CExtendedMockObject(int id) : CMockObject(id) {} - -typedef utils::SharedPtr<CMockObject> tMockObjectPtr; -typedef utils::SharedPtr<CExtendedMockObject> tExtendedMockObjectPtr; - -TEST(SharedPtrTest, DefaultConstructorTest) { - // Constructor checks - tMockObjectPtr p0; - ASSERT_EQ(0, p0.get()); - ASSERT_FALSE(p0.valid()); -} - -TEST(SharedPtrTest, ConstructorWithOneParameterTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - EXPECT_CALL(*object1, destructor()).Times(1); - - // Constructor checks - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); -} - -TEST(SharedPtrTest, CopyConstructorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - EXPECT_CALL(*object1, destructor()).Times(1); - - // Constructor checks - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tMockObjectPtr p2(p1); - ASSERT_EQ(1, p2->getId()); - ASSERT_EQ(2u, *(p2.get_ReferenceCounter())); - tMockObjectPtr p3 = p2; - ASSERT_EQ(1, p3->getId()); - ASSERT_EQ(3u, *(p3.get_ReferenceCounter())); - { - tMockObjectPtr p4 = p3; - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(4u, *(p3.get_ReferenceCounter())); - } - // Check reference counter decreased - ASSERT_EQ(3u, *(p3.get_ReferenceCounter())); -} - -TEST(SharedPtrTest, SecondConstructorWithOneParameterTest) { - // Arrange - CExtendedMockObject* object1 = new CExtendedMockObject(2); - EXPECT_CALL(*object1, destructor()).Times(0); - - // Constructors checks - tExtendedMockObjectPtr p1(object1); - ASSERT_EQ(2, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tMockObjectPtr p2(p1); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(2u, *(p2.get_ReferenceCounter())); - EXPECT_CALL(*object1, destructor()); -} - -TEST(SharedPtrTest, AssignmentOperatorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CMockObject* object2 = new CMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tMockObjectPtr p2(object2); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(1u, *(p2.get_ReferenceCounter())); - - tMockObjectPtr p3(p1); - ASSERT_EQ(1, p3->getId()); - ASSERT_EQ(2u, *(p3.get_ReferenceCounter())); - - tMockObjectPtr p4(p3); - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(3u, *(p4.get_ReferenceCounter())); - - tMockObjectPtr p5(p4); - ASSERT_EQ(1, p5->getId()); - ASSERT_EQ(4u, *(p5.get_ReferenceCounter())); - - p5 = p2; - - // Check reference counter for new SharedPtr increased - ASSERT_EQ(2, p5->getId()); - ASSERT_EQ(2u, *(p5.get_ReferenceCounter())); - - // Check reference counter for old SharedPtr decreased - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(3u, *(p1.get_ReferenceCounter())); - - EXPECT_CALL(*object1, destructor()); - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, SecondAssignmentOperatorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tExtendedMockObjectPtr p2(object2); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(1u, *(p2.get_ReferenceCounter())); - - tMockObjectPtr p3(p1); - ASSERT_EQ(1, p3->getId()); - ASSERT_EQ(2u, *(p3.get_ReferenceCounter())); - - tMockObjectPtr p4(p3); - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(3u, *(p4.get_ReferenceCounter())); - - tMockObjectPtr p5(p4); - ASSERT_EQ(1, p5->getId()); - ASSERT_EQ(4u, *(p5.get_ReferenceCounter())); - // Use assignment operator - p5 = p2; - - // Check reference counter for new SharedPtr increased - ASSERT_EQ(2, p5->getId()); - ASSERT_EQ(2u, *(p5.get_ReferenceCounter())); - - // Check reference counter for old SharedPtr decreased - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(3u, *(p1.get_ReferenceCounter())); - - EXPECT_CALL(*object1, destructor()); - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, EqualOperatorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CMockObject* object2 = new CMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tMockObjectPtr p2(object2); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(1u, *(p2.get_ReferenceCounter())); - - tMockObjectPtr p3(p1); - ASSERT_EQ(1, p3->getId()); - ASSERT_EQ(2u, *(p3.get_ReferenceCounter())); - - tMockObjectPtr p4(p3); - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(3u, *(p4.get_ReferenceCounter())); - - tMockObjectPtr p5(p4); - ASSERT_EQ(1, p5->getId()); - ASSERT_EQ(4u, *(p5.get_ReferenceCounter())); - // Checks - ASSERT_TRUE(p1 == p3); - ASSERT_TRUE(p1 == p4); - ASSERT_TRUE(p4 == p3); - ASSERT_FALSE(p1 == p2); - - EXPECT_CALL(*object1, destructor()); - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, LessThanOperatorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CMockObject* object2 = new CMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tMockObjectPtr p2(object2); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(1u, *(p2.get_ReferenceCounter())); - - // Checks - if (object1 < object2) { - ASSERT_TRUE(p1 < p2); - } else { - ASSERT_FALSE(p1 < p2); - } - - EXPECT_CALL(*object1, destructor()); - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, StaticPointerCastTest_DerivedToBase_ExpectCastOk) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tExtendedMockObjectPtr ep1(object2); - ASSERT_EQ(2, ep1->getId()); - ASSERT_EQ(1u, *(ep1.get_ReferenceCounter())); - // Cast from SharedPtr to Derived class to SharedPtr to Base class - p1 = utils::SharedPtr<CExtendedMockObject>::static_pointer_cast<CMockObject>( - ep1); - // Checks - ASSERT_EQ(2, p1->getId()); - ASSERT_EQ(2u, *(p1.get_ReferenceCounter())); - ASSERT_TRUE(p1 == ep1); - - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, StaticPointerCastTest_BaseToDerived_ExpectCastOk) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(1); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tExtendedMockObjectPtr ep1(object2); - ASSERT_EQ(2, ep1->getId()); - ASSERT_EQ(1u, *(ep1.get_ReferenceCounter())); - // Cast from SharedPtr to Base class to SharedPtr to Derived class - ep1 = utils::SharedPtr<CMockObject>::static_pointer_cast<CExtendedMockObject>( - p1); - // Checks - ASSERT_EQ(1, ep1->getId()); - ASSERT_EQ(2u, *(ep1.get_ReferenceCounter())); - ASSERT_TRUE(p1 == ep1); - - EXPECT_CALL(*object1, destructor()); -} - -TEST(SharedPtrTest, DynamicPointerCastTest_DerivedToBase_ExpectCastOk) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(0); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tExtendedMockObjectPtr ep1(object2); - ASSERT_EQ(2, ep1->getId()); - ASSERT_EQ(1u, *(ep1.get_ReferenceCounter())); - // Cast from SharedPtr to Derived class to SharedPtr to Base class - p1 = utils::SharedPtr<CExtendedMockObject>::dynamic_pointer_cast<CMockObject>( - ep1); - // Checks - ASSERT_EQ(2, p1->getId()); - ASSERT_EQ(2u, *(p1.get_ReferenceCounter())); - ASSERT_TRUE(p1 == ep1); - - EXPECT_CALL(*object2, destructor()); -} - -TEST(SharedPtrTest, DynamicPointerCastTest_BaseToDerived_ExpectNullPtr) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(0); - EXPECT_CALL(*object2, destructor()).Times(1); - - tMockObjectPtr p1(object1); - ASSERT_EQ(1, p1->getId()); - ASSERT_EQ(1u, *(p1.get_ReferenceCounter())); - - tExtendedMockObjectPtr ep1(object2); - ASSERT_EQ(2, ep1->getId()); - ASSERT_EQ(1u, *(ep1.get_ReferenceCounter())); - // Cast from SharedPtr to Base class to SharedPtr to Derived class - ep1 = - utils::SharedPtr<CMockObject>::dynamic_pointer_cast<CExtendedMockObject>( - p1); - // Checks - ASSERT_EQ(NULL, ep1); - - EXPECT_CALL(*object1, destructor()); -} - -TEST(SharedPtrTest, ArrowOperatorTest) { - // Arrange - CExtendedMockObject* object1 = new CExtendedMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(1); - - tExtendedMockObjectPtr ep1(object1); - // Check - ASSERT_EQ(1, ep1->getId()); - - tMockObjectPtr p1(ep1); - // Check - ASSERT_EQ(1, p1->getId()); - - tExtendedMockObjectPtr ep2(object2); - // Check - ASSERT_EQ(2, ep2->getId()); -} - -TEST(SharedPtrTest, DereferenceOperatorTest) { - // Arrange - CExtendedMockObject* object1 = new CExtendedMockObject(1); - CExtendedMockObject* object2 = new CExtendedMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(1); - - tExtendedMockObjectPtr ep1(object1); - // Check - ASSERT_EQ(1, (*ep1).getId()); - - tMockObjectPtr p1(ep1); - // Check - ASSERT_EQ(1, (*p1).getId()); - - tExtendedMockObjectPtr ep2(object2); - // Check - ASSERT_EQ(2, (*ep2).getId()); -} - -TEST(SharedPtrTest, BoolOperatorTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - tMockObjectPtr p1(object1); - tMockObjectPtr p2; - - // Checks - ASSERT_TRUE(p1); - ASSERT_FALSE(p2); - EXPECT_CALL(*object1, destructor()); -} - -TEST(SharedPtrTest, ResetWithoutArgsTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CMockObject* object2 = new CMockObject(2); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(1); - - tMockObjectPtr p1(object1); - tMockObjectPtr p2(object2); - ASSERT_EQ(2, p2->getId()); - ASSERT_EQ(1u, *(p2.get_ReferenceCounter())); - - tMockObjectPtr p3(p1); - tMockObjectPtr p4(p3); - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(3u, *(p4.get_ReferenceCounter())); - // Act - p2.reset(); - // Check - EXPECT_EQ(NULL, p2.get()); - EXPECT_EQ(1u, *(p2.get_ReferenceCounter())); - p4.reset(); - // Check - EXPECT_EQ(NULL, p4.get()); - EXPECT_EQ(1u, *(p4.get_ReferenceCounter())); -} - -TEST(SharedPtrTest, ResetWithArgumentTest) { - // Arrange - CMockObject* object1 = new CMockObject(1); - CMockObject* object2 = new CMockObject(27); - - EXPECT_CALL(*object1, destructor()).Times(1); - EXPECT_CALL(*object2, destructor()).Times(1); - - tMockObjectPtr p1(object1); - tMockObjectPtr p3(p1); - tMockObjectPtr p4(p3); - ASSERT_EQ(1, p4->getId()); - ASSERT_EQ(3u, *(p4.get_ReferenceCounter())); - // Act - p4.reset(object2); - // Check - EXPECT_EQ(27, (*p4).getId()); - EXPECT_EQ(1u, *(p4.get_ReferenceCounter())); -} - -TEST(SharedPtrTest, GetMethodTest_ExpectObjPointer) { - // Arrange - CMockObject* object1 = new CMockObject(1); - EXPECT_CALL(*object1, destructor()).Times(1); - tMockObjectPtr p1(object1); - // Check - ASSERT_EQ(object1, p1.get()); -} - -TEST(SharedPtrTest, ValidMethodTest_ExpectCorrectValidation) { - // Arrange - CMockObject* object1 = new CMockObject(1); - EXPECT_CALL(*object1, destructor()).Times(1); - - tMockObjectPtr p1(object1); - tMockObjectPtr p2; - // Check - ASSERT_TRUE(p1.valid()); - ASSERT_FALSE(p2.valid()); -} - -TEST(SharedPtrTest, DISABLED_StressTest) { - // Arrange - const size_t kNumIterations = 1024U * 1024U; - - size_t objectCreated = 0U; - size_t pointersCopied = 0U; - std::vector<tMockObjectPtr> objects; - - for (size_t i = 0U; i < kNumIterations; ++i) { - if ((true == objects.empty()) || (0 == rand() % 256)) { - CMockObject* object = new CMockObject(0); - EXPECT_CALL(*object, destructor()); - objects.push_back(object); - ++objectCreated; - } else { - size_t objectIndex = static_cast<size_t>(rand()) % objects.size(); - - if (rand() % 2) { - objects.push_back(objects[objectIndex]); - ++pointersCopied; - } else { - objects.erase(objects.begin() + objectIndex); - } - } - } - printf("%zu objects created, %zu pointers copied\n", - objectCreated, - pointersCopied); -} - -} // namespace utils_test -} // namespace components -} // namespace test diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py index d13ac29c9b..0c500dee8e 100755 --- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py +++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py @@ -1283,7 +1283,6 @@ class CodeGenerator(object): u'''#include "formatters/CSmartFactory.h"\n''' u'''#include "smart_objects/smart_schema.h"\n''' u'''#include "smart_objects/schema_item.h"\n''' - u'''#include "utils/shared_ptr.h"\n''' u'''#include "$header_file_name"\n''' u'''\n''' u'''$namespace_open''' @@ -1386,7 +1385,7 @@ class CodeGenerator(object): u'''message_type_items);\n''' u'''}\n''' u'''\n''' - u'''utils::SharedPtr<ISchemaItem> $namespace::$class_name::''' + u'''std::shared_ptr<ISchemaItem> $namespace::$class_name::''' u'''ProvideObjectSchemaItemForStruct(\n''' u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const StructIdentifiers::eType struct_id) {\n''' @@ -1465,7 +1464,7 @@ class CodeGenerator(object): u'''\n''') _struct_schema_item_template = string.Template( - u'''utils::SharedPtr<ISchemaItem> struct_schema_item_${name} = ''' + u'''std::shared_ptr<ISchemaItem> struct_schema_item_${name} = ''' u'''InitStructSchemaItem_${name}(struct_schema_items);\n''' u'''struct_schema_items.insert(std::make_pair(''' u'''StructIdentifiers::${name}, struct_schema_item_${name}));\n''' @@ -1482,7 +1481,7 @@ class CodeGenerator(object): u'''struct_schema_items, function_id_items, message_type_items)));''') _struct_impl_template = string.Template( - u'''utils::SharedPtr<ISchemaItem> $namespace::$class_name::''' + u'''std::shared_ptr<ISchemaItem> $namespace::$class_name::''' u'''InitStructSchemaItem_${struct_name}(\n''' u''' const TStructsSchemaItems &struct_schema_items) {\n''' u'''$code''' @@ -1504,7 +1503,7 @@ class CodeGenerator(object): _impl_code_item_decl_temlate = string.Template( u'''${comment}''' - u'''utils::SharedPtr<ISchemaItem> ${var_name} = ${item_decl};''') + u'''std::shared_ptr<ISchemaItem> ${var_name} = ${item_decl};''') _impl_code_integer_item_template = string.Template( u'''TNumberSchemaItem<${type}>::create(${params})''') @@ -1580,7 +1579,7 @@ class CodeGenerator(object): u''' * @brief Type that maps of struct IDs to schema items.\n''' u''' */\n''' u''' typedef std::map<const StructIdentifiers::eType, ''' - u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::''' + u'''std::shared_ptr<NsSmartDeviceLink::NsSmartObjects::''' u'''ISchemaItem> > TStructsSchemaItems;\n''' u'''\n''' u''' /**\n''' @@ -1589,10 +1588,10 @@ class CodeGenerator(object): u''' * @param struct_schema_items Struct schema items.\n''' u''' * @param struct_id ID of structure to provide.\n''' u''' *\n''' - u''' * @return utils::SharedPtr of strucute\n''' + u''' * @return std::shared_ptr of strucute\n''' u''' */\n''' u''' static ''' - u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ''' + u'''std::shared_ptr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ''' u'''ProvideObjectSchemaItemForStruct(\n''' u''' const TStructsSchemaItems &struct_schema_items,\n''' u''' const StructIdentifiers::eType struct_id);\n''' @@ -1637,7 +1636,7 @@ class CodeGenerator(object): _struct_decl_template = string.Template( u'''$comment\n''' u'''static ''' - u'''utils::SharedPtr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ''' + u'''std::shared_ptr<NsSmartDeviceLink::NsSmartObjects::ISchemaItem> ''' u'''InitStructSchemaItem_${struct_name}(\n''' u''' const TStructsSchemaItems &struct_schema_items);''') |