1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00

renamed operation_context

This commit is contained in:
Falk Werner 2020-04-04 23:27:34 +02:00
parent 745d47bb30
commit 49469c73e3
21 changed files with 118 additions and 118 deletions

View File

@ -31,7 +31,7 @@ add_executable(alltests
test/webfuse/mocks/mock_provider_client.cc test/webfuse/mocks/mock_provider_client.cc
test/webfuse/mocks/mock_provider.cc test/webfuse/mocks/mock_provider.cc
test/webfuse/mocks/mock_fuse.cc test/webfuse/mocks/mock_fuse.cc
test/webfuse/mocks/mock_operations_context.cc test/webfuse/mocks/mock_operation_context.cc
test/webfuse/mocks/mock_jsonrpc_proxy.cc test/webfuse/mocks/mock_jsonrpc_proxy.cc
test/webfuse//tests/core/test_util.cc test/webfuse//tests/core/test_util.cc
test/webfuse/tests/core/test_container_of.cc test/webfuse/tests/core/test_container_of.cc
@ -77,7 +77,7 @@ target_link_libraries(alltests PUBLIC
-Wl,--wrap=wf_timer_dispose -Wl,--wrap=wf_timer_dispose
-Wl,--wrap=wf_timer_start -Wl,--wrap=wf_timer_start
-Wl,--wrap=wf_timer_cancel -Wl,--wrap=wf_timer_cancel
-Wl,--wrap=wf_impl_operations_context_get_proxy -Wl,--wrap=wf_impl_operation_context_get_proxy
-Wl,--wrap=wf_jsonrpc_proxy_vinvoke -Wl,--wrap=wf_jsonrpc_proxy_vinvoke
-Wl,--wrap=wf_jsonrpc_proxy_vnotify -Wl,--wrap=wf_jsonrpc_proxy_vnotify
-Wl,--wrap=fuse_req_userdata -Wl,--wrap=fuse_req_userdata

View File

@ -24,7 +24,7 @@ struct wf_impl_filesystem
struct fuse_args args; struct fuse_args args;
struct fuse_session * session; struct fuse_session * session;
struct fuse_buf buffer; struct fuse_buf buffer;
struct wf_impl_operations_context user_data; struct wf_impl_operation_context user_data;
struct lws * wsi; struct lws * wsi;
struct wf_mountpoint * mountpoint; struct wf_mountpoint * mountpoint;
}; };

View File

@ -13,8 +13,8 @@ void wf_impl_operation_close(
fuse_ino_t inode, fuse_ino_t inode,
struct fuse_file_info * file_info) struct fuse_file_info * file_info)
{ {
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -3,8 +3,8 @@
#include "webfuse/adapter/impl/session.h" #include "webfuse/adapter/impl/session.h"
#include <stddef.h> #include <stddef.h>
struct wf_jsonrpc_proxy * wf_impl_operations_context_get_proxy( struct wf_jsonrpc_proxy * wf_impl_operation_context_get_proxy(
struct wf_impl_operations_context * context) struct wf_impl_operation_context * context)
{ {
struct wf_jsonrpc_proxy * proxy = NULL; struct wf_jsonrpc_proxy * proxy = NULL;

View File

@ -10,15 +10,15 @@ extern "C" {
struct wf_impl_session; struct wf_impl_session;
struct wf_jsonrpc_proxy; struct wf_jsonrpc_proxy;
struct wf_impl_operations_context struct wf_impl_operation_context
{ {
struct wf_impl_session * session; struct wf_impl_session * session;
double timeout; double timeout;
char * name; char * name;
}; };
extern struct wf_jsonrpc_proxy * wf_impl_operations_context_get_proxy( extern struct wf_jsonrpc_proxy * wf_impl_operation_context_get_proxy(
struct wf_impl_operations_context * context); struct wf_impl_operation_context * context);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -73,8 +73,8 @@ void wf_impl_operation_getattr (
struct fuse_file_info * WF_UNUSED_PARAM(file_info)) struct fuse_file_info * WF_UNUSED_PARAM(file_info))
{ {
struct fuse_ctx const * context = fuse_req_ctx(request); struct fuse_ctx const * context = fuse_req_ctx(request);
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -84,8 +84,8 @@ void wf_impl_operation_lookup (
char const * name) char const * name)
{ {
struct fuse_ctx const * context = fuse_req_ctx(request); struct fuse_ctx const * context = fuse_req_ctx(request);
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -48,8 +48,8 @@ void wf_impl_operation_open(
fuse_ino_t inode, fuse_ino_t inode,
struct fuse_file_info * file_info) struct fuse_file_info * file_info)
{ {
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -111,8 +111,8 @@ void wf_impl_operation_read(
off_t offset, off_t offset,
struct fuse_file_info * file_info) struct fuse_file_info * file_info)
{ {
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -141,8 +141,8 @@ void wf_impl_operation_readdir (
off_t offset, off_t offset,
struct fuse_file_info * WF_UNUSED_PARAM(file_info)) struct fuse_file_info * WF_UNUSED_PARAM(file_info))
{ {
struct wf_impl_operations_context * user_data = fuse_req_userdata(request); struct wf_impl_operation_context * user_data = fuse_req_userdata(request);
struct wf_jsonrpc_proxy * rpc = wf_impl_operations_context_get_proxy(user_data); struct wf_jsonrpc_proxy * rpc = wf_impl_operation_context_get_proxy(user_data);
if (NULL != rpc) if (NULL != rpc)
{ {

View File

@ -0,0 +1,27 @@
#include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/utils/wrap.hpp"
extern "C"
{
static webfuse_test::MockOperationContext * webfuse_test_MockOperationContext = nullptr;
WF_WRAP_FUNC1(webfuse_test_MockOperationContext,
struct wf_jsonrpc_proxy *, wf_impl_operation_context_get_proxy,
struct wf_impl_operation_context *);
}
namespace webfuse_test
{
MockOperationContext::MockOperationContext()
{
webfuse_test_MockOperationContext = this;
}
MockOperationContext::~MockOperationContext()
{
webfuse_test_MockOperationContext = nullptr;
}
}

View File

@ -0,0 +1,22 @@
#ifndef MOCK_OPERATIONS_CONTEXT_HPP
#define MOCK_OPERATIONS_CONTEXT_HPP
#include "webfuse/adapter/impl/operation/context.h"
#include <gmock/gmock.h>
namespace webfuse_test
{
class MockOperationContext
{
public:
MockOperationContext();
virtual ~MockOperationContext();
MOCK_METHOD1(wf_impl_operation_context_get_proxy, wf_jsonrpc_proxy * (
struct wf_impl_operation_context * context));
};
}
#endif

View File

@ -1,27 +0,0 @@
#include "webfuse/mocks/mock_operations_context.hpp"
#include "webfuse/utils/wrap.hpp"
extern "C"
{
static webfuse_test::MockOperationsContext * webfuse_test_MockOperationsContext = nullptr;
WF_WRAP_FUNC1(webfuse_test_MockOperationsContext,
struct wf_jsonrpc_proxy *, wf_impl_operations_context_get_proxy,
struct wf_impl_operations_context *);
}
namespace webfuse_test
{
MockOperationsContext::MockOperationsContext()
{
webfuse_test_MockOperationsContext = this;
}
MockOperationsContext::~MockOperationsContext()
{
webfuse_test_MockOperationsContext = nullptr;
}
}

View File

@ -1,22 +0,0 @@
#ifndef MOCK_OPERATIONS_CONTEXT_HPP
#define MOCK_OPERATIONS_CONTEXT_HPP
#include "webfuse/adapter/impl/operation/context.h"
#include <gmock/gmock.h>
namespace webfuse_test
{
class MockOperationsContext
{
public:
MockOperationsContext();
virtual ~MockOperationsContext();
MOCK_METHOD1(wf_impl_operations_context_get_proxy, wf_jsonrpc_proxy * (
struct wf_impl_operations_context * context));
};
}
#endif

View File

@ -2,13 +2,13 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -19,11 +19,11 @@ TEST(wf_impl_operation_close, notify_proxy)
MockJsonRpcProxy proxy; MockJsonRpcProxy proxy;
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,StrEq("close"),StrEq("siii"))).Times(1); EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,StrEq("close"),StrEq("siii"))).Times(1);
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
FuseMock fuse; FuseMock fuse;
EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context)); EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context));
@ -41,8 +41,8 @@ TEST(wf_impl_operation_close, fail_rpc_null)
MockJsonRpcProxy proxy; MockJsonRpcProxy proxy;
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,_,_)).Times(0); EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,_,_)).Times(0);
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;

View File

@ -7,17 +7,17 @@ TEST(wf_impl_operation_context, get_proxy)
wf_jsonrpc_proxy * proxy = reinterpret_cast<wf_jsonrpc_proxy*>(42); wf_jsonrpc_proxy * proxy = reinterpret_cast<wf_jsonrpc_proxy*>(42);
wf_impl_session session; wf_impl_session session;
session.rpc = proxy; session.rpc = proxy;
wf_impl_operations_context context; wf_impl_operation_context context;
context.session = &session; context.session = &session;
ASSERT_EQ(proxy, wf_impl_operations_context_get_proxy(&context)); ASSERT_EQ(proxy, wf_impl_operation_context_get_proxy(&context));
} }
TEST(wf_impl_operation_context, get_proxy_fail_no_session) TEST(wf_impl_operation_context, get_proxy_fail_no_session)
{ {
wf_impl_operations_context context; wf_impl_operation_context context;
context.session = nullptr; context.session = nullptr;
ASSERT_EQ(nullptr, wf_impl_operations_context_get_proxy(&context)); ASSERT_EQ(nullptr, wf_impl_operation_context_get_proxy(&context));
} }

View File

@ -3,13 +3,13 @@
#include "webfuse/core/status.h" #include "webfuse/core/status.h"
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -37,11 +37,11 @@ TEST(wf_impl_operation_getattr, invoke_proxy)
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("getattr"),StrEq("si"))).Times(1) EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("getattr"),StrEq("si"))).Times(1)
.WillOnce(Invoke(free_context)); .WillOnce(Invoke(free_context));
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
fuse_ctx fuse_context; fuse_ctx fuse_context;
fuse_context.gid = 0; fuse_context.gid = 0;
@ -59,8 +59,8 @@ TEST(wf_impl_operation_getattr, invoke_proxy)
TEST(wf_impl_operation_getattr, fail_rpc_null) TEST(wf_impl_operation_getattr, fail_rpc_null)
{ {
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;

View File

@ -3,13 +3,13 @@
#include "webfuse/core/status.h" #include "webfuse/core/status.h"
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -37,11 +37,11 @@ TEST(wf_impl_operation_lookup, invoke_proxy)
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("lookup"),StrEq("sis"))).Times(1) EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("lookup"),StrEq("sis"))).Times(1)
.WillOnce(Invoke(free_context)); .WillOnce(Invoke(free_context));
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
fuse_ctx fuse_context; fuse_ctx fuse_context;
fuse_context.gid = 0; fuse_context.gid = 0;
@ -58,8 +58,8 @@ TEST(wf_impl_operation_lookup, invoke_proxy)
TEST(wf_impl_operation_lookup, fail_rpc_null) TEST(wf_impl_operation_lookup, fail_rpc_null)
{ {
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;

View File

@ -3,13 +3,13 @@
#include "webfuse/core/status.h" #include "webfuse/core/status.h"
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -20,11 +20,11 @@ TEST(wf_impl_operation_open, invoke_proxy)
MockJsonRpcProxy proxy; MockJsonRpcProxy proxy;
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("open"),StrEq("sii"))).Times(1); EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("open"),StrEq("sii"))).Times(1);
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
FuseMock fuse; FuseMock fuse;
EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context)); EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context));
@ -39,8 +39,8 @@ TEST(wf_impl_operation_open, invoke_proxy)
TEST(wf_impl_operation_open, fail_rpc_null) TEST(wf_impl_operation_open, fail_rpc_null)
{ {
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;

View File

@ -1,13 +1,13 @@
#include "webfuse/adapter/impl/operation/read.h" #include "webfuse/adapter/impl/operation/read.h"
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -18,11 +18,11 @@ TEST(wf_impl_operation_read, invoke_proxy)
MockJsonRpcProxy proxy; MockJsonRpcProxy proxy;
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("read"),StrEq("siiii"))).Times(1); EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("read"),StrEq("siiii"))).Times(1);
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
FuseMock fuse; FuseMock fuse;
EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context)); EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context));
@ -41,11 +41,11 @@ TEST(wf_impl_operation_read, invoke_proxy_limit_size)
MockJsonRpcProxy proxy; MockJsonRpcProxy proxy;
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("read"),StrEq("siiii"))).Times(1); EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("read"),StrEq("siiii"))).Times(1);
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
FuseMock fuse; FuseMock fuse;
EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context)); EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context));
@ -61,8 +61,8 @@ TEST(wf_impl_operation_read, invoke_proxy_limit_size)
TEST(wf_impl_operation_read, fail_rpc_null) TEST(wf_impl_operation_read, fail_rpc_null)
{ {
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;

View File

@ -3,13 +3,13 @@
#include "webfuse/core/status.h" #include "webfuse/core/status.h"
#include "webfuse/mocks/mock_fuse.hpp" #include "webfuse/mocks/mock_fuse.hpp"
#include "webfuse/mocks/mock_operations_context.hpp" #include "webfuse/mocks/mock_operation_context.hpp"
#include "webfuse/mocks/mock_jsonrpc_proxy.hpp" #include "webfuse/mocks/mock_jsonrpc_proxy.hpp"
#include <gtest/gtest.h> #include <gtest/gtest.h>
using webfuse_test::MockJsonRpcProxy; using webfuse_test::MockJsonRpcProxy;
using webfuse_test::MockOperationsContext; using webfuse_test::MockOperationContext;
using webfuse_test::FuseMock; using webfuse_test::FuseMock;
using testing::_; using testing::_;
using testing::Return; using testing::Return;
@ -37,11 +37,11 @@ TEST(wf_impl_operation_readdir, invoke_proxy)
EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("readdir"),StrEq("si"))) EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("readdir"),StrEq("si")))
.Times(1).WillOnce(Invoke(free_context)); .Times(1).WillOnce(Invoke(free_context));
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy))); .WillOnce(Return(reinterpret_cast<wf_jsonrpc_proxy*>(&proxy)));
wf_impl_operations_context op_context; wf_impl_operation_context op_context;
op_context.name = nullptr; op_context.name = nullptr;
FuseMock fuse; FuseMock fuse;
EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context)); EXPECT_CALL(fuse, fuse_req_userdata(_)).Times(1).WillOnce(Return(&op_context));
@ -58,8 +58,8 @@ TEST(wf_impl_operation_readdir, invoke_proxy)
TEST(wf_impl_operation_readdir, fail_rpc_null) TEST(wf_impl_operation_readdir, fail_rpc_null)
{ {
MockOperationsContext context; MockOperationContext context;
EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) EXPECT_CALL(context, wf_impl_operation_context_get_proxy(_)).Times(1)
.WillOnce(Return(nullptr)); .WillOnce(Return(nullptr));
FuseMock fuse; FuseMock fuse;