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
1ef099c
commit 22ef459
Showing
1 changed file
with
35 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,35 @@ | ||
#pragma once | ||
|
||
#include <gmock/gmock.h> | ||
#include <mntent.h> | ||
|
||
#include "Wraps.h" | ||
|
||
extern "C" FILE* __real_setmntent(const char* command, const char* type); | ||
|
||
class WrapsImplMock : public WrapsImpl { | ||
public: | ||
WrapsImplMock():WrapsImpl() | ||
{ | ||
/*Setting up Default behavior for setmntent: | ||
* We are mocking setmntent in this file below with __wrap_setmntent, | ||
* and the actual setmntent will be called via this interface */ | ||
ON_CALL(*this, setmntent(::testing::_, ::testing::_)) | ||
.WillByDefault(::testing::Invoke( | ||
[&](const char* command, const char* type) -> FILE* { | ||
return __real_setmntent(command, type); | ||
})); | ||
} | ||
virtual ~WrapsImplMock() = default; | ||
|
||
MOCK_METHOD(int, system, (const char* command), (override)); | ||
MOCK_METHOD(FILE*, popen, (const char* command, const char* type), (override)); | ||
MOCK_METHOD(int, pclose, (FILE* pipe), (override)); | ||
MOCK_METHOD(void, syslog, (int pri, const char* fmt, va_list args), (override)); | ||
MOCK_METHOD(FILE*, setmntent, (const char* command, const char* type), (override)); | ||
MOCK_METHOD(struct mntent*, getmntent, (FILE* pipe), (override)); | ||
MOCK_METHOD(FILE*, v_secure_popen, (const char *direction, const char *command, va_list args), (override)); | ||
MOCK_METHOD(int, v_secure_pclose, (FILE *file), (override)); | ||
MOCK_METHOD(int, v_secure_system,(const char *command, va_list args), (override)); | ||
MOCK_METHOD(ssize_t, readlink, (const char *pathname, char *buf, size_t bufsiz), (override)); | ||
}; |