forked from rdkcentral/networkmanager
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e917629
commit dd8dbdc
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#include <gmock/gmock.h> | ||
|
||
#include "libIBus.h" | ||
|
||
class IarmBusImplMock : public IarmBusImpl { | ||
public: | ||
IarmBusImplMock() | ||
: IarmBusImpl() | ||
{ | ||
// Defaults: | ||
ON_CALL(*this, IARM_Bus_IsConnected(::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Invoke( | ||
[](const char*, int* isRegistered) { | ||
*isRegistered = 1; | ||
return IARM_RESULT_SUCCESS; | ||
})); | ||
ON_CALL(*this, IARM_Bus_Init(::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_Connect()) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_RegisterEventHandler(::testing::_, ::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_UnRegisterEventHandler(::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_Call(::testing::_, ::testing::_, ::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_BroadcastEvent(::testing::_, ::testing::_, ::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_RegisterCall(::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
ON_CALL(*this, IARM_Bus_Call_with_IPCTimeout(::testing::_, ::testing::_, ::testing::_, ::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Return(IARM_RESULT_SUCCESS)); | ||
} | ||
virtual ~IarmBusImplMock() = default; | ||
|
||
MOCK_METHOD(IARM_Result_t, IARM_Bus_Init, (const char* name), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_Connect, (), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_IsConnected, (const char* memberName, int* isRegistered), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_RegisterEventHandler, (const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_UnRegisterEventHandler, (const char* ownerName, IARM_EventId_t eventId), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_RemoveEventHandler, (const char* ownerName, IARM_EventId_t eventId, IARM_EventHandler_t handler), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_Call, (const char* ownerName, const char* methodName, void* arg, size_t argLen), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_RegisterCall, (const char* methodName, IARM_BusCall_t handler), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_BroadcastEvent, (const char *ownerName, IARM_EventId_t eventId, void *arg, size_t argLen), (override)); | ||
MOCK_METHOD(IARM_Result_t, IARM_Bus_Call_with_IPCTimeout, (const char *ownerName, const char *methodName, void *arg, size_t argLen, int timeout), (override)); | ||
}; |