diff options
Diffstat (limited to 'src/components/application_manager/test/include/application_manager')
9 files changed, 203 insertions, 62 deletions
diff --git a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h index e5a45c1549..1980ffa100 100644 --- a/src/components/application_manager/test/include/application_manager/commands/command_request_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/command_request_test.h @@ -36,12 +36,13 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" + #include "smart_objects/smart_object.h" #include "application_manager/smart_object_keys.h" -#include "application_manager/commands/commands_test.h" +#include "application_manager/test/include/application_manager/commands/commands_test.h" #include "application_manager/commands/command_request_impl.h" -#include "application_manager/mock_event_dispatcher.h" +#include "application_manager/test/include/application_manager/mock_event_dispatcher.h" + #include "application_manager/event_engine/event.h" namespace test { @@ -94,7 +95,7 @@ class CommandRequestTest : public CommandsTest<kIsNice> { MessageSharedPtr CatchMobileCommandResult(CallableT delegate, bool call_return = true) { MessageSharedPtr result_msg; - EXPECT_CALL(this->app_mngr_, ManageMobileCommand(_, _)) + EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return))); delegate(); return result_msg; @@ -104,7 +105,7 @@ class CommandRequestTest : public CommandsTest<kIsNice> { MessageSharedPtr CatchHMICommandResult(CallableT delegate, bool call_return = true) { MessageSharedPtr result_msg; - EXPECT_CALL(this->app_mngr_, ManageHMICommand(_)) + EXPECT_CALL(this->mock_rpc_service_, ManageHMICommand(_)) .WillOnce(DoAll(SaveArg<0>(&result_msg), Return(call_return))); delegate(); return result_msg; 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 553126091f..9a961ea1a9 100644 --- a/src/components/application_manager/test/include/application_manager/commands/commands_test.h +++ b/src/components/application_manager/test/include/application_manager/commands/commands_test.h @@ -36,15 +36,18 @@ #include <stdint.h> #include "gtest/gtest.h" -#include "utils/shared_ptr.h" #include "smart_objects/smart_object.h" #include "application_manager/commands/command.h" -#include "utils/make_shared.h" + #include "application_manager/mock_application_manager.h" #include "test/application_manager/mock_application_manager_settings.h" -#include "application_manager/mock_hmi_interface.h" -#include "application_manager/mock_application.h" -#include "application_manager/mock_message_helper.h" +#include "application_manager/test/include/application_manager/mock_hmi_interface.h" +#include "application_manager/test/include/application_manager/mock_application.h" +#include "application_manager/test/include/application_manager/mock_message_helper.h" +#include "application_manager/mock_application_manager_settings.h" +#include "application_manager/mock_rpc_service.h" +#include "application_manager/mock_hmi_capabilities.h" +#include "application_manager/policies/mock_policy_handler_interface.h" namespace test { namespace components { namespace commands_test { @@ -57,7 +60,6 @@ using ::testing::NiceMock; using ::testing::Mock; using ::testing::_; -using ::utils::SharedPtr; using ::smart_objects::SmartObject; using am::commands::MessageSharedPtr; using ::test::components::application_manager_test::MockApplicationManager; @@ -94,13 +96,14 @@ class CommandsTest : public ::testing::Test { enum { kMocksAreNice = kIsNice }; typedef NiceMock<MockApplicationManagerSettings> MockAppManagerSettings; + typedef NiceMock<application_manager_test::MockRPCService> MockRPCService; typedef typename TypeIf<kIsNice, NiceMock<MockApplicationManager>, MockApplicationManager>::Result MockAppManager; typedef typename TypeIf<kIsNice, NiceMock<MockApplication>, MockApplication>::Result MockApp; - typedef SharedPtr<MockApp> MockAppPtr; + typedef std::shared_ptr<MockApp> MockAppPtr; virtual ~CommandsTest() { Mock::VerifyAndClearExpectations(&mock_message_helper_); @@ -108,50 +111,65 @@ class CommandsTest : public ::testing::Test { static MessageSharedPtr CreateMessage( const smart_objects::SmartType type = smart_objects::SmartType_Null) { - return ::utils::MakeShared<SmartObject>(type); + return std::make_shared<SmartObject>(type); } static MockAppPtr CreateMockApp() { - return ::utils::MakeShared<MockApp>(); + return std::make_shared<MockApp>(); } template <class Command> - SharedPtr<Command> CreateCommand(const uint32_t timeout, - MessageSharedPtr& msg) { + std::shared_ptr<Command> CreateCommand(const uint32_t timeout, + MessageSharedPtr& msg) { InitCommand(timeout); - return ::utils::MakeShared<Command>((msg ? msg : msg = CreateMessage()), - app_mngr_); + return std::make_shared<Command>((msg ? msg : msg = CreateMessage()), + app_mngr_, + mock_rpc_service_, + mock_hmi_capabilities_, + mock_policy_handler_); } template <class Command> - SharedPtr<Command> CreateCommand(MessageSharedPtr& msg) { + std::shared_ptr<Command> CreateCommand(MessageSharedPtr& msg) { return CreateCommand<Command>(kDefaultTimeout_, msg); } template <class Command> - SharedPtr<Command> CreateCommand(const uint32_t timeout = kDefaultTimeout_) { + std::shared_ptr<Command> CreateCommand( + const uint32_t timeout = kDefaultTimeout_) { InitCommand(timeout); MessageSharedPtr msg = CreateMessage(); - return ::utils::MakeShared<Command>(msg, app_mngr_); + return std::make_shared<Command>(msg, + app_mngr_, + mock_rpc_service_, + mock_hmi_capabilities_, + mock_policy_handler_); } enum { kDefaultTimeout_ = 100 }; MockAppManager app_mngr_; + MockRPCService mock_rpc_service_; + testing::NiceMock<application_manager_test::MockHMICapabilities> + mock_hmi_capabilities_; + testing::NiceMock<policy_test::MockPolicyHandlerInterface> + mock_policy_handler_; MockAppManagerSettings app_mngr_settings_; MOCK(am::MockHmiInterfaces) mock_hmi_interfaces_; am::MockMessageHelper& mock_message_helper_; protected: virtual void InitCommand(const uint32_t& timeout) { + timeout_ = timeout; ON_CALL(app_mngr_, get_settings()) .WillByDefault(ReturnRef(app_mngr_settings_)); ON_CALL(app_mngr_settings_, default_timeout()) - .WillByDefault(ReturnRef(timeout)); + .WillByDefault(ReturnRef(timeout_)); } CommandsTest() - : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) { + : mock_message_helper_(*am::MockMessageHelper::message_helper_mock()) + , timeout_(0) { ON_CALL(app_mngr_, hmi_interfaces()) .WillByDefault(ReturnRef(mock_hmi_interfaces_)); ON_CALL(mock_hmi_interfaces_, GetInterfaceFromFunction(_)) @@ -209,6 +227,9 @@ class CommandsTest : public ::testing::Test { MobileResult::DATA_NOT_AVAILABLE); link_hmi_to_mob_result(HMIResult::READ_ONLY, MobileResult::READ_ONLY); } + + private: + uint32_t timeout_; }; MATCHER_P(MobileResultCodeIs, result_code, "") { 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 10cf5f746e..d7552060ff 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 @@ -38,6 +38,7 @@ #include "smart_objects/smart_object.h" #include "utils/custom_string.h" #include "application_manager/usage_statistics.h" +#include "utils/semantic_version.h" namespace test { namespace components { @@ -50,9 +51,6 @@ 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()); @@ -106,10 +104,14 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType()); MOCK_CONST_METHOD0(audio_streaming_state, const mobile_apis::AudioStreamingState::eType()); + MOCK_CONST_METHOD0(video_streaming_state, + const mobile_apis::VideoStreamingState::eType()); MOCK_CONST_METHOD0(app_icon_path, const std::string&()); MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle()); + MOCK_CONST_METHOD0(secondary_device, connection_handler::DeviceHandle()); MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr()); MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr()); + MOCK_CONST_METHOD0(IsAllowedToChangeAudioSource, bool()); MOCK_CONST_METHOD0(PostponedHmiState, const application_manager::HmiStatePtr()); MOCK_METHOD1(set_tts_properties_in_none, void(bool active)); @@ -126,6 +128,8 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name)); MOCK_METHOD1(set_app_allowed, void(const bool allowed)); MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device)); + MOCK_METHOD1(set_secondary_device, + void(connection_handler::DeviceHandle secondary_device)); MOCK_CONST_METHOD0(get_grammar_id, uint32_t()); MOCK_METHOD1(set_grammar_id, void(uint32_t value)); MOCK_METHOD1( @@ -135,6 +139,10 @@ class MockApplication : public ::application_manager::Application { ::protocol_handler::MajorProtocolVersion()); MOCK_METHOD1(set_is_resuming, void(bool)); MOCK_CONST_METHOD0(is_resuming, bool()); + MOCK_METHOD1(set_deferred_resumption_hmi_level, + void(application_manager::mobile_api::HMILevel::eType level)); + MOCK_CONST_METHOD0(deferred_resumption_hmi_level, + application_manager::mobile_api::HMILevel::eType()); MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file)); MOCK_CONST_METHOD0(getAppFiles, const ::application_manager::AppFilesMap&()); MOCK_METHOD1(UpdateFile, bool(const ::application_manager::AppFile& file)); @@ -148,14 +156,15 @@ class MockApplication : public ::application_manager::Application { bool(mobile_apis::ButtonName::eType btn_name)); MOCK_METHOD1(UnsubscribeFromButton, bool(mobile_apis::ButtonName::eType btn_name)); - MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type)); - MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type)); - MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type)); MOCK_METHOD0(ResetDataInNone, void()); MOCK_METHOD2(AreCommandLimitsExceeded, bool(mobile_apis::FunctionID::eType cmd_id, ::application_manager::TLimitSource source)); MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&()); + MOCK_METHOD0(help_prompt_manager, + ::application_manager::HelpPromptManager&()); + MOCK_CONST_METHOD0(help_prompt_manager, + const ::application_manager::HelpPromptManager&()); MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state)); MOCK_METHOD1(SetPostponedState, @@ -170,6 +179,7 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id)); MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id)); MOCK_CONST_METHOD0(IsAudioApplication, bool()); + MOCK_CONST_METHOD0(IsVideoApplication, bool()); MOCK_METHOD0(LoadPersistentFiles, void()); // InitialApplicationData methods MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*()); @@ -180,6 +190,7 @@ class MockApplication : public ::application_manager::Application { const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&()); MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&()); + MOCK_CONST_METHOD0(msg_version, const utils::SemanticVersion&()); MOCK_METHOD1(set_app_types, void(const smart_objects::SmartObject& app_types)); MOCK_METHOD1(set_vr_synonyms, @@ -192,6 +203,7 @@ class MockApplication : public ::application_manager::Application { void(const mobile_apis::Language::eType& language)); MOCK_METHOD1(set_ui_language, void(const mobile_apis::Language::eType& ui_language)); + MOCK_METHOD1(set_msg_version, void(const utils::SemanticVersion& version)); // DynamicApplicationData methods MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*()); @@ -203,12 +215,12 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0( SubscribedButtons, DataAccessor< ::application_manager::ButtonSubscriptions>()); - MOCK_CONST_METHOD0( - SubscribedIVI, - DataAccessor< ::application_manager::VehicleInfoSubscriptions>()); MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*()); MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*()); + MOCK_CONST_METHOD0(display_layout, const std::string&()); MOCK_METHOD1(load_global_properties, void(const smart_objects::SmartObject& so)); MOCK_METHOD1(set_help_prompt, @@ -232,6 +244,11 @@ class MockApplication : public ::application_manager::Application { void(const smart_objects::SmartObject& menu_title)); MOCK_METHOD1(set_menu_icon, void(const smart_objects::SmartObject& menu_icon)); + MOCK_METHOD1(set_day_color_scheme, + void(const smart_objects::SmartObject& color_scheme)); + MOCK_METHOD1(set_night_color_scheme, + void(const smart_objects::SmartObject& color_scheme)); + MOCK_METHOD1(set_display_layout, void(const std::string& layout)); MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t()); MOCK_METHOD1(set_audio_stream_retry_number, void(const uint32_t& audio_stream_retry_number)); @@ -292,8 +309,11 @@ class MockApplication : public ::application_manager::Application { MOCK_CONST_METHOD0(IsRegistered, bool()); MOCK_CONST_METHOD0(SchemaUrl, std::string()); MOCK_CONST_METHOD0(PackageName, std::string()); + MOCK_METHOD1(PushMobileMessage, void(smart_objects::SmartObjectSPtr message)); + MOCK_METHOD1( + SwapMobileMessageQueue, + void(::application_manager::MobileMessageQueue& mobile_messages)); -#ifdef SDL_REMOTE_CONTROL MOCK_METHOD1( set_system_context, void(const application_manager::mobile_api::SystemContext::eType&)); @@ -316,11 +336,10 @@ class MockApplication : public ::application_manager::Application { MOCK_METHOD1(AddExtension, bool(application_manager::AppExtensionPtr extention)); MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid)); - MOCK_METHOD0(RemoveExtensions, void()); - MOCK_CONST_METHOD0(SubscribesIVI, - const application_manager::VehicleInfoSubscriptions&()); - -#endif // SDL_REMOTE_CONTROL + MOCK_CONST_METHOD0(Extensions, + const std::list<application_manager::AppExtensionPtr>&()); + MOCK_CONST_METHOD0(is_remote_control_supported, bool()); + MOCK_METHOD1(set_remote_control_supported, void(const bool allow)); }; } // namespace application_manager_test diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_command_factory.h b/src/components/application_manager/test/include/application_manager/mock_command_factory.h index cf40d7b98b..c49b5e7ce2 100644 --- a/src/components/application_manager/test/include/application_manager/mock_hmi_command_factory.h +++ b/src/components/application_manager/test/include/application_manager/mock_command_factory.h @@ -34,23 +34,24 @@ #define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HMI_COMMAND_FACTORY_H_ #include <gmock/gmock.h> -#include "application_manager/application_manager.h" +#include "application_manager/command_factory.h" #include "application_manager/commands/command.h" #include "smart_objects/smart_object.h" -#include "utils/shared_ptr.h" namespace test { namespace components { namespace application_manager_test { -class MockHMICommandFactory { +class MockCommandFactory : public application_manager::CommandFactory { public: MOCK_METHOD2(CreateCommand, - utils::SharedPtr<application_manager::commands::Command>( - const utils::SharedPtr<smart_objects::SmartObject>&, - application_manager::ApplicationManager&)); - - static MockHMICommandFactory* mock_hmi_command_factory(); + application_manager::CommandSharedPtr( + const application_manager::commands::MessageSharedPtr&, + application_manager::commands::Command::CommandSource)); + MOCK_CONST_METHOD2( + IsAbleToProcess, + bool(const int32_t, + const application_manager::commands::Command::CommandSource)); }; } // namespace application_manager_test diff --git a/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h new file mode 100644 index 0000000000..a415f94d56 --- /dev/null +++ b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2018, Ford Motor Company +* All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are met: +* +* Redistributions of source code must retain the above copyright notice, this +* list of conditions and the following disclaimer. +* +* Redistributions in binary form must reproduce the above copyright notice, +* this list of conditions and the following +* disclaimer in the documentation and/or other materials provided with the +* distribution. +* +* Neither the name of the Ford Motor Company nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +* POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_ +#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_ +#include "gmock/gmock.h" + +namespace test { +namespace components { +namespace application_manager_test { + +using namespace application_manager; + +class MockHelpPromptManager : public ::application_manager::HelpPromptManager { + public: + MockHelpPromptManager() {} + MOCK_METHOD3(OnVrCommandAdded, + void(uint32_t cmd_id, + const smart_objects::SmartObject& command, + const bool should_send_requests)); + MOCK_METHOD2(OnVrCommandDeleted, + void(uint32_t cmd_id, const bool should_send_requests)); + MOCK_METHOD2(OnSetGlobalPropertiesReceived, + void(const smart_objects::SmartObject& msg, bool is_response)); + MOCK_CONST_METHOD0(GetSendingType, SendingType()); +}; + +} // namespace application_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_HELP_PROMPT_MANAGER_H_ diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h index 7598e33e19..8a06102e99 100644 --- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h +++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h @@ -40,11 +40,18 @@ #include "application_manager/policies/policy_handler_interface.h" #include "application_manager/application_manager.h" #include "smart_objects/smart_object.h" +#include "transport_manager/common.h" namespace application_manager { class MockMessageHelper { public: + MOCK_METHOD2(CreateNotification, + smart_objects::SmartObjectSPtr(mobile_apis::FunctionID::eType, + uint32_t)); + MOCK_METHOD1(CreateHMINotification, + smart_objects::SmartObjectSPtr(hmi_apis::FunctionID::eType)); + MOCK_METHOD1(GetHashUpdateNotification, smart_objects::SmartObjectSPtr(const uint32_t app_id)); MOCK_METHOD2(SendHashUpdateNotification, @@ -118,6 +125,9 @@ class MockMessageHelper { ApplicationManager& application_manager, hmi_apis::Common_HMILevel::eType level, bool send_policy_priority)); + MOCK_METHOD2(CreateMessageForHMI, + smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType, + const uint32_t)); MOCK_METHOD2(SendHMIStatusNotification, void(const Application& application_impl, ApplicationManager& application_manager)); @@ -173,8 +183,10 @@ class MockMessageHelper { MOCK_METHOD1(CreateAddVRCommandRequestFromChoiceToHMI, smart_objects::SmartObjectList(ApplicationConstSharedPtr app)); MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app)); - MOCK_METHOD1(GetIVISubscriptionRequests, - smart_objects::SmartObjectList(ApplicationSharedPtr app)); + MOCK_METHOD3(VerifyTtsFiles, + mobile_apis::Result::eType(smart_objects::SmartObject& message, + ApplicationConstSharedPtr app, + ApplicationManager& app_mngr)); MOCK_METHOD3(VerifyImageFiles, mobile_apis::Result::eType(smart_objects::SmartObject& message, ApplicationConstSharedPtr app, @@ -183,6 +195,9 @@ class MockMessageHelper { mobile_apis::Result::eType(smart_objects::SmartObject& message, ApplicationConstSharedPtr app, ApplicationManager& app_mngr)); + MOCK_METHOD1(CheckChoiceSetVRCommands, + MessageHelper::ChoiceSetVRCommandsStatus( + const smart_objects::SmartObject&)); MOCK_METHOD6(GetBCActivateAppRequestToHMI, smart_objects::SmartObjectSPtr( @@ -224,6 +239,12 @@ class MockMessageHelper { MOCK_METHOD2(SendUIChangeRegistrationRequestToHMI, void(ApplicationConstSharedPtr app, ApplicationManager& app_mngr)); + MOCK_METHOD5(CreateDeviceInfo, + bool(connection_handler::DeviceHandle device_handle, + const protocol_handler::SessionObserver& session_observer, + const policy::PolicyHandlerInterface& policy_handler, + ApplicationManager& app_mngr, + smart_objects::SmartObject* output)); MOCK_METHOD5(CreateHMIApplicationStruct, bool(ApplicationConstSharedPtr app, const protocol_handler::SessionObserver& session_observer, @@ -266,7 +287,7 @@ class MockMessageHelper { MOCK_METHOD1(StringifiedHMILevel, std::string(const mobile_apis::HMILevel::eType hmi_level)); MOCK_METHOD2(GetDeviceMacAddressForHandle, - std::string(const uint32_t device_handle, + std::string(const transport_manager::DeviceHandle device_handle, const ApplicationManager& app_mngr)); MOCK_METHOD3(SendDeleteCommandRequest, void(smart_objects::SmartObject* cmd, @@ -287,10 +308,6 @@ class MockMessageHelper { void(mobile_apis::ButtonName::eType button, ApplicationSharedPtr application, ApplicationManager& app_mngr)); - MOCK_METHOD3(SendUnsubscribeIVIRequest, - void(int32_t ivi_id, - ApplicationSharedPtr application, - ApplicationManager& app_mngr)); static MockMessageHelper* message_helper_mock(); }; 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 fb264b7d82..0fa7a898be 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 @@ -50,13 +50,21 @@ class MockResumeCtrl : public resumption::ResumeCtrl { MOCK_METHOD0(OnSuspend, void()); MOCK_METHOD0(OnIgnitionOff, void()); MOCK_METHOD0(OnAwake, void()); + MOCK_CONST_METHOD0(LowVoltageTime, time_t()); + MOCK_CONST_METHOD0(WakeUpTime, time_t()); + MOCK_METHOD0(SaveLowVoltageTime, void()); + MOCK_METHOD0(SaveWakeUpTime, void()); + MOCK_METHOD0(ResetLowVoltageTime, void()); + MOCK_METHOD0(ResetWakeUpTime, void()); MOCK_CONST_METHOD0(is_suspended, bool()); MOCK_METHOD0(StopSavePersistentDataTimer, void()); + MOCK_METHOD0(StartSavePersistentDataTimer, void()); MOCK_METHOD2(StartResumption, bool(app_mngr::ApplicationSharedPtr application, const std::string& hash)); MOCK_METHOD1(StartResumptionOnlyHMILevel, bool(app_mngr::ApplicationSharedPtr application)); + MOCK_METHOD1(RetryResumption, void(const uint32_t app_id)); MOCK_METHOD1(CheckPersistenceFilesForResumption, bool(app_mngr::ApplicationSharedPtr application)); MOCK_METHOD2(CheckApplicationHash, @@ -95,7 +103,8 @@ class MockResumeCtrl : public resumption::ResumeCtrl { #ifdef BUILD_TESTS MOCK_METHOD1(set_resumption_storage, - void(utils::SharedPtr<resumption::ResumptionData> mock_storage)); + void(std::shared_ptr<resumption::ResumptionData> mock_storage)); + MOCK_CONST_METHOD0(get_resumption_active, bool()); #endif // BUILD_TESTS }; diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h index cfec034653..38d1944dba 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 @@ -66,6 +66,10 @@ class MockResumptionData : public ::resumption::ResumptionData { const std::string& device_id, std::string& hash_id)); MOCK_METHOD0(OnAwake, void()); + MOCK_METHOD0(IncrementGlobalIgnOnCounter, void()); + MOCK_CONST_METHOD0(GetGlobalIgnOnCounter, uint32_t()); + MOCK_METHOD0(ResetGlobalIgnOnCount, void()); + MOCK_METHOD0(DecrementIgnOffCount, void()); MOCK_CONST_METHOD3(GetSavedApplication, bool(const std::string& policy_app_id, diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h index 436c8c165e..4f8c9fd25e 100644 --- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h +++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h @@ -39,6 +39,7 @@ #include "application_manager/usage_statistics.h" #include "application_manager/mock_application.h" #include "application_manager/mock_application_manager.h" +#include "application_manager/mock_app_extension.h" #include "utils/data_accessor.h" #include "config_profile/profile.h" #include "application_manager/policies/policy_handler.h" @@ -68,12 +69,17 @@ class ResumptionDataTest : public ::testing::Test { , kCountOfSubmenues_(3u) , kCountOfFiles_(8u) , kCountOfVrhelptitle_(2u) - , kMacAddress_("12345") {} + , kMacAddress_("12345") + , sublock_ptr_(std::make_shared<sync_primitives::Lock>()) + , comlock_ptr_(std::make_shared<sync_primitives::Lock>()) + , setlock_ptr_(std::make_shared<sync_primitives::Lock>()) + , btnlock_ptr_(std::make_shared<sync_primitives::Lock>()) + , ivilock_ptr_(std::make_shared<sync_primitives::Lock>()) {} // Check structure in saved application void CheckSavedApp(sm::SmartObject& saved_data); // Set data for resumption virtual void PrepareData(); - utils::SharedPtr<NiceMock<application_manager_test::MockApplication> > + std::shared_ptr<NiceMock<application_manager_test::MockApplication> > app_mock; profile::Profile profile_; @@ -137,16 +143,18 @@ class ResumptionDataTest : public ::testing::Test { am::AppFilesMap app_files_map_; am::ButtonSubscriptions btn_subscr; - am::VehicleInfoSubscriptions ivi; - sync_primitives::Lock sublock_; - sync_primitives::Lock comlock_; - sync_primitives::Lock setlock_; - sync_primitives::Lock btnlock_; - sync_primitives::Lock ivilock_; + std::shared_ptr<sync_primitives::Lock> sublock_ptr_; + std::shared_ptr<sync_primitives::Lock> comlock_ptr_; + std::shared_ptr<sync_primitives::Lock> setlock_ptr_; + std::shared_ptr<sync_primitives::Lock> btnlock_ptr_; + std::shared_ptr<sync_primitives::Lock> ivilock_ptr_; application_manager_test::MockApplicationManagerSettings mock_application_manager_settings_; application_manager_test::MockApplicationManager mock_application_manager_; + std::shared_ptr<NiceMock<application_manager_test::MockAppExtension> > + mock_app_extension_; + std::list<application_manager::AppExtensionPtr> extensions_; }; } // namespace resumption_test |