summaryrefslogtreecommitdiff
path: root/src/components/application_manager/test/application_impl_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/test/application_impl_test.cc')
-rw-r--r--src/components/application_manager/test/application_impl_test.cc62
1 files changed, 45 insertions, 17 deletions
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 6b7f78b8f7..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);
@@ -179,7 +184,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetCurrentState) {
HmiState::STATE_ID_REGULAR,
&ApplicationImpl::SetRegularState);
TestAddHmiState(HMILevel::HMI_LIMITED,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
CheckCurrentHMIState();
@@ -191,7 +196,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) {
HmiState::STATE_ID_REGULAR,
&ApplicationImpl::SetRegularState);
TestAddHmiState(HMILevel::HMI_LIMITED,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
HmiStatePtr current_state = app_impl->RegularHmiState();
@@ -206,7 +211,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
HmiState::STATE_ID_PHONE_CALL,
&ApplicationImpl::AddHMIState);
HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_NONE,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
HmiState::STATE_ID_TTS_SESSION,
@@ -219,7 +224,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
HmiStatePtr current_state = app_impl->CurrentHmiState();
EXPECT_EQ(state2, current_state);
EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level());
- EXPECT_EQ(HmiState::STATE_ID_NAVI_STREAMING, current_state->state_id());
+ EXPECT_EQ(HmiState::STATE_ID_VIDEO_STREAMING, current_state->state_id());
}
TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
@@ -227,7 +232,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
HmiState::STATE_ID_PHONE_CALL,
&ApplicationImpl::AddHMIState);
HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_NONE,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
HmiState::STATE_ID_TTS_SESSION,
@@ -251,7 +256,7 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
&ApplicationImpl::AddHMIState);
// Second state
TestAddHmiState(HMILevel::HMI_NONE,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
HmiStatePtr state3 = TestAddHmiState(HMILevel::HMI_LIMITED,
HmiState::STATE_ID_TTS_SESSION,
@@ -265,12 +270,12 @@ 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) {
HmiStatePtr state1 = TestAddHmiState(HMILevel::HMI_NONE,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
// Set regular state
HmiStatePtr state2 = TestAddHmiState(HMILevel::HMI_FULL,
@@ -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) {
@@ -321,7 +326,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
audiostate = AudioStreamingState::AUDIBLE;
syst_context = SystemContext::SYSCTXT_MENU;
TestAddHmiState(HMILevel::HMI_LIMITED,
- HmiState::STATE_ID_NAVI_STREAMING,
+ HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
EXPECT_EQ(test_lvl, app_impl->hmi_level());
@@ -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