summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/CMakeLists.txt1
-rw-r--r--src/components/application_manager/include/application_manager/application.h14
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h29
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h44
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h2
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h14
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h21
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h24
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h26
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h16
-rw-r--r--src/components/application_manager/src/application_impl.cc16
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc44
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc1
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc6
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc29
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc10
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc12
-rw-r--r--src/components/application_manager/test/application_impl_test.cc17
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc10
-rw-r--r--src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc10
-rw-r--r--src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc28
-rw-r--r--src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc3
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc20
-rw-r--r--src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc5
-rw-r--r--src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc3
-rw-r--r--src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc7
-rw-r--r--src/components/application_manager/test/commands/mobile/add_command_request_test.cc9
-rw-r--r--src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc23
-rw-r--r--src/components/application_manager/test/commands/mobile/alert_request_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/change_registration_test.cc9
-rw-r--r--src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc38
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_command_request_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc1
-rw-r--r--src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc11
-rw-r--r--src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc9
-rw-r--r--src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc4
-rw-r--r--src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc21
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc19
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc6
-rw-r--r--src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc15
-rw-r--r--src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc17
-rw-r--r--src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc25
-rw-r--r--src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc4
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/perform_interaction_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/read_did_request_test.cc5
-rw-r--r--src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc25
-rw-r--r--src/components/application_manager/test/commands/mobile/scrollable_message_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/send_location_request_test.cc9
-rw-r--r--src/components/application_manager/test/commands/mobile/set_app_icon_test.cc14
-rw-r--r--src/components/application_manager/test/commands/mobile/set_display_layout_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/set_global_properties_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc10
-rw-r--r--src/components/application_manager/test/commands/mobile/show_test.cc53
-rw-r--r--src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc16
-rw-r--r--src/components/application_manager/test/commands/mobile/slider_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/speak_request_test.cc12
-rw-r--r--src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc8
-rw-r--r--src/components/application_manager/test/commands/mobile/system_request_test.cc1
-rw-r--r--src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc2
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc13
-rw-r--r--src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc9
-rw-r--r--src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc4
-rw-r--r--src/components/application_manager/test/include/application_manager/commands/commands_test.h22
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h4
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data.h2
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc6
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc26
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc26
75 files changed, 444 insertions, 583 deletions
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index 7a49ce6b81..21f92418fe 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -324,6 +324,7 @@ set (HMI_COMMANDS_SOURCES
${COMMANDS_SOURCE_DIR}/hmi/on_system_error_notification.cc
${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_request.cc
${COMMANDS_SOURCE_DIR}/hmi/basic_communication_system_response.cc
+ ${COMMANDS_SOURCE_DIR}/hmi/basic_communication_on_awake_sdl.cc
${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update.cc
${COMMANDS_SOURCE_DIR}/hmi/sdl_policy_update_response.cc
${COMMANDS_SOURCE_DIR}/hmi/on_received_policy_update.cc
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index fdb0c15922..b753ba0e7f 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -409,6 +409,20 @@ class Application : public virtual InitialApplicationData,
virtual void UpdateHash() = 0;
/**
+ * @brief checks is hashID was changed during suspended state
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ virtual bool IsHashChangedDuringSuspend() const = 0;
+
+ /**
+ * @brief changes state of the flag which tracks is hashID was changed during
+ * suspended state or not
+ * @param state new state of the flag
+ */
+ virtual void SetHashChangedDuringSuspend(const bool state) = 0;
+
+ /**
* @brief method is called when SDL is saving application data for resumption
* @return TRUE if data of application need to save for resumption, otherwise
* return FALSE
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 3304200372..01963e24e7 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -198,17 +198,35 @@ class ApplicationImpl : public virtual Application,
virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE;
virtual const std::string& curHash() const;
+
#ifdef CUSTOMER_PASA
+ // DEPRECATED
virtual bool flag_sending_hash_change_after_awake() const;
+ // DEPRECATED
virtual void set_flag_sending_hash_change_after_awake(bool flag);
#endif // CUSTOMER_PASA
- /**
- * @brief Change Hash for current application
- * and send notification to mobile
- * @return updated_hash
- */
+
+ /**
+ * @brief Change Hash for current application
+ * and send notification to mobile
+ * @return updated_hash
+ */
virtual void UpdateHash();
+ /**
+ * @brief checks is hashID was changed during suspended state
+ * @return Returns TRUE if hashID was changed during suspended state
+ * otherwise returns FALSE.
+ */
+ bool IsHashChangedDuringSuspend() const OVERRIDE;
+
+ /**
+ * @brief changes state of the flag which tracks is hashID was changed during
+ * suspended state or not
+ * @param state new state of the flag
+ */
+ void SetHashChangedDuringSuspend(const bool state) OVERRIDE;
+
UsageStatistics& usage_report();
bool AreCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
@@ -432,6 +450,7 @@ class ApplicationImpl : public virtual Application,
protocol_handler::MajorProtocolVersion protocol_version_;
bool is_voice_communication_application_;
sync_primitives::atomic_bool is_resuming_;
+ bool is_hash_changed_during_suspend_;
uint32_t video_stream_retry_number_;
uint32_t audio_stream_retry_number_;
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
index f789a14780..daa71e68b5 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2017, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,3 +29,45 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
+
+#include "application_manager/commands/hmi/notification_from_hmi.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief OnAwakeSDLNotification command class
+ **/
+class OnAwakeSDLNotification : public NotificationFromHMI {
+ public:
+ /**
+ * @brief OnAwakeSDLNotification class constructor
+ * @param message Incoming SmartObject message
+ * @param application_manager reference to ApplicationManager instance
+ **/
+ OnAwakeSDLNotification(const MessageSharedPtr& message,
+ ApplicationManager& application_manager);
+
+ /**
+ * @brief OnAwakeSDLNotification class destructor
+ **/
+ virtual ~OnAwakeSDLNotification();
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(OnAwakeSDLNotification);
+};
+
+} // namespace commands
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_BASIC_COMMUNICATION_ON_AWAKE_SDL_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
index a752e00801..92ef97a4aa 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
@@ -60,7 +60,7 @@ class OnExitAllApplicationsNotification : public NotificationFromHMI {
/**
* @brief Execute command
**/
- virtual void Run();
+ void Run() FINAL;
private:
/**
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 26b1739a38..0ec58f2419 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
@@ -115,11 +115,25 @@ class ResumeCtrl {
virtual void OnSuspend() = 0;
/**
+ * @brief Processes resumption data after receiving signal "Ignition Off"
+ */
+ virtual void OnIgnitionOff() = 0;
+
+ /**
* @brief Processes resumption data after receiving signal "Awake"
*/
virtual void OnAwake() = 0;
/**
+ * @brief Checks if SDL has already received OnExitAllApplication notification
+ * with "SUSPEND" reason
+ *
+ * @return Returns TRUE if SDL has received OnExitAllApplication notification
+ * with reason "SUSPEND" otherwise returns FALSE
+ */
+ virtual bool is_suspended() const = 0;
+
+ /**
* @brief Method stops timer "RsmCtrlPercist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
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 bb886cd5f6..d7ff621c95 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
@@ -129,11 +129,25 @@ class ResumeCtrlImpl : public ResumeCtrl,
void OnSuspend() OVERRIDE;
/**
+ * @brief Processes resumption data after receiving signal "Ignition Off"
+ */
+ void OnIgnitionOff() OVERRIDE;
+
+ /**
* @brief Processes resumption data after receiving signal "Awake"
*/
void OnAwake() OVERRIDE;
/**
+ * @brief Checks if SDL has already received OnExitAllApplication notification
+ * with "SUSPEND" reason
+ *
+ * @return Returns TRUE if SDL has received OnExitAllApplication notification
+ * with reason "SUSPEND" otherwise returns FALSE
+ */
+ bool is_suspended() const OVERRIDE;
+
+ /**
* @brief Method stops timer "RsmCtrlPercist" when SDL
* receives OnExitAllApplication notification
* with reason "SUSPEND"
@@ -301,6 +315,12 @@ class ResumeCtrlImpl : public ResumeCtrl,
void SaveDataOnTimer();
/**
+ * @brief FinalPersistData persists ResumptionData last time and stops
+ * persistent data timer to avoid further persisting
+ */
+ void FinalPersistData();
+
+ /**
* @brief AddFiles allows to add files for the application
* which should be resumed
* @param application application which will be resumed
@@ -491,6 +511,7 @@ class ResumeCtrlImpl : public ResumeCtrl,
WaitingForTimerList waiting_for_timer_;
bool is_resumption_active_;
bool is_data_saved_;
+ bool is_suspended_;
time_t launch_time_;
utils::SharedPtr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index aeb65b32b9..a9954141af 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -91,9 +91,27 @@ class ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
+ virtual void IncrementIgnOffCount() = 0;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ // DEPRECATED
virtual void OnSuspend() = 0;
/**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ virtual void DecrementIgnOffCount() = 0;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ virtual void OnAwake() = 0;
+
+ /**
* @brief Retrieves hash ID for the given mobile app ID
* and device ID from stored information.
* @param policy_app_id - mobile application id
@@ -108,12 +126,6 @@ class ResumptionData {
std::string& hash_id) const = 0;
/**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- virtual void OnAwake() = 0;
-
- /**
* @brief Retrieves data of saved application for the given mobile app ID
* and device ID
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index 862816bf87..8cb70274f3 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -113,7 +113,25 @@ class ResumptionDataDB : public ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnSuspend();
+ // DEPRECATED
+ void OnSuspend() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ void OnAwake() FINAL;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ void IncrementIgnOffCount() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ void DecrementIgnOffCount() FINAL;
/**
* @brief Retrieves hash ID for the given mobile app ID
@@ -130,12 +148,6 @@ class ResumptionDataDB : public ResumptionData {
std::string& hash_id) const;
/**
- * @brief Decrements ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- virtual void OnAwake();
-
- /**
* @brief Retrieves data of saved application for the given mobile app ID
* and device ID
* @param policy_app_id - mobile application id
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index 0be6d64db2..4da3441037 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -85,13 +85,25 @@ class ResumptionDataJson : public ResumptionData {
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnSuspend();
+ // DEPRECATED
+ void OnSuspend() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ // DEPRECATED
+ void OnAwake() FINAL;
/**
* @brief Increments ignition counter for all registered applications
* and remember ign_off time stamp
*/
- virtual void OnAwake();
+ void IncrementIgnOffCount() FINAL;
+
+ /**
+ * @brief Decrements ignition counter for all registered applications
+ */
+ void DecrementIgnOffCount() FINAL;
/**
* @brief Retrieves hash ID for the given mobile app ID
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 569880bb56..0ba98d67f5 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -44,6 +44,7 @@
#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"
namespace {
@@ -111,6 +112,7 @@ ApplicationImpl::ApplicationImpl(
protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_3)
, is_voice_communication_application_(false)
, is_resuming_(false)
+ , is_hash_changed_during_suspend_(false)
, video_stream_retry_number_(0)
, audio_stream_retry_number_(0)
, video_stream_suspend_timer_(
@@ -872,7 +874,19 @@ void ApplicationImpl::UpdateHash() {
utils::gen_hash(application_manager_.get_settings().hash_string_size());
set_is_application_data_changed(true);
- MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ if (!application_manager_.resume_controller().is_suspended()) {
+ MessageHelper::SendHashUpdateNotification(app_id(), application_manager_);
+ } else {
+ is_hash_changed_during_suspend_ = true;
+ }
+}
+
+bool ApplicationImpl::IsHashChangedDuringSuspend() const {
+ return is_hash_changed_during_suspend_;
+}
+
+void ApplicationImpl::SetHashChangedDuringSuspend(const bool state) {
+ is_hash_changed_during_suspend_ = state;
}
void ApplicationImpl::CleanupFiles() {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 9da69b8279..b219635d46 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -2885,7 +2885,7 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
}
}
if (is_ignition_off) {
- resume_controller().OnSuspend();
+ resume_controller().OnIgnitionOff();
}
request_ctrl_.terminateAllHMIRequests();
}
diff --git a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
index 80b1edb5bb..c6c550a474 100644
--- a/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
+++ b/src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2017, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -29,3 +29,45 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+
+#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/resumption/resume_ctrl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+OnAwakeSDLNotification::OnAwakeSDLNotification(
+ const MessageSharedPtr& message, ApplicationManager& application_manager)
+ : NotificationFromHMI(message, application_manager) {}
+
+OnAwakeSDLNotification::~OnAwakeSDLNotification() {}
+
+void OnAwakeSDLNotification::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!application_manager_.resume_controller().is_suspended()) {
+ return;
+ }
+
+ {
+ DataAccessor<ApplicationSet> accessor = application_manager_.applications();
+ ApplicationSetIt itBegin = accessor.GetData().begin();
+ ApplicationSetIt itEnd = accessor.GetData().end();
+ for (; itBegin != itEnd; ++itBegin) {
+ const ApplicationSharedPtr app = *itBegin;
+ if (app && app->IsHashChangedDuringSuspend()) {
+ MessageHelper::SendHashUpdateNotification(app->app_id(),
+ application_manager_);
+ app->SetHashChangedDuringSuspend(false);
+ }
+ }
+ }
+
+ application_manager_.resume_controller().OnAwake();
+}
+
+} // namespace commands
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
index 07a95adcea..cb68b21263 100644
--- a/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_exit_all_applications_notification.cc
@@ -75,6 +75,7 @@ void OnExitAllApplicationsNotification::Run() {
break;
}
case hmi_apis::Common_ApplicationsCloseReason::SUSPEND: {
+ application_manager_.resume_controller().OnSuspend();
SendOnSDLPersistenceComplete();
return;
}
diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc
index ffaa8d9b5f..a7f3ce7e6b 100644
--- a/src/components/application_manager/src/hmi_command_factory.cc
+++ b/src/components/application_manager/src/hmi_command_factory.cc
@@ -269,6 +269,7 @@
#include "application_manager/commands/hmi/on_system_error_notification.h"
#include "application_manager/commands/hmi/basic_communication_system_request.h"
#include "application_manager/commands/hmi/basic_communication_system_response.h"
+#include "application_manager/commands/hmi/basic_communication_on_awake_sdl.h"
#include "application_manager/commands/hmi/sdl_policy_update.h"
#include "application_manager/commands/hmi/sdl_policy_update_response.h"
#include "application_manager/commands/hmi/on_received_policy_update.h"
@@ -781,6 +782,11 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
message, application_manager));
break;
}
+ case hmi_apis::FunctionID::BasicCommunication_OnAwakeSDL: {
+ command.reset(
+ new commands::OnAwakeSDLNotification(message, application_manager));
+ break;
+ }
case hmi_apis::FunctionID::BasicCommunication_OnExitApplication: {
command.reset(new commands::OnExitApplicationNotification(
message, application_manager));
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 c8740227df..435e621169 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -67,6 +67,7 @@ ResumeCtrlImpl::ResumeCtrlImpl(ApplicationManager& application_manager)
this, &ResumeCtrlImpl::SaveDataOnTimer))
, is_resumption_active_(false)
, is_data_saved_(false)
+ , is_suspended_(false)
, launch_time_(time(NULL))
, application_manager_(application_manager) {}
#ifdef BUILD_TESTS
@@ -263,16 +264,25 @@ bool ResumeCtrlImpl::RemoveApplicationFromSaved(
void ResumeCtrlImpl::OnSuspend() {
LOG4CXX_AUTO_TRACE(logger_);
- StopSavePersistentDataTimer();
- SaveAllApplications();
- resumption_storage_->OnSuspend();
- resumption_storage_->Persist();
+ is_suspended_ = true;
+ FinalPersistData();
+}
+
+void ResumeCtrlImpl::OnIgnitionOff() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ resumption_storage_->IncrementIgnOffCount();
+ FinalPersistData();
}
void ResumeCtrlImpl::OnAwake() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_suspended_ = false;
ResetLaunchTime();
StartSavePersistentDataTimer();
- return resumption_storage_->OnAwake();
+}
+
+bool ResumeCtrlImpl::is_suspended() const {
+ return is_suspended_;
}
void ResumeCtrlImpl::StartSavePersistentDataTimer() {
@@ -433,6 +443,13 @@ void ResumeCtrlImpl::SaveDataOnTimer() {
}
}
+void ResumeCtrlImpl::FinalPersistData() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopSavePersistentDataTimer();
+ SaveAllApplications();
+ resumption_storage_->Persist();
+}
+
bool ResumeCtrlImpl::IsDeviceMacAddressEqual(
ApplicationSharedPtr application, const std::string& saved_device_mac) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -774,7 +791,7 @@ void ResumeCtrlImpl::LoadResumeData() {
"Resumption data for application "
<< app_id << " and device id " << device_id
<< " will be dropped.");
- resumption_storage_->DropAppDataResumption(device_id, app_id);
+ resumption_storage_->RemoveApplicationFromSaved(app_id, device_id);
continue;
}
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index 08de6d8190..23fecb7624 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -212,7 +212,10 @@ uint32_t ResumptionDataDB::GetHMIApplicationID(
return hmi_app_id;
}
-void ResumptionDataDB::OnSuspend() {
+// DEPRECATED
+void ResumptionDataDB::OnSuspend() {}
+
+void ResumptionDataDB::IncrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
utils::dbms::SQLQuery query_update_suspend_data(db());
@@ -291,7 +294,10 @@ bool ResumptionDataDB::GetHashId(const std::string& policy_app_id,
return SelectHashId(policy_app_id, device_id, hash_id);
}
-void ResumptionDataDB::OnAwake() {
+// DEPRECATED
+void ResumptionDataDB::OnAwake() {}
+
+void ResumptionDataDB::DecrementIgnOffCount() {
LOG4CXX_AUTO_TRACE(logger_);
UpdateDataOnAwake();
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index 7866fc4de1..203c4889c5 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -143,11 +143,14 @@ uint32_t ResumptionDataJson::GetHMIApplicationID(
return hmi_app_id;
}
-void ResumptionDataJson::OnSuspend() {
+// DEPRECATED
+void ResumptionDataJson::OnSuspend() {}
+
+void ResumptionDataJson::IncrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(resumption_lock_);
- Json::Value to_save;
+ Json::Value to_save = Json::arrayValue;
for (Json::Value::iterator it = GetSavedApplications().begin();
it != GetSavedApplications().end();
++it) {
@@ -167,7 +170,10 @@ void ResumptionDataJson::OnSuspend() {
LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString());
}
-void ResumptionDataJson::OnAwake() {
+// DEPRECATED
+void ResumptionDataJson::OnAwake() {}
+
+void ResumptionDataJson::DecrementIgnOffCount() {
using namespace app_mngr;
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock autolock(resumption_lock_);
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index a1e284b40d..02a257e5d9 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -50,6 +50,7 @@
#include "resumption/last_state.h"
#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/policies/mock_policy_handler_interface.h"
+#include "application_manager/mock_resume_ctrl.h"
#include "policy/usage_statistics/mock_statistics_manager.h"
#include "smart_objects/smart_object.h"
@@ -652,6 +653,22 @@ TEST_F(ApplicationImplTest,
TEST_F(ApplicationImplTest, UpdateHash_AppMngrNotSuspended) {
EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
SendHashUpdateNotification(app_id, _)).Times(1);
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(mock_application_manager_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(false));
+ app_impl->UpdateHash();
+
+ EXPECT_TRUE(app_impl->is_application_data_changed());
+}
+
+TEST_F(ApplicationImplTest, UpdateHash_AppMngrSuspended) {
+ EXPECT_CALL(*MockMessageHelper::message_helper_mock(),
+ SendHashUpdateNotification(app_id, _)).Times(0);
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(mock_application_manager_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, is_suspended()).WillOnce(Return(true));
app_impl->UpdateHash();
EXPECT_TRUE(app_impl->is_application_data_changed());
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 343137b136..4493c54d3c 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
@@ -64,7 +64,6 @@ using ::testing::_;
using ::testing::Return;
using ::testing::SaveArg;
using ::testing::DoAll;
-using ::testing::Mock;
using ::utils::SharedPtr;
using am::commands::MessageSharedPtr;
@@ -128,14 +127,6 @@ class CommandRequestImplTest
}
};
- CommandRequestImplTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- ~CommandRequestImplTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
@@ -147,7 +138,6 @@ class CommandRequestImplTest
}
sync_primitives::Lock app_set_lock_;
- am::MockMessageHelper& mock_message_helper_;
};
typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
diff --git a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
index 0fe76ae16d..980b6e0e9d 100644
--- a/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
+++ b/src/components/application_manager/test/commands/hmi/get_system_info_response_test.cc
@@ -90,12 +90,6 @@ class GetSystemInfoResponseTest
return command_msg;
}
- void SetUp() OVERRIDE {
- message_helper_mock_ =
- application_manager::MockMessageHelper::message_helper_mock();
- }
-
- am::MockMessageHelper* message_helper_mock_;
MockHMICapabilities mock_hmi_capabilities_;
SmartObject capabilities_;
};
@@ -114,7 +108,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_SUCCESS) {
.WillOnce(ReturnRef(mock_hmi_capabilities_));
std::string language;
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
CommonLanguageToString(
static_cast<hmi_apis::Common_Language::eType>(lang_code)))
.WillOnce(Return(language));
@@ -140,7 +134,7 @@ TEST_F(GetSystemInfoResponseTest, GetSystemInfo_UNSUCCESS) {
EXPECT_CALL(app_mngr_, hmi_capabilities()).Times(0);
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
CommonLanguageToString(
static_cast<hmi_apis::Common_Language::eType>(lang_code)))
.Times(0);
diff --git a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
index 9af72a7925..03e1187d35 100644
--- a/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
+++ b/src/components/application_manager/test/commands/hmi/hmi_notifications/hmi_notifications_test.cc
@@ -130,14 +130,14 @@
#include "application_manager/policies/mock_policy_handler_interface.h"
#include "application_manager/mock_message_helper.h"
#include "protocol_handler/mock_session_observer.h"
+#include "application_manager/mock_resume_ctrl.h"
+
#ifdef SDL_REMOTE_CONTROL
#include "functional_module/plugin_manager.h"
#endif // SDL_REMOTE_CONTROL
namespace am = application_manager;
-static am::MockMessageHelper* message_helper_mock_;
-
namespace test {
namespace components {
namespace commands_test {
@@ -150,7 +150,6 @@ using ::testing::Types;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::NiceMock;
-using ::testing::Mock;
using ::testing::InSequence;
using ::utils::SharedPtr;
using ::smart_objects::SmartObject;
@@ -223,16 +222,11 @@ class HMICommandsNotificationsTest
CommandsTestMocks::kIsNice> {
public:
HMICommandsNotificationsTest()
- : applications_(application_set_, applications_lock_), app_ptr_(NULL) {
- message_helper_mock_ =
- application_manager::MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
+ : applications_(application_set_, applications_lock_), app_ptr_(NULL) {}
~HMICommandsNotificationsTest() {
// Fix DataAccessor release and WinQt crash
Mock::VerifyAndClearExpectations(&app_mngr_);
- Mock::VerifyAndClearExpectations(message_helper_mock_);
}
typedef Command CommandType;
@@ -842,7 +836,7 @@ TEST_F(HMICommandsNotificationsTest,
utils::SharedPtr<Command> command =
CreateCommand<OnSystemInfoChangedNotification>(message);
- EXPECT_CALL(*message_helper_mock_, CommonLanguageToString(_));
+ EXPECT_CALL(mock_message_helper_, CommonLanguageToString(_));
EXPECT_CALL(app_mngr_, GetPolicyHandler());
EXPECT_CALL(policy_interface_, OnSystemInfoChanged(_));
command->Run();
@@ -1037,10 +1031,16 @@ TEST_F(HMICommandsNotificationsTest,
kCorrelationId_;
MessageSharedPtr temp_message = CreateMessage();
+ resumprion_test::MockResumeCtrl mock_resume_ctrl;
+ EXPECT_CALL(app_mngr_, resume_controller())
+ .WillOnce(ReturnRef(mock_resume_ctrl));
+ EXPECT_CALL(mock_resume_ctrl, OnSuspend());
+
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
.WillOnce(Return(kCorrelationId_));
EXPECT_CALL(app_mngr_, ManageHMICommand(_))
.WillOnce(GetMessage(temp_message));
+
command->Run();
EXPECT_EQ(
static_cast<uint32_t>(
@@ -1116,7 +1116,7 @@ TEST_F(HMICommandsNotificationsTest,
#endif // SDL_REMOTE_CONTROL
EXPECT_CALL(app_mngr_, application(kAppId_)).WillRepeatedly(Return(app_));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_, *it_mobile_reason)).WillOnce(Return(notification));
EXPECT_CALL(app_mngr_,
@@ -1441,7 +1441,7 @@ TEST_F(HMICommandsNotificationsTest,
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
@@ -1764,7 +1764,7 @@ TEST_F(HMICommandsNotificationsTest,
ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
@@ -1872,7 +1872,7 @@ TEST_F(HMICommandsNotificationsTest,
ManageMobileCommand(_, Command::CommandOrigin::ORIGIN_SDL));
EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
EXPECT_CALL(*app_ptr_, ui_language()).WillRepeatedly(ReturnRef(kLang));
- EXPECT_CALL(*message_helper_mock_,
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
mobile_apis::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE))
diff --git a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
index 27a77ba990..73a43342f1 100644
--- a/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/rc_is_ready_request_test.cc
@@ -55,7 +55,6 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::RCIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<RCIsReadyRequest> RCIsReadyRequestPtr;
@@ -102,7 +101,7 @@ class RCIsReadyRequestTest
void ExpectSendMessagesToHMI() {
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::RC_GetCapabilities, _))
.WillOnce(Return(capabilities));
EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
diff --git a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
index 3805df5834..d36b55ee25 100644
--- a/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/sdl_activate_app_request_test.cc
@@ -62,7 +62,6 @@ using testing::Return;
using testing::ReturnRef;
using testing::Mock;
using ::testing::NiceMock;
-using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
using am::event_engine::Event;
@@ -102,15 +101,9 @@ MATCHER_P2(CheckMsgParams, result, corr_id, "") {
class SDLActivateAppRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
- SDLActivateAppRequestTest()
- : message_helper_mock_(am::MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
-
~SDLActivateAppRequestTest() {
// Fix DataAccessor release and WinQt crash
Mock::VerifyAndClearExpectations(&app_mngr_);
- Mock::VerifyAndClearExpectations(message_helper_mock_);
}
void InitCommand(const uint32_t& timeout) OVERRIDE {
@@ -127,7 +120,6 @@ class SDLActivateAppRequestTest
ApplicationSet app_list_;
::sync_primitives::Lock lock_;
- am::MockMessageHelper* message_helper_mock_;
policy_test::MockPolicyHandlerInterface policy_handler_;
application_manager_test::MockStateController mock_state_controller_;
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
@@ -220,7 +212,7 @@ TEST_F(SDLActivateAppRequestTest, FindAppToRegister_SUCCESS) {
const std::string package = "package";
ON_CALL(*mock_app_first, PackageName()).WillByDefault(Return(package));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -299,7 +291,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppActive_SUCCESS) {
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -328,7 +320,6 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotActive_SUCCESS) {
}
TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
MessageSharedPtr msg = CreateMessage();
SetCorrelationAndAppID(msg);
@@ -363,10 +354,9 @@ TEST_F(SDLActivateAppRequestTest, FirstAppIsForeground_SUCCESS) {
ON_CALL(*mock_app_first, device()).WillByDefault(Return(kHandle));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, schema, package_name, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, schema, package_name, _));
command->Run();
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
}
TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
@@ -397,7 +387,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegisteredAndEmpty_SUCCESS) {
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillOnce(Return(false));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
@@ -432,7 +422,7 @@ TEST_F(SDLActivateAppRequestTest, FirstAppNotRegistered_SUCCESS) {
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_5));
EXPECT_CALL(*mock_app_first, is_foreground()).WillRepeatedly(Return(true));
- EXPECT_CALL(*message_helper_mock_, SendLaunchApp(_, _, _, _));
+ EXPECT_CALL(mock_message_helper_, SendLaunchApp(_, _, _, _));
command->Run();
}
diff --git a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
index 5ef54f7be5..66fedda3ca 100644
--- a/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/sdl_get_user_friendly_message_request_test.cc
@@ -73,10 +73,6 @@ namespace strings = ::application_manager::strings;
class SDLGetUserFriendlyMessageRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- SDLGetUserFriendlyMessageRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
protected:
void SetUp() OVERRIDE {
mock_app_ = CreateMockApp();
@@ -90,7 +86,6 @@ class SDLGetUserFriendlyMessageRequestTest
}
MockAppPtr mock_app_;
MockPolicyHandlerInterface mock_policy_handler_;
- MockMessageHelper& mock_message_helper_;
};
TEST_F(SDLGetUserFriendlyMessageRequestTest, Run_LanguageSet_SUCCESS) {
diff --git a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
index 23146eec9a..66b1317870 100644
--- a/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/ui_is_ready_request_test.cc
@@ -54,12 +54,10 @@ namespace ui_is_ready_request {
namespace am = ::application_manager;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
using am::commands::UIIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr;
@@ -67,14 +65,11 @@ typedef SharedPtr<UIIsReadyRequest> UIIsReadyRequestPtr;
class UIIsReadyRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- UIIsReadyRequestTest()
- : command_(CreateCommand<UIIsReadyRequest>())
- , mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
+ UIIsReadyRequestTest() : command_(CreateCommand<UIIsReadyRequest>()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, hmi_capabilities())
.WillByDefault(ReturnRef(mock_hmi_capabilities_));
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
void SetUpExpectations(bool is_ui_cooperating_available,
bool is_send_message_to_hmi,
@@ -151,7 +146,6 @@ class UIIsReadyRequestTest
}
UIIsReadyRequestPtr command_;
- MockMessageHelper& mock_message_helper_;
application_manager_test::MockHMICapabilities mock_hmi_capabilities_;
policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
};
diff --git a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
index 1e15d4ab60..557afa98d0 100644
--- a/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/vi_is_ready_request_test.cc
@@ -57,7 +57,6 @@ using ::testing::Return;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::VIIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<VIIsReadyRequest> VIIsReadyRequestPtr;
@@ -103,7 +102,7 @@ class VIIsReadyRequestTest
void ExpectSendMessagesToHMI() {
smart_objects::SmartObjectSPtr ivi_type;
EXPECT_CALL(
- *(MockMessageHelper::message_helper_mock()),
+ mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VehicleInfo_GetVehicleType, _))
.WillOnce(Return(ivi_type));
EXPECT_CALL(app_mngr_, ManageHMICommand(ivi_type));
diff --git a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
index 64735a77e2..c9403b2f0e 100644
--- a/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
+++ b/src/components/application_manager/test/commands/hmi/vr_is_ready_request_test.cc
@@ -55,7 +55,6 @@ using ::testing::ReturnRef;
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using am::commands::VRIsReadyRequest;
-using am::MockMessageHelper;
using am::event_engine::Event;
typedef SharedPtr<VRIsReadyRequest> VRIsReadyRequestPtr;
@@ -105,7 +104,7 @@ class VRIsReadyRequestTest
smart_objects::SmartObjectSPtr language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage, _))
.WillOnce(Return(language));
EXPECT_CALL(mock_hmi_capabilities_, set_handle_response_for(*language));
@@ -114,14 +113,14 @@ class VRIsReadyRequestTest
smart_objects::SmartObjectSPtr support_language(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
EXPECT_CALL(
- *(MockMessageHelper::message_helper_mock()),
+ mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages, _))
.WillOnce(Return(support_language));
EXPECT_CALL(app_mngr_, ManageHMICommand(support_language));
smart_objects::SmartObjectSPtr capabilities(
new smart_objects::SmartObject(smart_objects::SmartType_Map));
- EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ EXPECT_CALL(mock_message_helper_,
CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities, _))
.WillOnce(Return(capabilities));
EXPECT_CALL(app_mngr_, ManageHMICommand(capabilities));
diff --git a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
index cd9d6999a8..471f0763de 100644
--- a/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_command_request_test.cc
@@ -61,11 +61,9 @@ using am::commands::CommandImpl;
using am::ApplicationManager;
using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
-using am::MockMessageHelper;
using ::testing::_;
using ::utils::SharedPtr;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::InSequence;
using am::commands::AddCommandRequest;
using NsSmartDeviceLink::NsSmartObjects::SmartObjectSPtr;
@@ -105,19 +103,13 @@ class AddCommandRequestTest
AddCommandRequestTest()
: msg_(CreateMessage())
, default_app_name_("test_default_app_name_")
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
InitGetters();
InitBasicMessage();
}
- ~AddCommandRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
protected:
void InitBasicMessage() {
(*msg_)[params][connection_key] = kConnectionKey;
@@ -227,7 +219,6 @@ class AddCommandRequestTest
MessageSharedPtr msg_;
SmartObjectSPtr so_ptr_;
const utils::custom_string::CustomString default_app_name_;
- am::MockMessageHelper& mock_message_helper_;
sync_primitives::Lock lock_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
index fede3c5c68..f5bb7888d8 100644
--- a/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/add_sub_menu_request_test.cc
@@ -54,9 +54,7 @@ namespace am = ::application_manager;
using am::commands::AddSubMenuRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
typedef SharedPtr<AddSubMenuRequest> AddSubMenuPtr;
@@ -66,12 +64,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class AddSubMenuRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- AddSubMenuRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
const uint32_t menu_id = 10u;
@@ -119,7 +112,6 @@ TEST_F(AddSubMenuRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace add_sub_menu_request
diff --git a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
index d892b18020..90c6409fa8 100644
--- a/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_maneuver_request_test.cc
@@ -59,21 +59,16 @@ namespace alert_maneuver_request {
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
-using ::testing::Mock;
namespace am = ::application_manager;
using am::commands::AlertManeuverRequest;
using am::commands::MessageSharedPtr;
using am::event_engine::Event;
-using am::MockMessageHelper;
typedef SharedPtr<AlertManeuverRequest> CommandPtr;
class AlertManeuverRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- AlertManeuverRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
const mobile_apis::Result::eType mobile_response,
const am::HmiInterfaces::InterfaceState state,
@@ -111,16 +106,7 @@ class AlertManeuverRequestTest
static_cast<int32_t>(mobile_response));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
protected:
- MockMessageHelper& mock_message_helper_;
NiceMock<policy_test::MockPolicyHandlerInterface> policy_interface_;
};
@@ -167,8 +153,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_UNSUCCESS) {
const mobile_apis::Result::eType kProcessingResult =
mobile_apis::Result::ABORTED;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(kProcessingResult));
MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
@@ -215,8 +200,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(policy_interface_));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- ProcessSoftButtons(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, ProcessSoftButtons(_, _, _, _))
.WillOnce(Return(mobile_apis::Result::SUCCESS));
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
@@ -225,8 +209,7 @@ TEST_F(AlertManeuverRequestTest, Run_ProcessingResult_SUCCESS) {
EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()),
- SubscribeApplicationToSoftButton(_, _, _));
+ EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _));
MessageSharedPtr result_msg(CatchHMICommandResult(CallRun(*command)));
EXPECT_EQ(hmi_apis::FunctionID::Navigation_AlertManeuver,
diff --git a/src/components/application_manager/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
index d77067bcc5..5d9e507511 100644
--- a/src/components/application_manager/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/alert_request_test.cc
@@ -60,7 +60,6 @@ using ::utils::SharedPtr;
using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -79,10 +78,7 @@ const mobile_apis::FunctionID::eType kFunctionId =
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- AlertRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
- , msg_(CreateMessage()) {}
+ AlertRequestTest() : mock_app_(CreateMockApp()), msg_(CreateMessage()) {}
protected:
MessageSharedPtr CreateFullParamsUISO() {
@@ -116,10 +112,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
info);
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void PreConditions() {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
@@ -155,9 +147,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
void AddAlertTextsToMsg() {
(*msg_)[am::strings::msg_params][am::strings::alert_text1] = "alert_text1";
(*msg_)[am::strings::msg_params][am::strings::alert_text2] = "alert_text2";
@@ -192,7 +181,6 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
diff --git a/src/components/application_manager/test/commands/mobile/change_registration_test.cc b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
index 68eea31188..3d7671015c 100644
--- a/src/components/application_manager/test/commands/mobile/change_registration_test.cc
+++ b/src/components/application_manager/test/commands/mobile/change_registration_test.cc
@@ -66,7 +66,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -89,8 +88,7 @@ class ChangeRegistrationRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ChangeRegistrationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, supported_languages_(CreateMessage(smart_objects::SmartType_Array)) {}
MessageSharedPtr CreateMsgFromMobile() {
@@ -246,10 +244,6 @@ class ChangeRegistrationRequestTest
.WillByDefault(ReturnRef(hmi_capabilities_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectationsHmiCapabilities(
smart_objects::SmartObjectSPtr supported_languages) {
EXPECT_CALL(hmi_capabilities_, ui_supported_languages())
@@ -277,7 +271,6 @@ class ChangeRegistrationRequestTest
MockHMICapabilities;
sync_primitives::Lock app_set_lock_;
MockHMICapabilities hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr supported_languages_;
MockPolicyHandlerInterface mock_policy_handler_;
diff --git a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
index 6854ff0a9e..c3513d2acb 100644
--- a/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -65,7 +65,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -112,15 +111,9 @@ class CreateInteractionChoiceSetRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
CreateInteractionChoiceSetRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , message_(CreateMessage())
+ : message_(CreateMessage())
, command_(CreateCommand<CreateInteractionChoiceSetRequest>(message_))
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~CreateInteractionChoiceSetRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ , mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsVRSO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -162,7 +155,6 @@ class CreateInteractionChoiceSetRequestTest
[am::strings::interaction_choice_set_id] = kChoiceSetId;
}
- MockMessageHelper& message_helper_mock_;
MessageSharedPtr message_;
CreateInteractionChoiceSetRequestPtr command_;
MockAppPtr mock_app_;
@@ -279,7 +271,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_VerifyImageFail_UNSUCCESS) {
[am::strings::secondary_image] = kSecondImage;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::INVALID_DATA));
EXPECT_CALL(app_mngr_, GenerateGrammarID()).Times(0);
@@ -295,7 +287,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_FindChoiceSetFail_UNSUCCESS) {
kChoiceSetId;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* invalid_choice_set_id =
@@ -330,7 +322,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -367,7 +359,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
.WillRepeatedly(Return(choice_set_id));
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
if ((*message_)[am::strings::msg_params][am::strings::choice_set][0]
@@ -436,7 +428,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -475,7 +467,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -521,7 +513,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_ValidVrNoError_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -554,7 +546,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
FillMessageFieldsItem2(message_);
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -588,7 +580,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -635,7 +627,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -675,7 +667,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnTimeOut_InvalidApp_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -715,7 +707,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest,
(*message_)[am::strings::msg_params][am::strings::interaction_choice_set_id] =
kChoiceSetId;
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
smart_objects::SmartObject* choice_set_id = NULL;
@@ -788,7 +780,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, Run_ErrorFromHmiFalse_UNSUCCESS) {
kChoiceSetId;
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
- EXPECT_CALL(message_helper_mock_, VerifyImage(_, _, _))
+ EXPECT_CALL(mock_message_helper_, VerifyImage(_, _, _))
.WillRepeatedly(Return(mobile_apis::Result::GENERIC_ERROR));
smart_objects::SmartObject* choice_set_id = NULL;
diff --git a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
index 1222e36836..c92ec81a1f 100644
--- a/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_command_request_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_command_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
namespace am = ::application_manager;
@@ -75,9 +74,7 @@ const uint32_t kConnectionKey = 2u;
class DeleteCommandRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- DeleteCommandRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ DeleteCommandRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -134,12 +131,7 @@ class DeleteCommandRequestTest
.WillByDefault(ReturnRef(hmi_interfaces_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
NiceMock<MockHmiInterfaces> hmi_interfaces_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
index a6d9d8f50a..192cad12b0 100644
--- a/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -53,7 +53,6 @@ namespace mobile_commands_test {
namespace delete_interaction_choice_set {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::InSequence;
diff --git a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
index 61adc05681..cc21e5366e 100644
--- a/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
+++ b/src/components/application_manager/test/commands/mobile/delete_sub_menu_test.cc
@@ -51,7 +51,6 @@ namespace mobile_commands_test {
namespace delete_sub_menu_request {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -97,22 +96,14 @@ class DeleteSubMenuRequestTest
public:
DeleteSubMenuRequestTest()
: accessor_(commands_map_, commands_lock_)
- , mock_message_helper_(*MockMessageHelper::message_helper_mock())
, message_(CreateMessage())
, command_(CreateCommand<DeleteSubMenuRequest>(message_))
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~DeleteSubMenuRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
am::CommandsMap commands_map_;
mutable sync_primitives::Lock commands_lock_;
DataAccessor<am::CommandsMap> accessor_;
- MockMessageHelper& mock_message_helper_;
MessageSharedPtr message_;
DeleteSubMenuRequestPtr command_;
MockAppPtr app_;
diff --git a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
index a041f921d7..4f46a6f715 100644
--- a/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/diagnostic_message_request_test.cc
@@ -71,17 +71,7 @@ const uint32_t kDiagnosticMode = 5u;
} // namespace
class DiagnosticMessageRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- DiagnosticMessageRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- ~DiagnosticMessageRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(DiagnosticMessageRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
MessageSharedPtr command_msg(CreateMessage(smart_objects::SmartType_Map));
diff --git a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
index 27788622e6..33733f63ed 100644
--- a/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/end_audio_pass_thru_request_test.cc
@@ -53,7 +53,6 @@ namespace end_audio_pass_thru_request {
namespace am = ::application_manager;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using am::commands::MessageSharedPtr;
@@ -64,12 +63,7 @@ using am::MockMessageHelper;
typedef SharedPtr<EndAudioPassThruRequest> EndAudioPassThruRequestPtr;
class EndAudioPassThruRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- EndAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
const uint32_t kConnectionKey = 2u;
@@ -116,7 +110,6 @@ TEST_F(EndAudioPassThruRequestTest, OnEvent_UI_UNSUPPORTED_RESOUCRE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
} // namespace end_audio_pass_thru_request
diff --git a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
index e6b419329d..106a59803b 100644
--- a/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_dtcs_request_test.cc
@@ -69,9 +69,7 @@ typedef SharedPtr<GetDTCsRequest> GetDTCsRequestPtr;
class GetDTCsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {
- Mock::VerifyAndClearExpectations(message_helper_mock_);
- }
+ GetDTCsRequestTest() : CommandRequestTest<CommandsTestMocks::kIsNice>() {}
};
TEST_F(GetDTCsRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
index 588f748fcc..52aed6feb8 100644
--- a/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_vehicle_data_request_test.cc
@@ -70,19 +70,7 @@ const uint32_t kConnectionKey = 2u;
} // namespace
class GetVehicleDataRequestTest
- : public CommandRequestTest<CommandsTestMocks::kIsNice> {
- public:
- GetVehicleDataRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~GetVehicleDataRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- am::MockMessageHelper& mock_message_helper_;
-};
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {};
class UnwrappedGetVehicleDataRequest : public GetVehicleDataRequest {
public:
diff --git a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
index 838a544cac..979fb0cc83 100644
--- a/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/get_way_points_request_test.cc
@@ -53,7 +53,6 @@ namespace get_way_points_request {
using namespace mobile_apis::Result;
using ::testing::Return;
-using ::testing::Mock;
using ::testing::_;
using application_manager::commands::GetWayPointsRequest;
using application_manager::MockMessageHelper;
@@ -73,14 +72,7 @@ const std::string kMethodName = "Navigation.GetWayPoints";
class GetWayPointsRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~GetWayPointsRequestTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
message_ = utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map);
@@ -93,7 +85,6 @@ class GetWayPointsRequestTest
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app_));
}
- MockMessageHelper& message_helper_mock_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
utils::SharedPtr<application_manager::commands::GetWayPointsRequest>
@@ -103,14 +94,7 @@ class GetWayPointsRequestTest
class GetWayPointsRequestOnEventTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- GetWayPointsRequestOnEventTest()
- : message_helper_mock_(*am::MockMessageHelper::message_helper_mock())
- , app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
- ~GetWayPointsRequestOnEventTest() {
- Mock::VerifyAndClearExpectations(&message_helper_mock_);
- }
+ GetWayPointsRequestOnEventTest() : app_(CreateMockApp()) {}
void CheckOnEventResponse(const std::string& wayPointsParam,
const HmiResult ResultCode,
@@ -143,7 +127,6 @@ class GetWayPointsRequestOnEventTest
}
protected:
- MockMessageHelper& message_helper_mock_;
MockAppPtr app_;
MockHmiInterfaces hmi_interfaces_;
};
diff --git a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
index 9ef978d756..6d7ccb1fa0 100644
--- a/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hash_change_notification_test.cc
@@ -56,19 +56,7 @@ using testing::ReturnRef;
using testing::_;
class OnHashChangeNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnHashChangeNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
const uint32_t kConnectionKey = 1u;
@@ -83,7 +71,8 @@ TEST_F(OnHashChangeNotificationTest, Run_ValidApp_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, curHash()).WillOnce(ReturnRef(return_string));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -112,7 +101,7 @@ TEST_F(OnHashChangeNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app, curHash()).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
index 34f8a010d8..78875ad164 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_from_mobile_test.cc
@@ -235,16 +235,12 @@ TEST_F(OnHMIStatusNotificationFromMobileTest,
EXPECT_CALL(*mock_app, is_foreground()).WillOnce(Return(true));
- application_manager::MockMessageHelper& mock_message_helper =
- *application_manager::MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(&mock_message_helper);
- EXPECT_CALL(mock_message_helper, SendQueryApps(kConnectionKey, _));
+ EXPECT_CALL(mock_message_helper_, SendQueryApps(kConnectionKey, _));
command->Run();
ASSERT_EQ(application_manager::MessageType::kNotification,
(*msg)[strings::params][strings::message_type].asInt());
- Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(OnHMIStatusNotificationFromMobileTest,
diff --git a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
index 2da0e60df1..9cb5610621 100644
--- a/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_hmi_status_notification_test.cc
@@ -59,9 +59,6 @@ using testing::_;
class OnHMIStatusNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnHMIStatusNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
MessageSharedPtr CreateMsgParams(
const mobile_apis::HMILevel::eType kHMIState) {
MessageSharedPtr msg = CreateMessage();
@@ -70,13 +67,9 @@ class OnHMIStatusNotificationTest
return msg;
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
void SetSendNotificationExpectations(MessageSharedPtr& msg) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -88,8 +81,6 @@ class OnHMIStatusNotificationTest
ASSERT_EQ(CommandImpl::protocol_version_,
(*msg)[strings::params][strings::protocol_version].asInt());
}
-
- MockMessageHelper& message_helper_;
};
TEST_F(OnHMIStatusNotificationTest, Run_InvalidApp_NoNotification) {
@@ -141,7 +132,7 @@ TEST_F(OnHMIStatusNotificationTest, Run_BackgroundAndFalseProperties_SUCCESS) {
EXPECT_CALL(*mock_app, tts_properties_in_none()).WillOnce(Return(false));
EXPECT_CALL(*mock_app, set_tts_properties_in_none(true));
- EXPECT_CALL(message_helper_, SendTTSGlobalProperties(_, false, _));
+ EXPECT_CALL(mock_message_helper_, SendTTSGlobalProperties(_, false, _));
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
index d56cd98904..7313f32dca 100644
--- a/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -61,11 +61,9 @@ using testing::_;
class OnKeyBoardInputNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnKeyBoardInputNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
void SetSendNotificationExpectations(MessageSharedPtr msg) {
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
}
@@ -78,14 +76,6 @@ class OnKeyBoardInputNotificationTest
(*msg)[strings::params][strings::protocol_version].asInt());
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
MockAppPtr InitAppSetDataAccessor(SharedPtr<ApplicationSet>& app_set) {
app_set = (!app_set ? ::utils::MakeShared<ApplicationSet>() : app_set);
MockAppPtr app(CreateMockApp());
@@ -95,7 +85,6 @@ class OnKeyBoardInputNotificationTest
return app;
}
- MockMessageHelper& message_helper_;
SharedPtr<ApplicationSet> app_set_;
sync_primitives::Lock lock_;
};
@@ -162,7 +151,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(*mock_app, hmi_level())
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
diff --git a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
index 43f725012d..7840e35cec 100644
--- a/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_system_request_notification_test.cc
@@ -64,20 +64,7 @@ const uint32_t kConnectionKey = 1u;
} // namespace
class OnSystemRequestNotificationTest
- : public CommandsTest<CommandsTestMocks::kIsNice> {
- public:
- OnSystemRequestNotificationTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
- MockMessageHelper& message_helper_;
-};
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
const RequestType::eType kRequestType = RequestType::PROPRIETARY;
@@ -107,7 +94,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, TimeoutExchangeSec()).WillOnce(Return(5u));
#endif // PROPRIETARY_MODE
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -143,7 +131,8 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(true));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).WillOnce(Return(false));
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillOnce(Return(false));
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _));
command->Run();
@@ -176,7 +165,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
MockPolicyHandlerInterface mock_policy_handler;
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _)).Times(0);
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
command->Run();
@@ -203,7 +192,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
EXPECT_CALL(mock_policy_handler, IsRequestTypeAllowed(_, _))
.WillOnce(Return(false));
- EXPECT_CALL(message_helper_, PrintSmartObject(_)).Times(0);
+ EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
EXPECT_CALL(app_mngr_, SendMessageToMobile(msg, _)).Times(0);
;
diff --git a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
index d3e664754c..05d97856e4 100644
--- a/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -71,11 +71,9 @@ class OnVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
OnVehicleDataNotificationTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
NotificationPtr command_;
};
diff --git a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
index 189cbedc76..6c35a5372a 100644
--- a/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::InSequence;
@@ -80,8 +79,7 @@ class PerformAudioPassThruRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
PerformAudioPassThruRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, message_(utils::MakeShared<SmartObject>(::smart_objects::SmartType_Map))
, msg_params_((*message_)[am::strings::msg_params]) {}
@@ -137,10 +135,6 @@ class PerformAudioPassThruRequestTest
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(application_sptr_));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -153,7 +147,6 @@ class PerformAudioPassThruRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr message_;
::smart_objects::SmartObject& msg_params_;
@@ -192,7 +185,6 @@ TEST_F(PerformAudioPassThruRequestTest, OnTimeout_GENERIC_ERROR) {
(*vr_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(am::mobile_api::Result::GENERIC_ERROR));
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(PerformAudioPassThruRequestTest,
diff --git a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
index c097eeadf7..a272234e82 100644
--- a/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
+++ b/src/components/application_manager/test/commands/mobile/perform_interaction_test.cc
@@ -63,7 +63,6 @@ using am::commands::MessageSharedPtr;
using am::ApplicationSharedPtr;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::utils::SharedPtr;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,9 +81,7 @@ const uint32_t kConnectionKey = 2u;
class PerformInteractionRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- PerformInteractionRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ PerformInteractionRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -92,10 +89,6 @@ class PerformInteractionRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -108,7 +101,6 @@ class PerformInteractionRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
index 72b79f2114..c88f4626f0 100644
--- a/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/read_did_request_test.cc
@@ -90,9 +90,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- am::MockMessageHelper& mock_message_helper(
- *am::MockMessageHelper::message_helper_mock());
-
EXPECT_CALL(app_mngr_,
ManageMobileCommand(MobileResultCodeIs(mobile_response_code), _));
@@ -100,8 +97,6 @@ TEST_F(ReadDIDRequestTest, OnEvent_SUCCESS) {
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(app));
command->on_event(event);
-
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper);
}
TEST_F(ReadDIDRequestTest, Run_AppNotRegistered_UNSUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
index 4a655076b7..69fee02262 100644
--- a/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/reset_global_properties_test.cc
@@ -58,7 +58,6 @@ namespace mobile_commands_test {
namespace reset_global_properties {
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -83,11 +82,7 @@ class ResetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
ResetGlobalPropertiesRequestTest()
- : mock_message_helper_(am::MockMessageHelper::message_helper_mock())
- , msg_(CreateMessage())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
+ : msg_(CreateMessage()), mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -102,10 +97,6 @@ class ResetGlobalPropertiesRequestTest
.WillByDefault(Return(kCorrelationId));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(mock_message_helper_);
- }
- am::MockMessageHelper* mock_message_helper_;
MessageSharedPtr msg_;
MockAppPtr mock_app_;
ResetGlobalPropertiesRequestPtr command_;
@@ -177,7 +168,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
smart_objects::SmartObjectSPtr vr_help; // = NULL;
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(app_mngr_, ManageHMICommand(_)).Times(0);
@@ -230,7 +221,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
smart_objects::SmartObject msg_params =
@@ -283,7 +274,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
command_->Run();
@@ -368,7 +359,7 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
smart_objects::SmartObjectSPtr vr_help =
::utils::MakeShared<smart_objects::SmartObject>(
smart_objects::SmartType_Map);
- EXPECT_CALL(*mock_message_helper_, CreateAppVrHelp(_))
+ EXPECT_CALL(mock_message_helper_, CreateAppVrHelp(_))
.WillOnce(Return(vr_help));
EXPECT_CALL(*mock_app_, UpdateHash()).Times(0);
@@ -441,7 +432,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
utils::MakeShared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
- EXPECT_CALL(*mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
.WillOnce(Return(response));
const std::string info = "TTS component does not respond";
EXPECT_CALL(
@@ -503,7 +494,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
utils::MakeShared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
- EXPECT_CALL(*mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
.WillOnce(Return(response));
const std::string info = "UI component does not respond";
@@ -557,7 +548,7 @@ TEST_F(ResetGlobalPropertiesRequestTest,
utils::MakeShared<smart_objects::SmartObject>();
(*response)[am::strings::msg_params][am::strings::result_code] =
mobile_apis::Result::GENERIC_ERROR;
- EXPECT_CALL(*mock_message_helper_, CreateNegativeResponse(_, _, _, _))
+ EXPECT_CALL(mock_message_helper_, CreateNegativeResponse(_, _, _, _))
.WillOnce(Return(response));
EXPECT_CALL(
app_mngr_,
diff --git a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
index f4a84181e2..4520e1b120 100644
--- a/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
+++ b/src/components/application_manager/test/commands/mobile/scrollable_message_test.cc
@@ -65,7 +65,6 @@ using ::utils::SharedPtr;
using ::testing::_;
using ::testing::Eq;
using ::testing::Ref;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -84,9 +83,6 @@ const uint32_t kFunctionID = 3u;
class ScrollableMessageRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ScrollableMessageRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
- MockMessageHelper& mock_message_helper_;
typedef TypeIf<kMocksAreNice,
NiceMock<application_manager_test::MockHMICapabilities>,
application_manager_test::MockHMICapabilities>::Result
@@ -118,11 +114,6 @@ class ScrollableMessageRequestTest
ON_CALL(app_mngr_, GetPolicyHandler())
.WillByDefault(ReturnRef(mock_policy_handler_));
command_ = CreateCommand<ScrollableMessageRequest>(msg_);
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MockPolicyHandlerInterface mock_policy_handler_;
@@ -181,7 +172,6 @@ TEST_F(ScrollableMessageRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ScrollableMessageRequestTest, Init_CorrectTimeout_SUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
index 80f8cb0f38..c5786675d6 100644
--- a/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/send_location_request_test.cc
@@ -54,7 +54,6 @@ using utils::SharedPtr;
using testing::_;
using testing::Return;
using testing::ReturnRef;
-using ::testing::Mock;
namespace strings = application_manager::strings;
namespace hmi_response = application_manager::hmi_response;
@@ -92,18 +91,13 @@ class SendLocationRequestTest
typedef SharedPtr<UnwrappedSendLocationRequest> CommandSPrt;
- SendLocationRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ SendLocationRequestTest() {
mock_app_ = CreateMockApp();
disp_cap_ = utils::MakeShared<SmartObject>(smart_objects::SmartType_Map);
message_ = CreateMessage();
command_ = CreateCommand<UnwrappedSendLocationRequest>(message_);
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void InitialSetup(MessageSharedPtr message_) {
(*message_)[strings::params][strings::connection_key] = kConnectionKey;
(*message_)[strings::params][strings::function_id] = kFunctionID;
@@ -158,7 +152,6 @@ class SendLocationRequestTest
MockAppPtr mock_app_;
MockHMICapabilities mock_hmi_capabilities_;
- MockMessageHelper& mock_message_helper_;
SharedPtr<SmartObject> disp_cap_;
MessageSharedPtr message_;
CommandSPrt command_;
diff --git a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
index 7be7b41a26..b278479df8 100644
--- a/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_app_icon_test.cc
@@ -57,7 +57,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -70,19 +69,6 @@ const uint32_t kConnectionKey = 2u;
class SetAppIconRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetAppIconRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {}
-
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- MockMessageHelper& mock_message_helper_;
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
diff --git a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
index 26f2239275..8444b88d63 100644
--- a/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_display_layout_test.cc
@@ -59,7 +59,6 @@ using am::commands::MessageSharedPtr;
using am::MockMessageHelper;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -80,20 +79,12 @@ MATCHER_P(CheckMshCorrId, corr_id, "") {
class SetDisplayLayoutRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetDisplayLayoutRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
+ SetDisplayLayoutRequestTest() : mock_app_(CreateMockApp()) {
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- ~SetDisplayLayoutRequestTest() {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
(*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -130,7 +121,6 @@ class SetDisplayLayoutRequestTest
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
index 4496aa0f41..641e5636a9 100644
--- a/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_global_properties_test.cc
@@ -59,7 +59,6 @@ using am::CommandsMap;
using utils::custom_string::CustomString;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kPosition = 1u;
class SetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetGlobalPropertiesRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetGlobalPropertiesRequestTest() : mock_app_(CreateMockApp()) {}
MessageSharedPtr CreateFullParamsUISO() {
MessageSharedPtr msg = CreateMessage(smart_objects::SmartType_Map);
@@ -220,10 +217,6 @@ class SetGlobalPropertiesRequestTest
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -252,7 +245,6 @@ class SetGlobalPropertiesRequestTest
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
}
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
index 4fd6f0e170..cf668c8b36 100644
--- a/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
+++ b/src/components/application_manager/test/commands/mobile/set_media_clock_timer_test.cc
@@ -55,7 +55,6 @@ using am::commands::MessageSharedPtr;
using am::event_engine::Event;
using am::MockMessageHelper;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -75,9 +74,7 @@ const uint32_t kSeconds = 1u;
class SetMediaClockRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- SetMediaClockRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp()) {}
+ SetMediaClockRequestTest() : mock_app_(CreateMockApp()) {}
void SetUp() OVERRIDE {
ON_CALL(app_mngr_, application(kConnectionKey))
@@ -85,10 +82,6 @@ class SetMediaClockRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ResultCommandExpectations(MessageSharedPtr msg,
const std::string& info) {
EXPECT_EQ((*msg)[am::strings::msg_params][am::strings::success].asBool(),
@@ -114,7 +107,6 @@ class SetMediaClockRequestTest
EXPECT_CALL(app_mngr_, ManageMobileCommand(_, _));
}
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
};
diff --git a/src/components/application_manager/test/commands/mobile/show_test.cc b/src/components/application_manager/test/commands/mobile/show_test.cc
index 085f83b626..4752bac0fd 100644
--- a/src/components/application_manager/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/test/commands/mobile/show_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using test::components::policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -73,8 +72,7 @@ const uint32_t kFunctionID = 3u;
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
- ShowRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock()) {
+ ShowRequestTest() {
mock_app_ = CreateMockApp();
}
sync_primitives::Lock lock_;
@@ -203,16 +201,7 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
MockAppPtr mock_app_;
- MockMessageHelper& mock_message_helper_;
std::string text_field_;
};
@@ -260,12 +249,9 @@ TEST_F(ShowRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -294,13 +280,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -324,13 +306,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonNotExists_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -357,13 +335,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -388,13 +362,9 @@ TEST_F(ShowRequestTest, Run_Graphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -416,13 +386,9 @@ TEST_F(ShowRequestTest, Run_Graphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -443,13 +409,9 @@ TEST_F(ShowRequestTest, Run_Graphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -474,13 +436,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_SUCCESS) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -502,13 +460,9 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_Canceled) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
-
MessageSharedPtr msg = CreateMsgParams();
SmartObject msg_params(smart_objects::SmartType_Map);
@@ -529,8 +483,6 @@ TEST_F(ShowRequestTest, Run_SecondaryGraphic_WrongSyntax) {
EXPECT_CALL(*mock_app_, set_show_command(msg_params)).Times(0);
command->Run();
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MainField1_SUCCESS) {
@@ -716,7 +668,6 @@ TEST_F(ShowRequestTest, Run_MainField4_MetadataTag) {
}
TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
MessageSharedPtr msg = CreateMsgParams();
SharedPtr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
@@ -756,8 +707,6 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
(*ui_command_result)[am::strings::msg_params][am::strings::result_code]
.asInt(),
static_cast<int32_t>(mobile_apis::Result::WARNINGS));
-
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
TEST_F(ShowRequestTest, Run_MediaClock_SUCCESS) {
diff --git a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
index cbc2d702b3..7ded373d29 100644
--- a/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
+++ b/src/components/application_manager/test/commands/mobile/simple_notification_commands_test.cc
@@ -58,28 +58,12 @@ namespace commands = am::commands;
using ::testing::_;
using ::testing::Types;
using ::testing::Return;
-using ::testing::Mock;
-
-using am::MockMessageHelper;
template <class Command>
class MobileNotificationCommandsTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
typedef Command CommandType;
-
- public:
- MobileNotificationCommandsTest()
- : message_helper_(*MockMessageHelper::message_helper_mock()) {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- ~MobileNotificationCommandsTest() {
- Mock::VerifyAndClearExpectations(&message_helper_);
- }
-
- protected:
- MockMessageHelper& message_helper_;
};
typedef Types<commands::OnAppInterfaceUnregisteredNotification,
diff --git a/src/components/application_manager/test/commands/mobile/slider_test.cc b/src/components/application_manager/test/commands/mobile/slider_test.cc
index 0c78304855..54ac3cccc0 100644
--- a/src/components/application_manager/test/commands/mobile/slider_test.cc
+++ b/src/components/application_manager/test/commands/mobile/slider_test.cc
@@ -59,7 +59,6 @@ using am::MockMessageHelper;
using policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -82,8 +81,7 @@ class SliderRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SliderRequestTest()
- : mock_message_helper_(*MockMessageHelper::message_helper_mock())
- , mock_app_(CreateMockApp())
+ : mock_app_(CreateMockApp())
, msg_(CreateMessage(smart_objects::SmartType_Map)) {}
MessageSharedPtr CreateFullParamsUISO() {
@@ -123,10 +121,6 @@ class SliderRequestTest
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
}
- void SetUp() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
void ExpectManageMobileCommandWithResultCode(
const mobile_apis::Result::eType code) {
EXPECT_CALL(
@@ -135,12 +129,8 @@ class SliderRequestTest
am::commands::Command::CommandOrigin::ORIGIN_SDL));
}
- void TearDown() OVERRIDE {
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
sync_primitives::Lock lock_;
- MockMessageHelper& mock_message_helper_;
MockAppPtr mock_app_;
MessageSharedPtr msg_;
MockPolicyHandlerInterface mock_policy_handler_;
@@ -189,7 +179,6 @@ TEST_F(SliderRequestTest, OnEvent_UI_UNSUPPORTED_RESOURCE) {
.asString()
.empty());
}
- Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
class CallOnTimeOut {
diff --git a/src/components/application_manager/test/commands/mobile/speak_request_test.cc b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
index 5d8955535b..f07012d315 100644
--- a/src/components/application_manager/test/commands/mobile/speak_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/speak_request_test.cc
@@ -84,16 +84,9 @@ const uint32_t kConnectionKey = 5u;
class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
SpeakRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , request_(CreateMessage(smart_objects::SmartType_Map))
+ : request_(CreateMessage(smart_objects::SmartType_Map))
, response_(CreateMessage(smart_objects::SmartType_Map))
- , app_(CreateMockApp()) {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~SpeakRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
+ , app_(CreateMockApp()) {}
void CheckExpectations(const hmi_apis::Common_Result::eType hmi_response,
const mobile_apis::Result::eType mobile_response,
@@ -130,7 +123,6 @@ class SpeakRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
static_cast<int32_t>(mobile_response));
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr request_;
MessageSharedPtr response_;
MockAppPtr app_;
diff --git a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
index 26f5ee224f..d9497cd900 100644
--- a/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/subscribe_way_points_request_test.cc
@@ -56,11 +56,9 @@ using ::testing::ReturnRef;
using ::testing::DoAll;
using ::testing::SaveArg;
using ::testing::InSequence;
-using ::testing::Mock;
namespace am = ::application_manager;
using am::commands::SubscribeWayPointsRequest;
using am::commands::MessageSharedPtr;
-using am::MockMessageHelper;
typedef SharedPtr<SubscribeWayPointsRequest> CommandPtr;
@@ -106,10 +104,6 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
event.set_smart_object(*event_msg);
- MockMessageHelper* mock_message_helper =
- MockMessageHelper::message_helper_mock();
- Mock::VerifyAndClearExpectations(mock_message_helper);
-
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
{
@@ -121,8 +115,6 @@ TEST_F(SubscribeWayPointsRequestTest, OnEvent_SUCCESS) {
command->Init();
command->on_event(event);
-
- Mock::VerifyAndClearExpectations(mock_message_helper);
}
} // namespace subscribe_way_points_request
diff --git a/src/components/application_manager/test/commands/mobile/system_request_test.cc b/src/components/application_manager/test/commands/mobile/system_request_test.cc
index 31099153bd..0e07889b4b 100644
--- a/src/components/application_manager/test/commands/mobile/system_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/system_request_test.cc
@@ -59,7 +59,6 @@ using am::event_engine::Event;
using policy_test::MockPolicyHandlerInterface;
using ::utils::SharedPtr;
using ::testing::_;
-using ::testing::Mock;
using ::testing::Return;
using ::testing::ReturnRef;
diff --git a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
index ae4e46d40b..3d083f5c45 100644
--- a/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unregister_app_interface_request_test.cc
@@ -90,7 +90,7 @@ TEST_F(UnregisterAppInterfaceRequestTest, Run_SUCCESS) {
mobile_apis::AppInterfaceUnregisteredReason::INVALID_ENUM;
MessageSharedPtr dummy_msg(CreateMessage());
- EXPECT_CALL(*am::MockMessageHelper::message_helper_mock(),
+ EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kConnectionKey, kUnregisterReason))
.WillOnce(Return(dummy_msg));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
index 9daf168c25..bb4824e8f7 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_vehicle_request_test.cc
@@ -92,8 +92,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
kVehicleType;
am::VehicleData data;
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
- .WillOnce(ReturnRef(data));
+ EXPECT_CALL(mock_message_helper_, vehicle_data()).WillOnce(ReturnRef(data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
MockAppPtr mock_app(CreateMockApp());
@@ -116,7 +115,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -140,7 +139,7 @@ TEST_F(UnsubscribeVehicleRequestTest,
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -162,7 +161,7 @@ TEST_F(UnsubscribeVehicleRequestTest, Run_UnsubscribeDataDisabled_UNSUCCESS) {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
CommandPtr command(CreateCommand<UnsubscribeVehicleDataRequest>(command_msg));
@@ -186,7 +185,7 @@ void UnsubscribeVehicleRequestTest::UnsubscribeSuccessfully() {
am::VehicleData vehicle_data;
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
am::ApplicationSet application_set_;
@@ -229,7 +228,7 @@ TEST_F(UnsubscribeVehicleRequestTest, OnEvent_DataNotSubscribed_IGNORED) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app));
vehicle_data.insert(am::VehicleData::value_type(kMsgParamKey, kVehicleType));
- EXPECT_CALL(*(am::MockMessageHelper::message_helper_mock()), vehicle_data())
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
.WillOnce(ReturnRef(vehicle_data));
EXPECT_CALL(*mock_app, IsSubscribedToIVI(kVehicleType))
.WillRepeatedly(Return(false));
diff --git a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
index edba1b01bd..733d037afb 100644
--- a/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/unsubscribe_way_points_request_test.cc
@@ -72,20 +72,13 @@ class UnSubscribeWayPointsRequestTest
public:
UnSubscribeWayPointsRequestTest()
: command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_))
- , mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
+ , command_(CreateCommand<UnSubscribeWayPointsRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
- }
-
- ~UnSubscribeWayPointsRequestTest() {
- testing::Mock::VerifyAndClearExpectations(&mock_message_helper_);
}
MessageSharedPtr command_msg_;
::utils::SharedPtr<UnSubscribeWayPointsRequest> command_;
- am::MockMessageHelper& mock_message_helper_;
};
TEST_F(UnSubscribeWayPointsRequestTest,
diff --git a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
index 027231f529..dacabba5fd 100644
--- a/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
+++ b/src/components/application_manager/test/commands/mobile/update_turn_list_request_test.cc
@@ -79,8 +79,7 @@ class UpdateTurnListRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
UpdateTurnListRequestTest()
- : mock_message_helper_(*am::MockMessageHelper::message_helper_mock())
- , command_msg_(CreateMessage(smart_objects::SmartType_Map))
+ : command_msg_(CreateMessage(smart_objects::SmartType_Map))
, command_(CreateCommand<UpdateTurnListRequest>(command_msg_)) {
(*command_msg_)[am::strings::params][am::strings::connection_key] =
kConnectionKey;
@@ -88,7 +87,6 @@ class UpdateTurnListRequestTest
kFunctionId;
}
- am::MockMessageHelper& mock_message_helper_;
MessageSharedPtr command_msg_;
::utils::SharedPtr<UpdateTurnListRequest> command_;
TypeIf<kMocksAreNice,
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 6c85d67b52..553126091f 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
@@ -54,6 +54,7 @@ namespace am = ::application_manager;
using ::testing::ReturnRef;
using ::testing::Return;
using ::testing::NiceMock;
+using ::testing::Mock;
using ::testing::_;
using ::utils::SharedPtr;
@@ -101,7 +102,9 @@ class CommandsTest : public ::testing::Test {
MockApplication>::Result MockApp;
typedef SharedPtr<MockApp> MockAppPtr;
- virtual ~CommandsTest() {}
+ virtual ~CommandsTest() {
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
+ }
static MessageSharedPtr CreateMessage(
const smart_objects::SmartType type = smart_objects::SmartType_Null) {
@@ -137,6 +140,7 @@ class CommandsTest : public ::testing::Test {
MockAppManager app_mngr_;
MockAppManagerSettings app_mngr_settings_;
MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_;
+ am::MockMessageHelper& mock_message_helper_;
protected:
virtual void InitCommand(const uint32_t& timeout) {
@@ -146,26 +150,26 @@ class CommandsTest : public ::testing::Test {
.WillByDefault(ReturnRef(timeout));
}
- CommandsTest() {
+ CommandsTest()
+ : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) {
ON_CALL(app_mngr_, hmi_interfaces())
.WillByDefault(ReturnRef(mock_hmi_interfaces_));
ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_))
.WillByDefault(Return(am::HmiInterfaces::HMI_INTERFACE_SDL));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
.WillByDefault(Return(am::HmiInterfaces::STATE_AVAILABLE));
+ Mock::VerifyAndClearExpectations(&mock_message_helper_);
InitHMIToMobileResultConverter();
}
void InitHMIToMobileResultConverter() {
namespace MobileResult = mobile_apis::Result;
namespace HMIResult = hmi_apis::Common_Result;
- MockMessageHelper& mock_message_helper =
- *MockMessageHelper::message_helper_mock();
- auto link_hmi_to_mob_result = [&mock_message_helper](
- HMIResult::eType hmi_result, MobileResult::eType mobile_result) {
- ON_CALL(mock_message_helper, HMIToMobileResult(hmi_result))
- .WillByDefault(Return(mobile_result));
- };
+ auto link_hmi_to_mob_result =
+ [this](HMIResult::eType hmi_result, MobileResult::eType mobile_result) {
+ ON_CALL(mock_message_helper_, HMIToMobileResult(hmi_result))
+ .WillByDefault(Return(mobile_result));
+ };
link_hmi_to_mob_result(HMIResult::INVALID_ENUM, MobileResult::INVALID_ENUM);
link_hmi_to_mob_result(HMIResult::SUCCESS, MobileResult::SUCCESS);
link_hmi_to_mob_result(HMIResult::UNSUPPORTED_REQUEST,
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 9bdfe65cb7..a8c4f96b35 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -50,8 +50,12 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(curHash, const std::string&());
MOCK_METHOD0(UpdateHash, void());
+ // DEPRECATED
MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
+ // DEPRECATED
MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
+ MOCK_CONST_METHOD0(IsHashChangedDuringSuspend, bool());
+ MOCK_METHOD1(SetHashChangedDuringSuspend, void(const bool flag));
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
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 b06b207f84..fb264b7d82 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
@@ -48,7 +48,9 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(RemoveApplicationFromSaved,
bool(app_mngr::ApplicationConstSharedPtr application));
MOCK_METHOD0(OnSuspend, void());
+ MOCK_METHOD0(OnIgnitionOff, void());
MOCK_METHOD0(OnAwake, void());
+ MOCK_CONST_METHOD0(is_suspended, bool());
MOCK_METHOD0(StopSavePersistentDataTimer, void());
MOCK_METHOD2(StartResumption,
bool(app_mngr::ApplicationSharedPtr application,
diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
index 7b16a3bf00..cfec034653 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
@@ -60,11 +60,13 @@ class MockResumptionData : public ::resumption::ResumptionData {
uint32_t(const std::string& policy_app_id,
const std::string& device_id));
MOCK_METHOD0(OnSuspend, void());
+ MOCK_METHOD0(IncrementIgnOffCount, void());
MOCK_CONST_METHOD3(GetHashId,
bool(const std::string& policy_app_id,
const std::string& device_id,
std::string& hash_id));
MOCK_METHOD0(OnAwake, void());
+ MOCK_METHOD0(DecrementIgnOffCount, void());
MOCK_CONST_METHOD3(GetSavedApplication,
bool(const std::string& policy_app_id,
const std::string& device_id,
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 f2fc18ca58..bbb814fb5b 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -880,7 +880,7 @@ TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) {
// TODO (VVeremjova) APPLINK-16718
TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) {
- EXPECT_CALL(*mock_storage_, OnSuspend());
+ EXPECT_CALL(*mock_storage_, IncrementIgnOffCount());
res_ctrl_->OnSuspend();
}
@@ -896,7 +896,7 @@ TEST_F(ResumeCtrlTest, OnSuspend_EmptyApplicationlist) {
ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
EXPECT_CALL(*mock_storage_, SaveApplication(mock_app)).Times(0);
- EXPECT_CALL(*mock_storage_, OnSuspend());
+ EXPECT_CALL(*mock_storage_, IncrementIgnOffCount()).Times(0);
EXPECT_CALL(*mock_storage_, Persist());
res_ctrl_->OnSuspend();
}
@@ -906,7 +906,7 @@ TEST_F(ResumeCtrlTest, OnAwake) {
EXPECT_CALL(mock_application_manager_settings_,
app_resumption_save_persistent_data_timeout())
.WillOnce(ReturnRef(timeout));
- EXPECT_CALL(*mock_storage_, OnAwake());
+ EXPECT_CALL(*mock_storage_, DecrementIgnOffCount()).Times(0);
res_ctrl_->OnAwake();
}
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 aa4db59eac..cf0ebb7fd2 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
@@ -728,7 +728,7 @@ TEST_F(ResumptionDataDBTest, OnSuspend) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
}
@@ -740,18 +740,18 @@ TEST_F(ResumptionDataDBTest, OnSuspendFourTimes) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, kMacAddress_);
EXPECT_EQ(-1, result);
@@ -765,11 +765,11 @@ TEST_F(ResumptionDataDBTest, OnSuspendOnAwake) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
ign_off_count_++;
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
}
@@ -782,7 +782,7 @@ TEST_F(ResumptionDataDBTest, Awake_AppNotSuspended) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
}
@@ -795,12 +795,12 @@ TEST_F(ResumptionDataDBTest, TwiceAwake_AppNotSuspended) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- res_db()->OnSuspend();
- res_db()->OnAwake();
+ res_db()->IncrementIgnOffCount();
+ res_db()->DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedDB();
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
CheckSavedDB();
}
@@ -826,14 +826,14 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) {
last_ign_off_time = res_db()->GetIgnOffTime();
EXPECT_EQ(0u, last_ign_off_time);
- res_db()->OnSuspend();
+ res_db()->IncrementIgnOffCount();
uint32_t after_suspend;
after_suspend = res_db()->GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
uint32_t after_awake;
- res_db()->OnAwake();
+ res_db()->DecrementIgnOffCount();
after_awake = res_db()->GetIgnOffTime();
EXPECT_LE(after_suspend, after_awake);
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 834637fa62..e017c39497 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
@@ -257,7 +257,7 @@ TEST_F(ResumptionDataJsonTest, OnSuspend) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
}
@@ -268,13 +268,13 @@ TEST_F(ResumptionDataJsonTest, OnSuspendFourTimes) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
- res_json.OnSuspend();
- res_json.OnSuspend();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
+ res_json.IncrementIgnOffCount();
+ res_json.IncrementIgnOffCount();
EXPECT_TRUE(-1 != res_json.IsApplicationSaved(policy_app_id_, kMacAddress_));
}
@@ -285,11 +285,11 @@ TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
ign_off_count_++;
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
}
@@ -300,7 +300,7 @@ TEST_F(ResumptionDataJsonTest, Awake_AppNotSuspended) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
}
@@ -311,12 +311,12 @@ TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) {
res_json.SaveApplication(app_mock);
CheckSavedJson();
- res_json.OnSuspend();
- res_json.OnAwake();
+ res_json.IncrementIgnOffCount();
+ res_json.DecrementIgnOffCount();
ign_off_count_ = 0;
CheckSavedJson();
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
CheckSavedJson();
}
@@ -339,14 +339,14 @@ TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
last_ign_off_time = res_json.GetIgnOffTime();
EXPECT_EQ(0u, last_ign_off_time);
- res_json.OnSuspend();
+ res_json.IncrementIgnOffCount();
uint32_t after_suspend;
after_suspend = res_json.GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
uint32_t after_awake;
- res_json.OnAwake();
+ res_json.DecrementIgnOffCount();
after_awake = res_json.GetIgnOffTime();
EXPECT_LE(after_suspend, after_awake);