summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Oleynik <aoleynik@luxoft.com>2016-06-08 14:49:20 +0300
committerAndrey Oleynik <aoleynik@luxoft.com>2016-06-08 17:10:07 +0300
commit47546cc229f2d3fd3ac3db49f5959d7c4ffb93c6 (patch)
treeee4058daad8c2fcbf8bf2e16512a7bf98ef3b895
parentea1dccded1642bda2c48b2a491c4409d91ca0f22 (diff)
downloadsdl_core-47546cc229f2d3fd3ac3db49f5959d7c4ffb93c6.tar.gz
Enables TM unit tests
Related-issues: APPLINK-22713, APPLINK-22716
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_device.h2
-rw-r--r--src/components/transport_manager/test/tcp_transport_adapter_test.cc11
-rw-r--r--src/components/transport_manager/test/transport_manager_default_test.cc3
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc19
4 files changed, 15 insertions, 20 deletions
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
index 5b9644ec01..149a8b2c3f 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
@@ -101,7 +101,7 @@ class TcpDevice : public Device {
*
* @return Application's port No. Or -1 if application is not found.
*/
- int GetApplicationPort(const ApplicationHandle app_handle) const;
+ virtual int GetApplicationPort(const ApplicationHandle app_handle) const;
/**
* @brief Return address.
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 0a47e6aa03..183d6c7ad7 100644
--- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc
+++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
@@ -71,7 +71,7 @@ class TcpAdapterTest : public ::testing::Test {
const utils::HostAddress host_address;
};
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDeviceAndOneApplication) {
+TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
// Prepare
MockTCPTransportAdapter transport_adapter(
port, last_state_, transport_manager_settings);
@@ -113,7 +113,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDeviceAndOneApplication) {
EXPECT_EQ(uniq_id, tcp_dict["devices"][index]["name"].AsString());
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevicesAndOneApplication) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
// Prepare
MockTCPTransportAdapter transport_adapter(
port, last_state_, transport_manager_settings);
@@ -167,8 +167,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevicesAndOneApplication) {
}
}
-TEST_F(TcpAdapterTest,
- DISABLED_StoreDataWithSeveralDevicesAndSeveralApplications) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
// Prepare
MockTCPTransportAdapter transport_adapter(
port, last_state_, transport_manager_settings);
@@ -269,7 +268,7 @@ TEST_F(TcpAdapterTest, RestoreData_DataNotStored) {
EXPECT_TRUE(transport_adapter.CallRestore());
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDevice_RestoreData) {
+TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) {
MockTCPTransportAdapter transport_adapter(
port, last_state_, transport_manager_settings);
std::string uniq_id = "unique_device_name";
@@ -304,7 +303,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDevice_RestoreData) {
EXPECT_EQ(uniq_id, devList[0]);
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevices_RestoreData) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) {
MockTCPTransportAdapter transport_adapter(
port, last_state_, transport_manager_settings);
const uint32_t count_dev = 10;
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 901f7168bf..672e48e8ce 100644
--- a/src/components/transport_manager/test/transport_manager_default_test.cc
+++ b/src/components/transport_manager/test/transport_manager_default_test.cc
@@ -41,8 +41,7 @@ namespace components {
namespace transport_manager_test {
using ::testing::Return;
-// TODO(OHerasym) : Sometimes deadlock
-TEST(TestTransportManagerDefault, DISABLED_Init_LastStateNotUsed) {
+TEST(TestTransportManagerDefault, Init_LastStateNotUsed) {
MockTransportManagerSettings transport_manager_settings;
transport_manager::TransportManagerDefault transport_manager(
transport_manager_settings);
diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index 4608575260..270688bf79 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -86,6 +86,8 @@ class TransportManagerImplTest : public ::testing::Test {
EXPECT_CALL(*mock_adapter_, AddListener(_));
EXPECT_CALL(*mock_adapter_, IsInitialised()).WillOnce(Return(true));
EXPECT_EQ(E_SUCCESS, tm_.AddTransportAdapter(mock_adapter_));
+ EXPECT_CALL(*mock_adapter_, GetDeviceType())
+ .WillRepeatedly(Return(transport_adapter::DeviceType::BLUETOOTH));
connection_key_ = 1;
error_ = MakeShared<BaseError>();
@@ -469,8 +471,7 @@ TEST_F(TransportManagerImplTest, SearchDevices_DeviceConnected) {
HandleSearchDone();
}
-// TODO(OHerasym): exception in SearchDevices method
-TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_DeviceNotFound) {
+TEST_F(TransportManagerImplTest, SearchDevices_DeviceNotFound) {
HandleDeviceListUpdated();
EXPECT_CALL(*mock_adapter_, SearchDevices())
@@ -478,8 +479,7 @@ TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_DeviceNotFound) {
EXPECT_EQ(E_ADAPTERS_FAIL, tm_.SearchDevices());
}
-// TODO(OHerasym): exception in SearchDevices method
-TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_AdapterNotSupported) {
+TEST_F(TransportManagerImplTest, SearchDevices_AdapterNotSupported) {
HandleDeviceListUpdated();
EXPECT_CALL(*mock_adapter_, SearchDevices())
@@ -487,8 +487,7 @@ TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_AdapterNotSupported) {
EXPECT_EQ(E_ADAPTERS_FAIL, tm_.SearchDevices());
}
-// TODO(OHerasym): exception in SearchDevices method
-TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_AdapterWithBadState) {
+TEST_F(TransportManagerImplTest, SearchDevices_AdapterWithBadState) {
HandleDeviceListUpdated();
EXPECT_CALL(*mock_adapter_, SearchDevices())
@@ -496,8 +495,7 @@ TEST_F(TransportManagerImplTest, DISABLED_SearchDevices_AdapterWithBadState) {
EXPECT_EQ(E_ADAPTERS_FAIL, tm_.SearchDevices());
}
-// TODO(OHerasym): exception in SendMessageToDevice method
-TEST_F(TransportManagerImplTest, DISABLED_SendMessageToDevice) {
+TEST_F(TransportManagerImplTest, SendMessageToDevice) {
// Arrange
HandleConnection();
@@ -901,15 +899,14 @@ TEST_F(TransportManagerImplTest, SearchDevices_TMIsNotInitialized) {
EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, tm_.SearchDevices());
}
-TEST_F(TransportManagerImplTest,
- DISABLED_SetVisibilityOn_TransportAdapterNotSupported) {
+TEST_F(TransportManagerImplTest, SetVisibilityOn_TransportAdapterNotSupported) {
EXPECT_CALL(*mock_adapter_, StartClientListening())
.WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
EXPECT_EQ(E_SUCCESS, tm_.Visibility(true));
}
TEST_F(TransportManagerImplTest,
- DISABLED_SetVisibilityOff_TransportAdapterNotSupported) {
+ SetVisibilityOff_TransportAdapterNotSupported) {
EXPECT_CALL(*mock_adapter_, StopClientListening())
.WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
EXPECT_EQ(E_SUCCESS, tm_.Visibility(false));