summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ronneburg <fronneburg@xevo.com>2018-04-12 07:36:02 +0900
committerfronneburg <fronneburg@xevo.com>2018-04-11 17:03:27 -0700
commite0caccd349cd66a21508c00bcfab8f288d688d86 (patch)
tree2147dcb99c82ad8769496089b4958ed4d68d9518
parent4bc109858e8f16c3b37eab3b766976d6039dbf09 (diff)
downloadsdl_core-e0caccd349cd66a21508c00bcfab8f288d688d86.tar.gz
Merge pull request #236 in NAR/sdl-core from fix/build_errors_in_tests to feature/Ford-WiFi
* commit 'd529b059e47f170c77137ac1edf10c0696a7bb6b': fallout from other changes in the Ford-WiFi branch revert device_type hacks revert device_type hacks UT: support newly added Application::deferred_resumption_hmi_level() UT: support newly added ApplicationManager::CheckResumptionRequiredTransportAvailable() UT: update test cases to support new protocol frames UT: fix CheckStringContainer() test case UT: fix test case TcpClientListenerTest IsInitialised UT: support newly added TransportAdapter::GetDeviceType() UT: support newly added transport_manager_tcp_adapter_network_interface() method Remove invalid test cases Add/fix mock methods for testing Update test code to add new arg in Connection::AddNewSession() and AddNewService() Update test code related to SessionContext struct Update test codes related to SendEndService() Update DeviceInfo struct in test codes Add mock methods for testing
-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_message_helper.h6
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc10
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc9
-rw-r--r--src/components/config_profile/test/profile_test.cc23
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc4
-rw-r--r--src/components/connection_handler/test/connection_test.cc19
-rw-r--r--src/components/connection_handler/test/heart_beat_monitor_test.cc19
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h5
-rw-r--r--src/components/include/test/application_manager/mock_application_manager_settings.h5
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h19
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_observer.h5
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h9
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler_settings.h11
-rw-r--r--src/components/include/test/protocol_handler/mock_session_observer.h4
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_listener.h2
-rw-r--r--src/components/include/test/transport_manager/mock_transport_manager_settings.h2
-rw-r--r--src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h2
-rw-r--r--src/components/protocol_handler/test/incoming_data_handler_test.cc8
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc4
-rw-r--r--src/components/protocol_handler/test/protocol_header_validator_test.cc8
-rw-r--r--src/components/remote_control/test/include/mock_application.h7
-rw-r--r--src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h2
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc6
-rw-r--r--src/components/transport_manager/test/tcp_transport_adapter_test.cc8
-rw-r--r--src/components/transport_manager/test/transport_manager_default_test.cc12
26 files changed, 156 insertions, 57 deletions
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 ec707c7a76..5bb41181fe 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
@@ -139,9 +139,9 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_is_resuming, void(bool));
MOCK_CONST_METHOD0(is_resuming, bool());
MOCK_METHOD1(set_deferred_resumption_hmi_level,
- void(mobile_api::HMILevel::eType level));
+ void(application_manager::mobile_api::HMILevel::eType level));
MOCK_CONST_METHOD0(deferred_resumption_hmi_level,
- mobile_api::HMILevel::eType());
+ 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));
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 93db0d9795..359005859a 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
@@ -225,6 +225,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,
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 24bba63e71..4d33b3046f 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -418,6 +418,16 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI(
->SendUIChangeRegistrationRequestToHMI(app, app_mngr);
}
+bool MessageHelper::CreateDeviceInfo(
+ connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer,
+ const policy::PolicyHandlerInterface& policy_handler,
+ ApplicationManager& app_mngr,
+ smart_objects::SmartObject* output) {
+ return MockMessageHelper::message_helper_mock()->CreateDeviceInfo(
+ device_handle, session_observer, policy_handler, app_mngr, output);
+}
+
bool MessageHelper::CreateHMIApplicationStruct(
ApplicationConstSharedPtr app,
const protocol_handler::SessionObserver& session_observer,
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 85801d7e73..2db147d2c1 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -80,7 +80,8 @@ class ResumeCtrlTest : public ::testing::Test {
, kTestGrammarId_(10)
, kHash_("saved_hash")
, kAppResumingTimeout_(30000u) // miliseconds
- , kTestTimeStamp_(1452074434u) {}
+ , kTestTimeStamp_(1452074434u)
+ , kDefaultDeferredTestLevel_(eType::INVALID_ENUM) {}
virtual void SetUp() OVERRIDE {
Mock::VerifyAndClearExpectations(&app_mngr_);
@@ -99,11 +100,16 @@ class ResumeCtrlTest : public ::testing::Test {
.WillByDefault(ReturnRef(state_controller_));
ON_CALL(app_mngr_, get_settings())
.WillByDefault(ReturnRef(mock_application_manager_settings_));
+ ON_CALL(app_mngr_, CheckResumptionRequiredTransportAvailable(_))
+ .WillByDefault(Return(true));
ON_CALL(mock_application_manager_settings_, use_db_for_resumption())
.WillByDefault(Return(false));
ON_CALL(mock_application_manager_settings_, app_resuming_timeout())
.WillByDefault(ReturnRef(kAppResumingTimeout_));
+
+ ON_CALL(*app_mock_, deferred_resumption_hmi_level())
+ .WillByDefault(Return(kDefaultDeferredTestLevel_));
}
void TearDown() OVERRIDE {
Mock::VerifyAndClearExpectations(&app_mngr_);
@@ -137,6 +143,7 @@ class ResumeCtrlTest : public ::testing::Test {
const uint32_t kAppResumingTimeout_;
const uint32_t kTestTimeStamp_;
sync_primitives::Lock app_set_lock_;
+ const mobile_apis::HMILevel::eType kDefaultDeferredTestLevel_;
};
/**
diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc
index f1527c996b..64bafdd6bf 100644
--- a/src/components/config_profile/test/profile_test.cc
+++ b/src/components/config_profile/test/profile_test.cc
@@ -690,7 +690,7 @@ TEST_F(ProfileTest, CheckStringContainer) {
std::vector<std::string>::iterator element_mode = diagmodes_list.begin();
element_mode++;
element_mode++;
- diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), " 0x03");
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x03");
EXPECT_EQ(diag_mode, element_mode);
}
@@ -748,27 +748,6 @@ TEST_F(ProfileTest, CheckIntContainerInSecurityData) {
}
#endif
-TEST_F(ProfileTest, CheckEmptyValue) {
- // Set new config file
- profile_.set_config_file_name("smartDeviceLink_test.ini");
- EXPECT_EQ("smartDeviceLink_test.ini", profile_.config_file_name());
-
- bool isread = false;
- std::string output;
-
- // specify a key with empty value
- bool ret = profile_.ReadValue(&output, "MAIN", "AppConfigFolder");
- EXPECT_FALSE(ret);
-
- std::string output2 = "abc";
- ret = profile_.ReadValueEmpty(&output2, "MAIN", "AppConfigFolder");
- EXPECT_TRUE(ret);
- EXPECT_EQ(output2, "");
-
- ret = profile_.ReadValueEmpty(&output2, "MAIN", "DoesNotExistKey");
- EXPECT_FALSE(ret);
-}
-
} // namespace profile_test
} // namespace components
} // namespace test
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc
index d0b9ce4ae4..0de5ff9563 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -518,7 +518,7 @@ MATCHER_P(SameDevice, device, "") {
TEST_F(ConnectionHandlerTest, SendEndServiceWithoutSetProtocolHandler) {
AddTestDeviceConnection();
AddTestSession();
- EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, kRpc)).Times(0);
+ EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, _, kRpc)).Times(0);
connection_handler_->SendEndService(connection_key_, kRpc);
}
@@ -526,7 +526,7 @@ TEST_F(ConnectionHandlerTest, SendEndService) {
AddTestDeviceConnection();
AddTestSession();
connection_handler_->set_protocol_handler(&mock_protocol_handler_);
- EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, kRpc));
+ EXPECT_CALL(mock_protocol_handler_, SendEndService(_, _, _, kRpc));
connection_handler_->SendEndService(connection_key_, kRpc);
}
diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc
index de21dd1e97..593c05fb33 100644
--- a/src/components/connection_handler/test/connection_test.cc
+++ b/src/components/connection_handler/test/connection_test.cc
@@ -78,7 +78,7 @@ class ConnectionTest : public ::testing::Test {
session_id, protocol_handler::PROTOCOL_VERSION_3);
}
void StartDefaultSession() {
- session_id = connection_->AddNewSession();
+ session_id = connection_->AddNewSession(kDefaultConnectionHandle);
EXPECT_NE(session_id, 0u);
const SessionMap sessionMap = connection_->session_map();
EXPECT_FALSE(sessionMap.empty());
@@ -93,8 +93,8 @@ class ConnectionTest : public ::testing::Test {
const bool protection,
const bool expect_add_new_service_call_result,
const bool expect_exist_service) {
- const bool result =
- connection_->AddNewService(session_id, service_type, protection);
+ const bool result = connection_->AddNewService(
+ session_id, service_type, protection, kDefaultConnectionHandle);
EXPECT_EQ(result, expect_add_new_service_call_result);
#ifdef ENABLE_SECURITY
@@ -141,6 +141,7 @@ class ConnectionTest : public ::testing::Test {
transport_manager_mock;
ConnectionHandlerImpl* connection_handler_;
uint32_t session_id;
+ static const transport_manager::ConnectionUID kDefaultConnectionHandle = 1;
};
TEST_F(ConnectionTest, Session_TryGetProtocolVersionWithoutSession) {
@@ -236,13 +237,17 @@ TEST_F(ConnectionTest, HeartBeat_Protocol5_ZeroHeartBeat_NotSupported) {
// Try to add service without session
TEST_F(ConnectionTest, Session_AddNewServiceWithoutSession) {
- EXPECT_EQ(connection_->AddNewService(session_id, kAudio, true),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kAudio, true, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kAudio, false),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kAudio, false, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, true),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kMobileNav, true, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, false),
+ EXPECT_EQ(connection_->AddNewService(
+ session_id, kMobileNav, false, kDefaultConnectionHandle),
EXPECT_RETURN_FALSE);
}
diff --git a/src/components/connection_handler/test/heart_beat_monitor_test.cc b/src/components/connection_handler/test/heart_beat_monitor_test.cc
index 4c67c97191..47f6b2edfe 100644
--- a/src/components/connection_handler/test/heart_beat_monitor_test.cc
+++ b/src/components/connection_handler/test/heart_beat_monitor_test.cc
@@ -64,6 +64,7 @@ class HeartBeatMonitorTest : public testing::Test {
uint32_t kTimeout;
static const connection_handler::ConnectionHandle kConnectionHandle =
0xABCDEF;
+ static const transport_manager::ConnectionUID kDefaultConnectionHandle = 1;
virtual void SetUp() {
conn = new connection_handler::Connection(
@@ -85,7 +86,7 @@ TEST_F(HeartBeatMonitorTest, TimerNotStarted) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
- conn->AddNewSession();
+ conn->AddNewSession(kDefaultConnectionHandle);
}
TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
@@ -93,12 +94,12 @@ TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
- const uint32_t session = conn->AddNewSession();
+ const uint32_t session = conn->AddNewSession(kDefaultConnectionHandle);
conn->StartHeartBeat(session);
}
TEST_F(HeartBeatMonitorTest, TimerElapsed) {
- const uint32_t session = conn->AddNewSession();
+ const uint32_t session = conn->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
@@ -125,7 +126,7 @@ TEST_F(HeartBeatMonitorTest, KeptAlive) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
- const uint32_t session = conn->AddNewSession();
+ const uint32_t session = conn->AddNewSession(kDefaultConnectionHandle);
conn->StartHeartBeat(session);
usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
conn->KeepAlive(session);
@@ -137,7 +138,7 @@ TEST_F(HeartBeatMonitorTest, KeptAlive) {
}
TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
- const uint32_t session = conn->AddNewSession();
+ const uint32_t session = conn->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
@@ -167,8 +168,8 @@ TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
}
TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
- const uint32_t kSession1 = conn->AddNewSession();
- const uint32_t kSession2 = conn->AddNewSession();
+ const uint32_t kSession1 = conn->AddNewSession(kDefaultConnectionHandle);
+ const uint32_t kSession2 = conn->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
@@ -199,7 +200,7 @@ TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
}
TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
- const uint32_t kSession = conn->AddNewSession();
+ const uint32_t kSession = conn->AddNewSession(kDefaultConnectionHandle);
EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
@@ -211,7 +212,7 @@ TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
}
TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
- const uint32_t kSession = conn->AddNewSession();
+ const uint32_t kSession = conn->AddNewSession(kDefaultConnectionHandle);
TestAsyncWaiter waiter;
uint32_t times = 0;
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index 3d97279b39..9ce2b3d5cb 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -143,8 +143,9 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_METHOD0(hmi_capabilities, application_manager::HMICapabilities&());
MOCK_CONST_METHOD0(hmi_capabilities,
const application_manager::HMICapabilities&());
- MOCK_CONST_METHOD1(CheckResumptionRequiredTransportAvailable,
- bool(ApplicationConstSharedPtr application));
+ MOCK_CONST_METHOD1(
+ CheckResumptionRequiredTransportAvailable,
+ bool(application_manager::ApplicationConstSharedPtr application));
MOCK_METHOD2(ProcessQueryApp,
void(const smart_objects::SmartObject& sm_object,
const uint32_t connection_key));
diff --git a/src/components/include/test/application_manager/mock_application_manager_settings.h b/src/components/include/test/application_manager/mock_application_manager_settings.h
index 25cf994566..825beff8bb 100644
--- a/src/components/include/test/application_manager/mock_application_manager_settings.h
+++ b/src/components/include/test/application_manager/mock_application_manager_settings.h
@@ -95,6 +95,11 @@ class MockApplicationManagerSettings
MOCK_CONST_METHOD0(app_resuming_timeout, const uint32_t&());
MOCK_CONST_METHOD0(attempts_to_open_resumption_db, uint16_t());
MOCK_CONST_METHOD0(open_attempt_timeout_ms_resumption_db, uint16_t());
+ MOCK_CONST_METHOD0(transport_required_for_resumption_map,
+ std::map<std::string, std::vector<std::string> >&());
+ MOCK_CONST_METHOD0(navigation_lowbandwidth_resumption_level, std::string&());
+ MOCK_CONST_METHOD0(projection_lowbandwidth_resumption_level, std::string&());
+ MOCK_CONST_METHOD0(mediaapp_lowbandwidth_resumption_level, std::string&());
MOCK_METHOD1(set_config_file_name, void(const std::string& fileName));
// The following line won't really compile, as the return
// type has multiple template arguments. To fix it, use a
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
index f1416c999e..003c06457c 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -51,6 +51,7 @@ using connection_handler::ConnectionHandle;
using connection_handler::DeviceHandle;
using connection_handler::CloseSessionReason;
using connection_handler::DevicesDiscoveryStarter;
+using connection_handler::SessionTransports;
class MockConnectionHandler : public connection_handler::ConnectionHandler {
public:
@@ -103,10 +104,28 @@ class MockConnectionHandler : public connection_handler::ConnectionHandler {
MOCK_METHOD0(get_device_discovery_starter, DevicesDiscoveryStarter&());
MOCK_CONST_METHOD1(GetConnectedDevicesMAC,
void(std::vector<std::string>& macs));
+ MOCK_METHOD0(
+ session_connection_map,
+ NonConstDataAccessor<connection_handler::SessionConnectionMap>());
+ MOCK_METHOD2(SetSecondaryTransportID,
+ SessionTransports(
+ uint8_t session_id,
+ transport_manager::ConnectionUID secondary_transport_id));
+ MOCK_CONST_METHOD1(GetSessionTransports,
+ const SessionTransports(uint8_t session_id));
MOCK_METHOD3(NotifyServiceStartedResult,
void(uint32_t session_key,
bool result,
std::vector<std::string>& rejected_params));
+ MOCK_METHOD3(
+ OnSecondaryTransportStarted,
+ bool(transport_manager::ConnectionUID& primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle,
+ const uint8_t session_id));
+ MOCK_METHOD2(
+ OnSecondaryTransportEnded,
+ void(const transport_manager::ConnectionUID primary_connection_handle,
+ const transport_manager::ConnectionUID secondary_connection_handle));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/connection_handler/mock_connection_handler_observer.h b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
index a96498028d..ede08a9a4a 100644
--- a/src/components/include/test/connection_handler/mock_connection_handler_observer.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler_observer.h
@@ -74,6 +74,11 @@ class MockConnectionHandlerObserver
const connection_handler::Device& device_to));
MOCK_METHOD1(OnDeviceSwitchingFinish, void(const std::string& device_uid));
MOCK_CONST_METHOD1(CheckAppIsNavi, bool(const uint32_t app_id));
+ MOCK_METHOD2(OnSecondaryTransportStartedCallback,
+ void(const connection_handler::DeviceHandle device_handle,
+ const int32_t session_key));
+ MOCK_METHOD1(OnSecondaryTransportEndedCallback,
+ void(const int32_t session_key));
};
} // namespace connection_handler_test
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
index 79c2188cdf..06ebc3a448 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -55,10 +55,15 @@ class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
void(uint32_t connection_key, int32_t number_of_frames));
MOCK_METHOD2(SendHeartBeat, void(int32_t connection_id, uint8_t session_id));
MOCK_METHOD2(SendEndSession, void(int32_t connection_id, uint8_t session_id));
- MOCK_METHOD3(SendEndService,
- void(int32_t connection_id,
+ MOCK_METHOD4(SendEndService,
+ void(int32_t primary_connection_id,
+ int32_t connection_id,
uint8_t session_id,
uint8_t service_type));
+ DEPRECATED MOCK_METHOD3(SendEndService,
+ void(int32_t connection_id,
+ uint8_t session_id,
+ uint8_t service_type));
MOCK_CONST_METHOD0(get_settings,
const ::protocol_handler::ProtocolHandlerSettings&());
MOCK_METHOD0(get_session_observer, protocol_handler::SessionObserver&());
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
index 8ddeded889..2ed9c47e9d 100644
--- a/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
@@ -60,6 +60,17 @@ class MockProtocolHandlerSettings
MOCK_CONST_METHOD0(force_protected_service, const std::vector<int>&());
MOCK_CONST_METHOD0(force_unprotected_service, const std::vector<int>&());
#endif
+ MOCK_CONST_METHOD0(multiple_transports_enabled, const bool());
+ MOCK_CONST_METHOD0(secondary_transports_for_bluetooth,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(secondary_transports_for_usb,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(secondary_transports_for_wifi,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(audio_service_transports,
+ const std::vector<std::string>&());
+ MOCK_CONST_METHOD0(video_service_transports,
+ const std::vector<std::string>&());
};
} // namespace protocol_handler_test
diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h
index ae32f35948..74e6d79c96 100644
--- a/src/components/include/test/protocol_handler/mock_session_observer.h
+++ b/src/components/include/test/protocol_handler/mock_session_observer.h
@@ -76,6 +76,10 @@ class MockSessionObserver : public ::protocol_handler::SessionObserver {
void(const uint32_t& connection_key));
MOCK_METHOD1(OnMalformedMessageCallback,
void(const uint32_t& connection_key));
+ MOCK_CONST_METHOD1(connection_type,
+ std::string(
+ transport_manager::ConnectionUID connection_handle));
+
MOCK_CONST_METHOD2(
KeyFromPair,
uint32_t(transport_manager::ConnectionUID connection_handle,
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_listener.h b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
index f4c4fdcf68..133dabe732 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_listener.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_listener.h
@@ -85,6 +85,8 @@ class MockTransportManagerListener : public TransportManagerListener {
void(const DeviceUID& device_uid_from,
const DeviceUID& device_uid_to));
MOCK_METHOD1(OnDeviceSwitchingFinish, void(const DeviceUID& device_uid));
+ MOCK_METHOD1(OnTransportConfigUpdated,
+ void(const std::map<std::string, std::string>& configs));
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/mock_transport_manager_settings.h b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
index 88112df003..3e7c8f36f7 100644
--- a/src/components/include/test/transport_manager/mock_transport_manager_settings.h
+++ b/src/components/include/test/transport_manager/mock_transport_manager_settings.h
@@ -61,6 +61,8 @@ class MockTransportManagerSettings
MOCK_CONST_METHOD0(iap_hub_connection_wait_timeout, uint32_t());
MOCK_CONST_METHOD0(app_transport_change_timer, uint32_t());
MOCK_CONST_METHOD0(app_transport_change_timer_addition, uint32_t());
+ MOCK_CONST_METHOD0(transport_manager_tcp_adapter_network_interface,
+ std::string&());
};
} // namespace transport_manager_test
diff --git a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
index c37c41d4f8..eff0abdcd3 100644
--- a/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
+++ b/src/components/include/test/transport_manager/transport_adapter/mock_transport_adapter.h
@@ -103,6 +103,8 @@ class MockTransportAdapter
void(const ::transport_manager::DeviceUID& device_handle));
MOCK_CONST_METHOD0(GetSwitchableDevices,
transport_manager::SwitchableDevices());
+ MOCK_CONST_METHOD0(GetTransportConfiguration,
+ transport_manager::transport_adapter::TransportConfig());
#ifdef TELEMETRY_MONITOR
MOCK_METHOD0(GetTelemetryObserver,
::transport_manager::TMTelemetryObserver*());
diff --git a/src/components/protocol_handler/test/incoming_data_handler_test.cc b/src/components/protocol_handler/test/incoming_data_handler_test.cc
index d0a311583c..393579927c 100644
--- a/src/components/protocol_handler/test/incoming_data_handler_test.cc
+++ b/src/components/protocol_handler/test/incoming_data_handler_test.cc
@@ -393,13 +393,13 @@ TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) {
}
}
-// For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data
-// Ack), 0xFF(HB Ack)
+// For Control frames Frame info value shall be from 0x00 to 0x09 or 0xFD
+// (Transport Update Event), 0xFE(Data Ack), 0xFF(HB Ack)
TEST_F(IncomingDataHandlerTest, MalformedPacket_ControlFrame) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_data;
- for (uint8_t frame_type = FRAME_DATA_END_SERVICE_NACK + 1;
- frame_type < FRAME_DATA_SERVICE_DATA_ACK;
+ for (uint8_t frame_type = FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK + 1;
+ frame_type < FRAME_DATA_TRANSPORT_EVENT_UPDATE;
++frame_type) {
malformed_frame_data.push_back(frame_type);
}
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index 77de1705da..52897b4162 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -209,6 +209,7 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const uint32_t hash_id,
const bool protection_flag) {
return protocol_handler::SessionContext(connection_id,
+ connection_id,
initial_session_id,
new_session_id,
service_type,
@@ -1955,7 +1956,8 @@ TEST_F(ProtocolHandlerImplTest,
times++;
// Act
- protocol_handler_impl->SendEndService(connection_id, session_id, kControl);
+ protocol_handler_impl->SendEndService(
+ connection_id, connection_id, session_id, kControl);
EXPECT_TRUE(waiter->WaitFor(times, kAsyncExpectationsTimeout));
}
diff --git a/src/components/protocol_handler/test/protocol_header_validator_test.cc b/src/components/protocol_handler/test/protocol_header_validator_test.cc
index e42ba96251..5554bfd280 100644
--- a/src/components/protocol_handler/test/protocol_header_validator_test.cc
+++ b/src/components/protocol_handler/test/protocol_header_validator_test.cc
@@ -230,12 +230,12 @@ TEST_F(ProtocolHeaderValidatorTest, Malformed_FrameType) {
}
}
-// For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data
-// Ack), 0xFF(HB Ack)
+// For Control frames Frame info value shall be from 0x00 to 0x09 or 0xFD
+// (Transport Update Event), 0xFE(Data Ack), 0xFF(HB Ack)
TEST_F(ProtocolHeaderValidatorTest, Malformed_ControlFrame) {
std::vector<uint8_t> malformed_frame_data;
- for (uint8_t frame_type = FRAME_DATA_END_SERVICE_NACK + 1;
- frame_type < FRAME_DATA_SERVICE_DATA_ACK;
+ for (uint8_t frame_type = FRAME_DATA_REGISTER_SECONDARY_TRANSPORT_NACK + 1;
+ frame_type < FRAME_DATA_TRANSPORT_EVENT_UPDATE;
++frame_type) {
malformed_frame_data.push_back(frame_type);
}
diff --git a/src/components/remote_control/test/include/mock_application.h b/src/components/remote_control/test/include/mock_application.h
index a46b48673d..5be645b21f 100644
--- a/src/components/remote_control/test/include/mock_application.h
+++ b/src/components/remote_control/test/include/mock_application.h
@@ -115,6 +115,7 @@ class MockApplication : public ::application_manager::Application {
const mobile_apis::AudioStreamingState::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(PostponedHmiState,
@@ -133,6 +134,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(
@@ -142,6 +145,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(mobile_api::HMILevel::eType level));
+ MOCK_CONST_METHOD0(deferred_resumption_hmi_level,
+ 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));
diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
index 03e7630e8b..dce23189c8 100644
--- a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
+++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_listener.h
@@ -122,6 +122,8 @@ class MockTransportAdapterListener : public TransportAdapterListener {
const ApplicationHandle&));
MOCK_METHOD1(OnTransportSwitchRequested,
void(const TransportAdapter* transport_adapter));
+ MOCK_METHOD1(OnTransportConfigUpdated,
+ void(const TransportAdapter* transport_adapter));
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc
index b179f63ece..ca85b89fa9 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -95,6 +95,9 @@ class MockTransportAdapterController : public TransportAdapterController {
MOCK_METHOD2(DeviceDisconnected,
void(const DeviceUID& device_handle,
const DisconnectDeviceError& error));
+ MOCK_METHOD1(TransportConfigUpdated,
+ void(const transport_manager::transport_adapter::TransportConfig&
+ new_config));
};
class TcpClientListenerTest : public ::testing::Test {
@@ -119,7 +122,8 @@ TEST_F(TcpClientListenerTest, Ctor_test) {
}
TEST_F(TcpClientListenerTest, IsInitialised) {
- EXPECT_TRUE(tcp_client_listener_.IsInitialised());
+ // should return false until Init() is called
+ EXPECT_FALSE(tcp_client_listener_.IsInitialised());
}
TEST_F(TcpClientListenerTest, Init) {
diff --git a/src/components/transport_manager/test/tcp_transport_adapter_test.cc b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
index dd587569d3..5bd5b96954 100644
--- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc
+++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
@@ -48,6 +48,7 @@ namespace components {
namespace transport_manager_test {
using ::testing::Return;
+using ::testing::ReturnRef;
using ::testing::_;
using namespace ::protocol_handler;
@@ -61,6 +62,13 @@ class TcpAdapterTest : public ::testing::Test {
resumption::LastStateImpl last_state_;
const uint32_t port = 12345;
const std::string string_port = "12345";
+ std::string network_interface = "";
+
+ void SetUp() OVERRIDE {
+ EXPECT_CALL(transport_manager_settings,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface));
+ }
};
TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
diff --git a/src/components/transport_manager/test/transport_manager_default_test.cc b/src/components/transport_manager/test/transport_manager_default_test.cc
index d095a51cb6..8e8a964228 100644
--- a/src/components/transport_manager/test/transport_manager_default_test.cc
+++ b/src/components/transport_manager/test/transport_manager_default_test.cc
@@ -74,6 +74,10 @@ TEST(TestTransportManagerDefault, Init_LastStateNotUsed) {
.WillRepeatedly(Return(false));
EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
.WillRepeatedly(Return(12345u));
+ std::string network_interface = "";
+ EXPECT_CALL(transport_manager_settings,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface));
transport_manager.Init(mock_last_state);
transport_manager.Stop();
@@ -106,6 +110,10 @@ TEST(TestTransportManagerDefault, Init_LastStateUsed) {
.WillRepeatedly(Return(true));
EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
.WillRepeatedly(Return(12345u));
+ std::string network_interface = "";
+ EXPECT_CALL(transport_manager_settings,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface));
transport_manager.Init(mock_last_state);
transport_manager.Stop();
}
@@ -137,6 +145,10 @@ TEST(TestTransportManagerDefault, Init_LastStateUsed_InvalidPort) {
.WillRepeatedly(Return(true));
EXPECT_CALL(transport_manager_settings, transport_manager_tcp_adapter_port())
.WillRepeatedly(Return(1u));
+ std::string network_interface = "";
+ EXPECT_CALL(transport_manager_settings,
+ transport_manager_tcp_adapter_network_interface())
+ .WillRepeatedly(ReturnRef(network_interface));
transport_manager.Init(mock_last_state);
transport_manager.Stop();
}