mirror of
https://github.com/falk-werner/webfuse-provider
synced 2026-03-02 04:09:18 +00:00
removed more adapter stuff
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
#include "webfuse/mocks/mock_adapter_client_callback.hpp"
|
||||
#include "webfuse/adapter/client.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
static void
|
||||
webfuse_test_MockAdapterClientCallback_callback(
|
||||
wf_client * client,
|
||||
int reason,
|
||||
void * args)
|
||||
{
|
||||
void * user_data = wf_client_get_userdata(client);
|
||||
auto * callback = reinterpret_cast<webfuse_test::MockAdapterClientCallback*>(user_data);
|
||||
|
||||
callback->Invoke(client, reason, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace webfuse_test
|
||||
{
|
||||
|
||||
MockAdapterClientCallback::MockAdapterClientCallback()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
MockAdapterClientCallback::~MockAdapterClientCallback()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void * MockAdapterClientCallback::GetUserData()
|
||||
{
|
||||
return reinterpret_cast<void*>(this);
|
||||
}
|
||||
|
||||
wf_client_callback_fn * MockAdapterClientCallback::GetCallbackFn()
|
||||
{
|
||||
return &webfuse_test_MockAdapterClientCallback_callback;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
#ifndef WF_MOCK_ADAPTER_CLIENT_CALLBACK_HPP
|
||||
#define WF_MOCK_ADAPTER_CLIENT_CALLBACK_HPP
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include "webfuse/adapter/client_callback.h"
|
||||
|
||||
namespace webfuse_test
|
||||
{
|
||||
|
||||
class MockAdapterClientCallback
|
||||
{
|
||||
public:
|
||||
MockAdapterClientCallback();
|
||||
virtual ~MockAdapterClientCallback();
|
||||
MOCK_METHOD3(Invoke, void (wf_client *, int, void *));
|
||||
void * GetUserData();
|
||||
wf_client_callback_fn * GetCallbackFn();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "webfuse/mocks/mock_authenticator.hpp"
|
||||
|
||||
#define WF_AUTHENTICATOR_COUNT 3
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
webfuse_test::Authenticator * g_authenticators[WF_AUTHENTICATOR_COUNT];
|
||||
|
||||
}
|
||||
|
||||
|
||||
namespace webfuse_test
|
||||
{
|
||||
|
||||
void set_authenticator(Authenticator * authenticator)
|
||||
{
|
||||
set_authenticator(0, authenticator);
|
||||
}
|
||||
|
||||
void set_authenticator(size_t i, Authenticator * authenticator)
|
||||
{
|
||||
g_authenticators[i] = authenticator;
|
||||
}
|
||||
|
||||
bool authenticate(struct wf_credentials const * creds, void * user_data)
|
||||
{
|
||||
return g_authenticators[0]->authenticate(creds, user_data);
|
||||
}
|
||||
|
||||
bool authenticate_1(struct wf_credentials const * creds, void * user_data)
|
||||
{
|
||||
return g_authenticators[1]->authenticate(creds, user_data);
|
||||
}
|
||||
|
||||
bool authenticate_2(struct wf_credentials const * creds, void * user_data)
|
||||
{
|
||||
return g_authenticators[2]->authenticate(creds, user_data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef MOCK_AUTHENTICATOR_H
|
||||
#define MOCK_AUTHENTICATOR_H
|
||||
|
||||
#include <gmock/gmock.h>
|
||||
#include "webfuse/adapter/impl/authenticator.h"
|
||||
|
||||
namespace webfuse_test
|
||||
{
|
||||
|
||||
class Authenticator
|
||||
{
|
||||
public:
|
||||
virtual ~Authenticator() { }
|
||||
virtual bool authenticate(
|
||||
struct wf_credentials const * credentials,
|
||||
void * user_data) = 0;
|
||||
};
|
||||
|
||||
class MockAuthenticator: public Authenticator
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD2(authenticate, bool (struct wf_credentials const * credentials, void * user_data));
|
||||
};
|
||||
|
||||
void set_authenticator(Authenticator * authenticator);
|
||||
void set_authenticator(size_t index, Authenticator * authenticator);
|
||||
|
||||
bool authenticate(struct wf_credentials const * creds, void * user_data);
|
||||
bool authenticate_1(struct wf_credentials const * creds, void * user_data);
|
||||
bool authenticate_2(struct wf_credentials const * creds, void * user_data);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user