diff options
Diffstat (limited to 'src/components/application_manager/test/application_impl_test.cc')
-rw-r--r-- | src/components/application_manager/test/application_impl_test.cc | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc index be2986e719..301ed227b8 100644 --- a/src/components/application_manager/test/application_impl_test.cc +++ b/src/components/application_manager/test/application_impl_test.cc @@ -39,7 +39,6 @@ #include "application_manager/hmi_state.h" #include "utils/file_system.h" -#include "utils/make_shared.h" #include "application_manager/mock_message_helper.h" #include "utils/custom_string.h" #include "application_manager/mock_application_manager.h" @@ -64,6 +63,7 @@ using namespace mobile_apis; namespace custom_str = utils::custom_string; using ::testing::_; +using ::testing::Mock; using ::testing::Return; using ::testing::ReturnRef; using ::testing::AtLeast; @@ -100,12 +100,17 @@ class ApplicationImplTest : public ::testing::Test { mac_address, device_handle, app_name, - utils::MakeShared<MockStatisticsManager>(), + std::make_shared<MockStatisticsManager>(), mock_application_manager_)); HmiStatePtr initial_state = CreateTestHmiState(); app_impl->SetInitialState(initial_state); } + + virtual void TearDown() OVERRIDE { + Mock::VerifyAndClearExpectations(MockMessageHelper::message_helper_mock()); + } + HmiStatePtr CreateTestHmiState(); HmiStatePtr TestAddHmiState(HMILevel::eType hmi_lvl, @@ -115,7 +120,7 @@ class ApplicationImplTest : public ::testing::Test { void CheckCurrentHMIState(); MockApplicationManagerSettings mock_application_manager_settings_; MockApplicationManager mock_application_manager_; - utils::SharedPtr<ApplicationImpl> app_impl; + std::shared_ptr<ApplicationImpl> app_impl; uint32_t app_id; std::string policy_app_id; std::string mac_address; @@ -130,8 +135,8 @@ class ApplicationImplTest : public ::testing::Test { }; HmiStatePtr ApplicationImplTest::CreateTestHmiState() { - HmiStatePtr testState = utils::MakeShared<HmiState>( - static_cast<utils::SharedPtr<Application> >(app_impl), + HmiStatePtr testState = std::make_shared<HmiState>( + static_cast<std::shared_ptr<Application> >(app_impl), mock_application_manager_, state_id); testState->set_hmi_level(test_lvl); @@ -265,7 +270,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) { // Last state does not have a parent EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level()); EXPECT_EQ(HmiState::STATE_ID_TTS_SESSION, current_state->state_id()); - EXPECT_EQ(NULL, current_state->parent()); + EXPECT_EQ(nullptr, current_state->parent()); } TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) { @@ -304,7 +309,7 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) { // Check that state was correctly removed app_impl->RemovePostponedState(); state2 = app_impl->PostponedHmiState(); - EXPECT_EQ(NULL, state2); + EXPECT_EQ(nullptr, state2); } TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) { @@ -400,7 +405,7 @@ TEST_F(ApplicationImplTest, GetFile) { test_file.file_type = FileType::GRAPHIC_JPEG; test_file.file_name = "test_file 1"; - EXPECT_EQ(NULL, app_impl->GetFile(test_file.file_name)); + EXPECT_EQ(nullptr, app_impl->GetFile(test_file.file_name)); EXPECT_TRUE(app_impl->AddFile(test_file)); const AppFile* app_file = app_impl->GetFile(test_file.file_name); EXPECT_EQ(test_file.is_persistent, app_file->is_persistent); @@ -806,7 +811,7 @@ TEST_F(ApplicationImplTest, StopStreaming_StreamingApproved) { TEST_F(ApplicationImplTest, PushPopMobileMessage) { smart_objects::SmartObjectSPtr on_driver_distraction = - utils::MakeShared<smart_objects::SmartObject>(); + std::make_shared<smart_objects::SmartObject>(); const hmi_apis::Common_DriverDistractionState::eType state = hmi_apis::Common_DriverDistractionState::DD_ON; (*on_driver_distraction)[strings::params][strings::function_id] = @@ -827,6 +832,29 @@ TEST_F(ApplicationImplTest, PushPopMobileMessage) { EXPECT_TRUE(messages.empty()); } +TEST_F(ApplicationImplTest, SetSecondaryDeviceTest) { + connection_handler::DeviceHandle initial_device = + app_impl->secondary_device(); + EXPECT_EQ(0u, initial_device); + + connection_handler::DeviceHandle device = 123; + app_impl->set_secondary_device(device); + + EXPECT_EQ(device, app_impl->secondary_device()); +} + +TEST_F(ApplicationImplTest, SetDeferredResumptionHMILevelTest) { + using namespace mobile_api::HMILevel; + HMILevel::eType initial_deferred_level = + app_impl->deferred_resumption_hmi_level(); + EXPECT_EQ(HMILevel::eType::INVALID_ENUM, initial_deferred_level); + + HMILevel::eType deferred_level = HMILevel::eType::HMI_FULL; + app_impl->set_deferred_resumption_hmi_level(deferred_level); + + EXPECT_EQ(deferred_level, app_impl->deferred_resumption_hmi_level()); +} + } // namespace application_manager_test } // namespace components } // namespace test |