diff options
Diffstat (limited to 'src/components/transport_manager/test/include')
25 files changed, 464 insertions, 802 deletions
diff --git a/src/components/transport_manager/test/include/mock_application.h b/src/components/transport_manager/test/include/mock_application.h deleted file mode 100644 index 7ec71ebb1e..0000000000 --- a/src/components/transport_manager/test/include/mock_application.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * mock_application.h - * - * Copyright (c) 2013, 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 MOCK_APPLICATION_H_ -#define MOCK_APPLICATION_H_ - -#include <pthread.h> - -#include <sstream> -#include <string> - -#include <transport_manager/common.h> -#include <transport_manager/transport_manager.h> -#include <transport_manager/transport_adapter/transport_adapter_impl.h> -#include <transport_manager/transport_manager_impl.h> -#include "mock_device_scanner.h" - -namespace test { -namespace components { -namespace transport_manager { - -class MockDevice; -using ::transport_manager::ApplicationHandle; - -class MockApplication { - public: - const MockDevice *device; - ApplicationHandle handle; - pthread_t workerThread; - pthread_cond_t ready_cond; - pthread_mutex_t ready_mutex; - int sockfd; - bool active; - private: - std::string socket_name_; - public: - MockApplication(const MockDevice* device, ApplicationHandle id); - void Start(); - void Stop(); - const std::string &socket_name() const { - return socket_name_; - } -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* MOCK_APPLICATION_H_ */ diff --git a/src/components/transport_manager/test/include/mock_connection.h b/src/components/transport_manager/test/include/mock_connection.h deleted file mode 100644 index 8f67107065..0000000000 --- a/src/components/transport_manager/test/include/mock_connection.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * \file mock_connection.h - * \brief - * - * Copyright (c) 2013, 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_ -#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_ - -#include "transport_manager/common.h" -#include "transport_manager/error.h" -#include "transport_manager/transport_adapter/transport_adapter_impl.h" -#include "transport_manager/transport_adapter/threaded_socket_connection.h" - -using ::transport_manager::ApplicationHandle; -using ::transport_manager::DeviceHandle; -using ::transport_manager::transport_adapter::Connection; -using ::transport_manager::transport_adapter::TransportAdapterController; -using ::transport_manager::ConnectError; -using ::transport_manager::transport_adapter::ThreadedSocketConnection; -using ::transport_manager::transport_adapter::TransportAdapter; -namespace test { -namespace components { -namespace transport_manager { - -class MockTransportAdapter; - -class MockConnection : public ThreadedSocketConnection{ - public: - MockConnection(const ::transport_manager::DeviceUID& device_handle, - const ApplicationHandle& app_handle, - TransportAdapterController* adapter); - bool Establish(ConnectError **error); -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_ */ diff --git a/src/components/transport_manager/test/include/mock_connection_factory.h b/src/components/transport_manager/test/include/mock_connection_factory.h deleted file mode 100644 index afead19cb6..0000000000 --- a/src/components/transport_manager/test/include/mock_connection_factory.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * \file mock_connection_factory.h - * \brief - * - * Copyright (c) 2013, 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_ -#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_ - -#include "transport_manager/transport_adapter/server_connection_factory.h" - -using ::transport_manager::ApplicationHandle; -using ::transport_manager::DeviceHandle; -using ::transport_manager::transport_adapter::TransportAdapter; -using ::transport_manager::transport_adapter::ServerConnectionFactory; - -namespace test { -namespace components { -namespace transport_manager { - -class MockTransportAdapter; - -class MockConnectionFactory : public ServerConnectionFactory { - public: - MockConnectionFactory(MockTransportAdapter *adapter); - TransportAdapter::Error Init() { return TransportAdapter::OK; } - TransportAdapter::Error CreateConnection(const ::transport_manager::DeviceUID& device_handle, - const ApplicationHandle& app_handle); - void Terminate() {} - bool IsInitialised() const { return true; } - - private: - MockTransportAdapter *controller_; -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_ */ diff --git a/src/components/transport_manager/test/include/mock_device.h b/src/components/transport_manager/test/include/mock_device.h deleted file mode 100644 index 1225f851d7..0000000000 --- a/src/components/transport_manager/test/include/mock_device.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * \file mock_device.h - * \brief - * - * Copyright (c) 2013, 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_ -#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_ - -#include "transport_manager/common.h" -#include "transport_manager/transport_adapter/transport_adapter_impl.h" - -#include "gtest/gtest.h" -#include "gmock/gmock.h" -#include <transport_manager/transport_adapter/transport_adapter_impl.h> -#include <transport_manager/transport_manager_impl.h> -#include "mock_device_scanner.h" -#include "mock_application.h" - -using ::transport_manager::ApplicationList; -using ::transport_manager::transport_adapter::Device; -using ::transport_manager::transport_adapter::TransportAdapterController; - -namespace test { -namespace components { -namespace transport_manager { - -class MockDevice : public ::transport_manager::transport_adapter::Device { - - pthread_mutex_t device_started_mutex; - std::vector<MockApplication> applications_; - int applications_cnt_; - TransportAdapterController *controller_; - public: - MockDevice(const std::string& name, const std::string& id, - TransportAdapterController * controller) - : Device(name, id), - applications_cnt_(0), - controller_(controller) { - } - const ApplicationHandle addApplication(); - void Start(); - void Stop(); - bool IsSameAs(const Device* other) const; - ApplicationList GetApplicationList() const; - bool operator == (const MockDevice &other); -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_ */ diff --git a/src/components/transport_manager/test/include/mock_device_scanner.h b/src/components/transport_manager/test/include/mock_device_scanner.h deleted file mode 100644 index 6ebae39a7c..0000000000 --- a/src/components/transport_manager/test/include/mock_device_scanner.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * \file mock_device_scanner.h - * \brief - * - * Copyright (c) 2013, 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_ -#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_ - -#include "transport_manager/transport_adapter/device_scanner.h" - -using ::transport_manager::transport_adapter::TransportAdapter; -using ::transport_manager::transport_adapter::DeviceScanner; -using ::transport_manager::transport_adapter::DeviceVector; - -namespace test { -namespace components { -namespace transport_manager { - -class MockTransportAdapter; - -class MockDeviceScanner : public DeviceScanner { - public: - MockDeviceScanner(MockTransportAdapter *adapter); - void reset(); - void AddDevice(const std::string& name, const std::string& unique_id, bool start = true); - void RemoveDevice(const std::string& name); - void fail_further_search() { is_search_failed_ = true; } - - protected: - TransportAdapter::Error Init(); - TransportAdapter::Error Scan(); - void Terminate(); - bool IsInitialised() const; - - private: - MockTransportAdapter *controller_; - DeviceVector devices_; - bool is_initialized_; - bool is_search_failed_; -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_ */ diff --git a/src/components/transport_manager/test/include/mock_transport_adapter.h b/src/components/transport_manager/test/include/mock_transport_adapter.h deleted file mode 100644 index 85f0da76dc..0000000000 --- a/src/components/transport_manager/test/include/mock_transport_adapter.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * \file mock_transport_adapter.h - * \brief - * - * Copyright (c) 2013, 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_ -#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_ - -#include "transport_manager/transport_adapter/transport_adapter_impl.h" - -using ::transport_manager::transport_adapter::TransportAdapterImpl; -using ::transport_manager::transport_adapter::DeviceType; - -namespace test { -namespace components { -namespace transport_manager { - -class MockDeviceScanner; - -class MockTransportAdapter : public TransportAdapterImpl { - public: - MockTransportAdapter(); - MockDeviceScanner* get_device_scanner() const; - DeviceType GetDeviceType() const { return DeviceType::UNKNOWN; } - void reset(); -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_ */ diff --git a/src/components/transport_manager/test/include/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/mock_transport_adapter_listener.h deleted file mode 100644 index 5b68cadaa3..0000000000 --- a/src/components/transport_manager/test/include/mock_transport_adapter_listener.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * \file mock_transport_adapter_listener.h - * \brief - * - * Copyright (c) 2013, 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 MOCK_transport_adapter_LISTENER_H_ -#define MOCK_transport_adapter_LISTENER_H_ - -#include <gmock/gmock.h> - -#include "transport_manager/transport_adapter/transport_adapter_listener.h" - -using namespace transport_manager; -using transport_manager::transport_adapter::TransportAdapter; -using transport_manager::transport_adapter::TransportAdapterListener; - -namespace test { -namespace components { -namespace transport_manager { -using namespace ::protocol_handler; - -class MockTransportAdapterListener : public TransportAdapterListener { - public: - MOCK_METHOD1(OnSearchDeviceDone, - void(const TransportAdapter* transport_adapter)); - MOCK_METHOD0(AckDevices,void()); - MOCK_METHOD2(OnSearchDeviceFailed, - void(const TransportAdapter* transport_adapter, const SearchDeviceError& error)); - MOCK_METHOD1(OnFindNewApplicationsRequest, - void(const TransportAdapter* adapter)); - MOCK_METHOD1(OnDeviceListUpdated, - void(const TransportAdapter* transport_adapter)); - MOCK_METHOD3(OnConnectDone, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle)); - MOCK_METHOD4(OnConnectFailed, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const ConnectError& error)); - MOCK_METHOD4(OnUnexpectedDisconnect, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const CommunicationError& error)); - MOCK_METHOD3(OnDisconnectDone, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle)); - MOCK_METHOD4(OnDisconnectFailed, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const DisconnectError& error)); - MOCK_METHOD2(OnDisconnectDeviceDone, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle)); - MOCK_METHOD3(OnDisconnectDeviceFailed, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const DisconnectDeviceError& error)); - MOCK_METHOD4(OnDataSendDone, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const RawMessagePtr data_container)); - MOCK_METHOD5(OnDataSendFailed, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const RawMessagePtr data_container, const DataSendError& error)); - MOCK_METHOD4(OnDataReceiveDone, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const RawMessagePtr data_container)); - MOCK_METHOD4(OnDataReceiveFailed, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle, const DataReceiveError& error)); - MOCK_METHOD3(OnCommunicationError, - void(const TransportAdapter* transport_adapter, const DeviceUID& device_handle, const ApplicationHandle& app_handle)); - MOCK_METHOD3(OnConnectRequested, void(const TransportAdapter*, const DeviceUID&, const ApplicationHandle&)); -}; - -} -} -} - -#endif /* MOCK_transport_adapter_LISTENER_H_ */ diff --git a/src/components/transport_manager/test/include/mock_transport_manager_listener.h b/src/components/transport_manager/test/include/mock_transport_manager_listener.h deleted file mode 100644 index 9518e1a92a..0000000000 --- a/src/components/transport_manager/test/include/mock_transport_manager_listener.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * \file mock_transport_adapter_listener.h - * \brief - * - * Copyright (c) 2013, 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 MOCK_TRANSPORT_MANAGER_LISTENER_H -#define MOCK_TRANSPORT_MANAGER_LISTENER_H - -#include <gmock/gmock.h> - -#include "transport_manager/common.h" -#include "transport_manager/info.h" -#include "transport_manager/transport_adapter/transport_adapter.h" -#include "transport_manager/transport_manager_listener.h" - -using ::transport_manager::ApplicationList; -using ::transport_manager::ApplicationHandle; -using ::transport_manager::transport_adapter::TransportAdapter; -using ::transport_manager::SearchDeviceError; -using ::transport_manager::ConnectionUID; -using ::transport_manager::ConnectError; -using ::transport_manager::DisconnectError; -using ::transport_manager::DisconnectDeviceError; -using ::transport_manager::DataSendError; -using ::transport_manager::DataReceiveError; -using ::transport_manager::CommunicationError; -using ::transport_manager::DeviceInfo; -using ::transport_manager::DeviceHandle; - -namespace test { -namespace components { -namespace transport_manager { - -class MockTransportManagerListener : - public ::transport_manager::TransportManagerListener { - public: - MOCK_METHOD1(OnDeviceListUpdated, void(const std::vector<DeviceInfo>&)); - MOCK_METHOD0(OnFindNewApplicationsRequest, void()); - MOCK_METHOD1(OnDeviceFound, void(const DeviceInfo &device_info)); - MOCK_METHOD1(OnDeviceAdded, void(const DeviceInfo &device_info)); - MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo &device_info)); - MOCK_METHOD0(OnNoDeviceFound, void()); - MOCK_METHOD0(OnScanDevicesFinished, void()); - MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error)); - - MOCK_METHOD2(OnConnectionEstablished, void(const DeviceInfo& device_info, - const ConnectionUID &connection_id)); - MOCK_METHOD2(OnConnectionFailed, void(const DeviceInfo& device_info, - const ConnectError& error)); - - MOCK_METHOD1(OnConnectionClosed, void(ConnectionUID connection_id)); - MOCK_METHOD2(OnConnectionClosedFailure, void (ConnectionUID connection_id, - const DisconnectError& error)); - MOCK_METHOD2(OnUnexpectedDisconnect, void (ConnectionUID connection_id, - const CommunicationError& error)); - MOCK_METHOD2(OnDeviceConnectionLost, void (const DeviceHandle& device, - const DisconnectDeviceError& error)); - MOCK_METHOD2(OnDisconnectFailed, void (const DeviceHandle& device, - const DisconnectDeviceError& error)); - - MOCK_METHOD1(OnTMMessageReceived, void(const RawMessagePtr data_container)); - MOCK_METHOD2(OnTMMessageReceiveFailed, void(ConnectionUID connection_id, - const DataReceiveError& error)); - MOCK_METHOD1(OnTMMessageSend, void(const RawMessagePtr message)); - MOCK_METHOD2(OnTMMessageSendFailed, void(const DataSendError& error, - const RawMessagePtr message)); -}; - -} // namespace transport_manager -} // namespace components -} // namespace test - -#endif /* MOCK_TRANSPORT_MANAGER_LISTENER_H */ diff --git a/src/components/transport_manager/test/include/client_connection_listener_mock.h b/src/components/transport_manager/test/include/transport_manager/client_connection_listener_mock.h index 009814f531..6378e69932 100644 --- a/src/components/transport_manager/test/include/client_connection_listener_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/client_connection_listener_mock.h @@ -40,7 +40,7 @@ namespace test { namespace components { namespace transport_manager_test { -class ClientConnectionListenerMock +class MockClientConnectionListener : public ::transport_manager::transport_adapter::ClientConnectionListener { public: MOCK_METHOD0( diff --git a/src/components/transport_manager/test/include/connection_mock.h b/src/components/transport_manager/test/include/transport_manager/connection_mock.h index 9e35e9a008..fbcfcb2271 100644 --- a/src/components/transport_manager/test/include/connection_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/connection_mock.h @@ -42,10 +42,11 @@ namespace transport_manager_test { using namespace ::transport_manager::transport_adapter; -class ConnectionMock : public Connection { +class MockConnection : public Connection { public: - MOCK_METHOD1(SendData, TransportAdapter::Error( - ::protocol_handler::RawMessagePtr message)); + MOCK_METHOD1( + SendData, + TransportAdapter::Error(::protocol_handler::RawMessagePtr message)); MOCK_METHOD0(Disconnect, TransportAdapter::Error()); }; diff --git a/src/components/transport_manager/test/include/device_mock.h b/src/components/transport_manager/test/include/transport_manager/device_mock.h index 53a0ca53fc..aac28fac11 100644 --- a/src/components/transport_manager/test/include/device_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/device_mock.h @@ -42,18 +42,18 @@ namespace test { namespace components { namespace transport_manager_test { -class DeviceMock : public ::transport_manager::transport_adapter::Device { +class MockDevice : public ::transport_manager::transport_adapter::Device { public: - DeviceMock(const std::string& name, const std::string& unique_device_id) + MockDevice(const std::string& name, const std::string& unique_device_id) : Device(name, unique_device_id) {} MOCK_CONST_METHOD1(IsSameAs, bool(const Device* other_device)); MOCK_CONST_METHOD0(GetApplicationList, std::vector<int>()); MOCK_METHOD0(Stop, void()); }; -class TCPDeviceMock : public ::transport_manager::transport_adapter::TcpDevice { +class MockTCPDevice : public ::transport_manager::transport_adapter::TcpDevice { public: - TCPDeviceMock(const uint32_t& in_addr_t, const std::string& name) + MockTCPDevice(const uint32_t& in_addr_t, const std::string& name) : TcpDevice(in_addr_t, name) {} MOCK_CONST_METHOD1(IsSameAs, bool(const Device* other_device)); MOCK_CONST_METHOD0(GetApplicationList, std::vector<int>()); diff --git a/src/components/transport_manager/test/include/device_scanner_mock.h b/src/components/transport_manager/test/include/transport_manager/device_scanner_mock.h index ea98af7f23..d751994e9a 100644 --- a/src/components/transport_manager/test/include/device_scanner_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/device_scanner_mock.h @@ -40,7 +40,7 @@ namespace test { namespace components { namespace transport_manager_test { -class DeviceScannerMock +class MockDeviceScanner : public ::transport_manager::transport_adapter::DeviceScanner { public: MOCK_METHOD0( diff --git a/src/components/transport_manager/test/include/time_metric_observer_mock.h b/src/components/transport_manager/test/include/transport_manager/mock_telemetry_observer.h index 5936f8c655..9d4e86728b 100644 --- a/src/components/transport_manager/test/include/time_metric_observer_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/mock_telemetry_observer.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2014, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,26 +30,24 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_ -#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_ +#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_ +#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_ -#include <string> #include "gmock/gmock.h" -#include "transport_manager/time_metric_observer.h" -#include "protocol/raw_message.h" +#include "transport_manager/telemetry_observer.h" namespace test { namespace components { namespace transport_manager_test { -class TMMetricObserverMock: public ::transport_manager::TMMetricObserver { +class MockTMTelemetryObserver + : public ::transport_manager::TMTelemetryObserver { public: - MOCK_METHOD1(StartRawMsg, - void(const protocol_handler::RawMessage* ptr)); - MOCK_METHOD1(StopRawMsg, - void(const protocol_handler::RawMessage* ptr)); + MOCK_METHOD1(StartRawMsg, void(const protocol_handler::RawMessage* ptr)); + MOCK_METHOD1(StopRawMsg, void(const protocol_handler::RawMessage* ptr)); }; -} // namespace transport_manager_test -} // namespace components -} // namespace test -#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_ + +} // transport_manager_test +} // components +} // test +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_ diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_adapter_listener.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_adapter_listener.h new file mode 100644 index 0000000000..c6862c19d6 --- /dev/null +++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_adapter_listener.h @@ -0,0 +1,128 @@ +/* + * \file mock_transport_adapter_listener.h + * \brief + * + * Copyright (c) 2013, 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 MOCK_transport_adapter_LISTENER_H_ +#define MOCK_transport_adapter_LISTENER_H_ + +#include <gmock/gmock.h> + +#include "transport_manager/transport_adapter/transport_adapter_listener.h" + +using namespace transport_manager; +using transport_manager::transport_adapter::TransportAdapter; +using transport_manager::transport_adapter::TransportAdapterListener; + +namespace test { +namespace components { +namespace transport_manager_test { +using namespace ::protocol_handler; + +class MockTransportAdapterListener : public TransportAdapterListener { + public: + MOCK_METHOD1(OnSearchDeviceDone, + void(const TransportAdapter* transport_adapter)); + MOCK_METHOD0(AckDevices, void()); + MOCK_METHOD2(OnSearchDeviceFailed, + void(const TransportAdapter* transport_adapter, + const SearchDeviceError& error)); + MOCK_METHOD1(OnFindNewApplicationsRequest, + void(const TransportAdapter* adapter)); + MOCK_METHOD1(OnDeviceListUpdated, + void(const TransportAdapter* transport_adapter)); + MOCK_METHOD3(OnConnectDone, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD4(OnConnectFailed, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const ConnectError& error)); + MOCK_METHOD4(OnUnexpectedDisconnect, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const CommunicationError& error)); + MOCK_METHOD3(OnDisconnectDone, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD4(OnDisconnectFailed, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const DisconnectError& error)); + MOCK_METHOD2(OnDisconnectDeviceDone, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle)); + MOCK_METHOD3(OnDisconnectDeviceFailed, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const DisconnectDeviceError& error)); + MOCK_METHOD4(OnDataSendDone, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const RawMessagePtr data_container)); + MOCK_METHOD5(OnDataSendFailed, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const RawMessagePtr data_container, + const DataSendError& error)); + MOCK_METHOD4(OnDataReceiveDone, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const RawMessagePtr data_container)); + MOCK_METHOD4(OnDataReceiveFailed, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const DataReceiveError& error)); + MOCK_METHOD3(OnCommunicationError, + void(const TransportAdapter* transport_adapter, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD3(OnConnectRequested, + void(const TransportAdapter*, + const DeviceUID&, + const ApplicationHandle&)); +}; +} +} +} + +#endif /* MOCK_transport_adapter_LISTENER_H_ */ diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h new file mode 100644 index 0000000000..e94586a856 --- /dev/null +++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2016, 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_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_ +#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_ + +#include "gmock/gmock.h" +#include "config_profile/profile.h" +#include "transport_manager/transport_manager_impl.h" +#include "transport_manager/mock_transport_manager_settings.h" +#include "transport_manager/transport_manager_settings.h" + +namespace test { +namespace components { +namespace transport_manager_test { + +class MockTransportManagerImpl + : public ::transport_manager::TransportManagerImpl { + public: + explicit MockTransportManagerImpl(MockTransportManagerSettings& settings) + : ::transport_manager::TransportManagerImpl(settings) {} + + int TestReceiveEventFromDevice( + const ::transport_manager::TransportAdapterEvent& event) { + return ::transport_manager::TransportManagerImpl::ReceiveEventFromDevice( + event); + } + + void TestHandle(::transport_manager::TransportAdapterEvent test_event) { + Handle(test_event); + } + + void TestHandle(::protocol_handler::RawMessagePtr msg) { + Handle(msg); + } +}; + +} // namespace transport_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_ diff --git a/src/components/transport_manager/test/include/raw_message_matcher.h b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h index 89f1cdd182..8f20afff60 100644 --- a/src/components/transport_manager/test/include/raw_message_matcher.h +++ b/src/components/transport_manager/test/include/transport_manager/raw_message_matcher.h @@ -56,7 +56,7 @@ class RawMessageMatcher : public MatcherInterface<RawMessagePtr> { explicit RawMessageMatcher(RawMessagePtr ptr); virtual bool MatchAndExplain(const RawMessagePtr ptr, - MatchResultListener* listener) const; + MatchResultListener* listener) const; virtual void DescribeTo(::std::ostream* os) const; virtual void DescribeNegationTo(::std::ostream* os) const; @@ -72,4 +72,5 @@ inline const Matcher<RawMessagePtr> RawMessageEq(RawMessagePtr msg) { } // namespace components } // namespace test -#endif /* APPLINK_TEST_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_RAW_MESSAGE_MATCHER_H_ */ +#endif /* APPLINK_TEST_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_RAW_MESSAGE_MATCHER_H_ \ + */ diff --git a/src/components/transport_manager/test/include/server_connection_factory_mock.h b/src/components/transport_manager/test/include/transport_manager/server_connection_factory_mock.h index cbf922e464..795d9492fc 100644 --- a/src/components/transport_manager/test/include/server_connection_factory_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/server_connection_factory_mock.h @@ -40,14 +40,16 @@ namespace test { namespace components { namespace transport_manager_test { -class ServerConnectionFactoryMock : public ::transport_manager::transport_adapter::ServerConnectionFactory { +class MockServerConnectionFactory + : public ::transport_manager::transport_adapter::ServerConnectionFactory { public: - MOCK_METHOD0(Init, ::transport_manager::transport_adapter::TransportAdapter::Error()); + MOCK_METHOD0( + Init, ::transport_manager::transport_adapter::TransportAdapter::Error()); MOCK_METHOD0(Terminate, void()); MOCK_CONST_METHOD0(IsInitialised, bool()); MOCK_METHOD2(CreateConnection, - ::transport_manager::transport_adapter::TransportAdapter::Error(const std::string&, - const int& app_handle)); + ::transport_manager::transport_adapter::TransportAdapter::Error( + const std::string&, const int& app_handle)); }; } // namespace transport_manager_test diff --git a/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h new file mode 100644 index 0000000000..432e4f3fa0 --- /dev/null +++ b/src/components/transport_manager/test/include/transport_manager/tcp/mock_tcp_transport_adapter.h @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2015, 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_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_TRANSPORT_ADAPTER_H_ +#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_TRANSPORT_ADAPTER_H_ + +#include "gmock/gmock.h" +#include "transport_manager/tcp/tcp_transport_adapter.h" +#include "transport_manager/transport_manager_settings.h" + +namespace test { +namespace components { +namespace transport_manager_test { + +using namespace ::transport_manager::transport_adapter; + +class MockTCPTransportAdapter : public TcpTransportAdapter { + public: + MockTCPTransportAdapter( + uint16_t port, + resumption::LastState& last_state, + const transport_manager::TransportManagerSettings& settings) + : TcpTransportAdapter(port, last_state, settings) {} + MOCK_CONST_METHOD2(FindEstablishedConnection, + ConnectionSPtr(const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + + MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle)); + MOCK_METHOD2(Connect, + TransportAdapter::Error(const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + void CallStore() { + Store(); + } + bool CallRestore() { + return Restore(); + } +}; + +} // namespace transport_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TCP_MOCK_TCP_TRANSPORT_ADAPTER_H_ diff --git a/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h new file mode 100644 index 0000000000..c576c3de6c --- /dev/null +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter/mock_transport_adapter_impl.h @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2015, 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_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_IMPL_H_ +#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_IMPL_H_ + +#include "gmock/gmock.h" +#include "transport_manager/transport_adapter/transport_adapter_impl.h" +#include "transport_manager/transport_manager_settings.h" + +using ::transport_manager::transport_adapter::TransportAdapterImpl; +using ::transport_manager::transport_adapter::DeviceScanner; +using ::transport_manager::transport_adapter::ServerConnectionFactory; +using ::transport_manager::transport_adapter::ClientConnectionListener; +using ::transport_manager::transport_adapter::DeviceType; +using ::transport_manager::transport_adapter::ConnectionSPtr; +using ::transport_manager::DeviceUID; +using ::transport_manager::ApplicationHandle; + +namespace test { +namespace components { +namespace transport_manager_test { + +class MockTransportAdapterImpl : public TransportAdapterImpl { + public: + MockTransportAdapterImpl( + DeviceScanner* device_scanner, + ServerConnectionFactory* server_connection_factory, + ClientConnectionListener* client_connection_listener, + resumption::LastState& last_state, + const transport_manager::TransportManagerSettings& settings) + : TransportAdapterImpl(device_scanner, + server_connection_factory, + client_connection_listener, + last_state, + settings) {} + + ConnectionSPtr FindStatedConnection(const DeviceUID& device_handle, + const ApplicationHandle& app_handle) { + return this->FindEstablishedConnection(device_handle, app_handle); + } + virtual ~MockTransportAdapterImpl(){}; + + virtual DeviceType GetDeviceType() const { + return UNKNOWN; + } + + MOCK_CONST_METHOD0(Store, void()); + MOCK_METHOD0(Restore, bool()); +}; + +} // namespace transport_manager_test +} // namespace components +} // namespace test + +#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_ADAPTER_MOCK_TRANSPORT_ADAPTER_IMPL_H_ diff --git a/src/components/transport_manager/test/include/transport_adapter_controller_mock.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter_controller_mock.h index c0c7155e43..1dc6839ac9 100644 --- a/src/components/transport_manager/test/include/transport_adapter_controller_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter_controller_mock.h @@ -51,33 +51,42 @@ class TransportAdapterControllerMock : public TransportAdapterController { MOCK_METHOD0(FindNewApplicationsRequest, void()); MOCK_METHOD1(SearchDeviceFailed, void(const SearchDeviceError& error)); MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle)); - MOCK_CONST_METHOD3(FindDevice, void(ConnectionSPtr connection, - const DeviceUID& device_handle, - const ApplicationHandle& app_handle)); - MOCK_METHOD2(ConnectDone, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle)); - MOCK_METHOD3(ConnectFailed, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle, - const ConnectError& error)); - MOCK_METHOD2(ConnectionFinished, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle)); - MOCK_METHOD3(ConnectionAborted, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle, - const CommunicationError& error)); - MOCK_METHOD2(DeviceDisconnected, void(const DeviceUID& device_handle, - const DisconnectDeviceError& error)); - MOCK_METHOD2(DisconnectDone, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle)); + MOCK_CONST_METHOD3(FindDevice, + void(ConnectionSPtr connection, + const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD2(ConnectDone, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD3(ConnectFailed, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const ConnectError& error)); + MOCK_METHOD2(ConnectionFinished, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); + MOCK_METHOD3(ConnectionAborted, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const CommunicationError& error)); + MOCK_METHOD2(DeviceDisconnected, + void(const DeviceUID& device_handle, + const DisconnectDeviceError& error)); + MOCK_METHOD2(DisconnectDone, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle)); MOCK_METHOD3(DataReceiveDone, void(const DeviceUID& device_handle, const ApplicationHandle& app_handle, ::protocol_handler::RawMessagePtr message)); - MOCK_METHOD3(DataReceiveFailed, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle, - const DataReceiveError& error)); - MOCK_METHOD3(DataSendDone, void(const DeviceUID& device_handle, - const ApplicationHandle& app_handle, - ::protocol_handler::RawMessagePtr message)); + MOCK_METHOD3(DataReceiveFailed, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + const DataReceiveError& error)); + MOCK_METHOD3(DataSendDone, + void(const DeviceUID& device_handle, + const ApplicationHandle& app_handle, + ::protocol_handler::RawMessagePtr message)); MOCK_METHOD3(DataReceiveFailed, void(const DeviceUID& device_handle, const ApplicationHandle& app_handle, diff --git a/src/components/transport_manager/test/include/transport_adapter_listener_mock.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter_listener_mock.h index 88b5cf4b66..a2577ad9ee 100644 --- a/src/components/transport_manager/test/include/transport_adapter_listener_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter_listener_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Ford Motor Company + * Copyright (c) 2016, Ford Motor Company * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,11 +40,21 @@ namespace test { namespace components { namespace transport_manager_test { -using namespace transport_manager; -using transport_adapter::TransportAdapter; -using transport_adapter::TransportAdapterListener; +namespace tm = transport_manager; +namespace ta = tm::transport_adapter; +using ta::TransportAdapter; +using ta::TransportAdapterListener; +using tm::SearchDeviceError; +using tm::DeviceUID; +using tm::ApplicationHandle; +using tm::ConnectError; +using tm::CommunicationError; +using tm::DisconnectError; +using tm::DisconnectDeviceError; +using tm::DataSendError; +using tm::DataReceiveError; -class TransportAdapterListenerMock : public TransportAdapterListener { +class MockTransportAdapterListener : public TransportAdapterListener { public: MOCK_METHOD1(OnSearchDeviceDone, void(const TransportAdapter* transport_adapter)); diff --git a/src/components/transport_manager/test/include/transport_adapter_mock.h b/src/components/transport_manager/test/include/transport_manager/transport_adapter_mock.h index 86e044d13b..d12741f49a 100644 --- a/src/components/transport_manager/test/include/transport_adapter_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_adapter_mock.h @@ -40,7 +40,7 @@ namespace test { namespace components { namespace transport_manager_test { -class TransportAdapterMock +class MockTransportAdapter : public ::transport_manager::transport_adapter::TransportAdapter { public: MOCK_CONST_METHOD0(GetDeviceType, @@ -73,6 +73,9 @@ class TransportAdapterMock MOCK_METHOD0( StopClientListening, ::transport_manager::transport_adapter::TransportAdapter::Error()); + MOCK_METHOD2(RemoveFinalizedConnection, + void(const ::transport_manager::DeviceUID& device_handle, + const ::transport_manager::ApplicationHandle& app_handle)); MOCK_METHOD2(Disconnect, ::transport_manager::transport_adapter::TransportAdapter::Error( const ::transport_manager::DeviceUID& device_handle, @@ -92,9 +95,10 @@ class TransportAdapterMock DeviceName, std::string(const ::transport_manager::DeviceUID& device_handle)); -#ifdef TIME_TESTER - MOCK_METHOD0(GetTimeMetricObserver, ::transport_manager::TMMetricObserver*()); -#endif // TIME_TESTER +#ifdef TELEMETRY_MONITOR + MOCK_METHOD0(GetTelemetryObserver, + ::transport_manager::TMTelemetryObserver*()); +#endif // TELEMETRY_MONITOR }; } // namespace transport_manager_test diff --git a/src/components/transport_manager/test/include/transport_manager_impl_mock.h b/src/components/transport_manager/test/include/transport_manager/transport_manager_impl_mock.h index bb73f1fa49..e5b0468968 100644 --- a/src/components/transport_manager/test/include/transport_manager_impl_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_manager_impl_mock.h @@ -51,4 +51,4 @@ class TransportManagerImplMock : public TransportManagerImpl { } // namespace components } // namespace test -#endif // APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_TRANSPORT_MANAGER_IMPL_MOCK_H_ +#endif // APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_TRANSPORT_MANAGER_IMPL_MOCK_H_ diff --git a/src/components/transport_manager/test/include/transport_manager_listener_mock.h b/src/components/transport_manager/test/include/transport_manager/transport_manager_listener_mock.h index 29758159f1..30f602119d 100644 --- a/src/components/transport_manager/test/include/transport_manager_listener_mock.h +++ b/src/components/transport_manager/test/include/transport_manager/transport_manager_listener_mock.h @@ -48,38 +48,40 @@ using ::protocol_handler::RawMessagePtr; class TransportManagerListenerMock : public TransportManagerListener { public: - MOCK_METHOD1(OnDeviceListUpdated, void(const std::vector<DeviceInfo>&)); + MOCK_METHOD1(OnDeviceListUpdated, + void(const std::vector<DeviceInfo>& device_info)); MOCK_METHOD0(OnFindNewApplicationsRequest, void()); MOCK_METHOD1(OnDeviceFound, void(const DeviceInfo& device_info)); MOCK_METHOD1(OnDeviceAdded, void(const DeviceInfo& device_info)); MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info)); - MOCK_METHOD0(OnNoDeviceFound, void()); MOCK_METHOD0(OnScanDevicesFinished, void()); MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error)); - MOCK_METHOD2(OnConnectionEstablished, void(const DeviceInfo& device_info, - const ConnectionUID& connection_id)); + const ConnectionUID connection_id)); MOCK_METHOD2(OnConnectionFailed, void(const DeviceInfo& device_info, const ConnectError& error)); - - MOCK_METHOD1(OnConnectionClosed, void(ConnectionUID connection_id)); + MOCK_METHOD1(OnConnectionClosed, void(const ConnectionUID connection_id)); + MOCK_METHOD2(OnUnexpectedDisconnect, + void(const ConnectionUID connection_id, + const CommunicationError& error)); MOCK_METHOD2(OnConnectionClosedFailure, - void(ConnectionUID connection_id, const DisconnectError& error)); - MOCK_METHOD2(OnUnexpectedDisconnect, void(ConnectionUID connection_id, - const CommunicationError& error)); + void(const ConnectionUID connection_id, + const DisconnectError& error)); MOCK_METHOD2(OnDeviceConnectionLost, void(const DeviceHandle& device, const DisconnectDeviceError& error)); - MOCK_METHOD2(OnDisconnectFailed, void(const DeviceHandle& device, - const DisconnectDeviceError& error)); - - MOCK_METHOD1(OnTMMessageReceived, void(const RawMessagePtr data_container)); - MOCK_METHOD2(OnTMMessageReceiveFailed, void(ConnectionUID connection_id, - const DataReceiveError& error)); - MOCK_METHOD1(OnTMMessageSend, void(const RawMessagePtr message)); + MOCK_METHOD2(OnDisconnectFailed, + void(const DeviceHandle& device, + const DisconnectDeviceError& error)); + MOCK_METHOD1(OnTMMessageReceived, + void(const ::protocol_handler::RawMessagePtr message)); + MOCK_METHOD1(OnTMMessageReceiveFailed, void(const DataReceiveError& error)); + MOCK_METHOD1(OnTMMessageSend, + void(const ::protocol_handler::RawMessagePtr message)); MOCK_METHOD2(OnTMMessageSendFailed, - void(const DataSendError& error, const RawMessagePtr message)); + void(const DataSendError& error, + const ::protocol_handler::RawMessagePtr message)); }; } // namespace transport_manager_test diff --git a/src/components/transport_manager/test/include/transport_manager_mock.h b/src/components/transport_manager/test/include/transport_manager_mock.h deleted file mode 100644 index 6593f992de..0000000000 --- a/src/components/transport_manager/test/include/transport_manager_mock.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2014, 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 TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_ -#define TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_ - -#include <gmock/gmock.h> -#include <string> -#include "transport_manager/transport_manager.h" -#include "transport_manager/transport_adapter/transport_adapter_event.h" - -namespace test { -namespace components { -namespace transport_manager_test { - -using ::transport_manager::DeviceHandle; -using ::transport_manager::ConnectionUID; -using ::transport_manager::transport_adapter::TransportAdapter; -using ::transport_manager::TransportAdapterEvent; -using ::transport_manager::TransportManagerListener; -/* - * MOCK implementation of ::transport_manager::TransportManager interface - */ -class TransportManagerMock: public ::transport_manager::TransportManager { - public: - MOCK_METHOD0(Init, - int()); - MOCK_METHOD0(Reinit, - int()); - MOCK_METHOD0(SearchDevices, - int()); - MOCK_METHOD1(ConnectDevice, - int(const DeviceHandle &)); - MOCK_METHOD1(DisconnectDevice, - int(const DeviceHandle &)); - MOCK_METHOD1(Disconnect, - int(const ConnectionUID &)); - MOCK_METHOD1(DisconnectForce, - int(const ConnectionUID &)); - MOCK_METHOD1(SendMessageToDevice, - int(const ::protocol_handler::RawMessagePtr)); - MOCK_METHOD1(ReceiveEventFromDevice, - int(const TransportAdapterEvent&)); - MOCK_METHOD1(AddTransportAdapter, - int(TransportAdapter *)); - MOCK_METHOD1(AddEventListener, - int(TransportManagerListener *)); - MOCK_METHOD0(Stop, - int()); - MOCK_METHOD1(RemoveDevice, - int(const DeviceHandle &)); - MOCK_CONST_METHOD1(Visibility, - int(const bool &)); -}; -} // namespace transport_manager_test -} // namespace components -} // namespace test -#endif // TEST_COMPONENTS_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_MOCK_H_ |