libcryfs/src/test/testutils/FuseTest.cpp

33 lines
1.2 KiB
C++
Raw Normal View History

2014-11-19 16:16:43 +01:00
#include "FuseTest.h"
2014-11-25 18:43:50 +01:00
using ::testing::StrEq;
using ::testing::_;
using ::testing::Return;
2014-11-25 15:01:33 +01:00
MockFilesystem::MockFilesystem() {}
MockFilesystem::~MockFilesystem() {}
2014-11-25 18:43:50 +01:00
void FuseTest::OnOpenReturnFileDescriptor(const char *filename, int descriptor) {
EXPECT_CALL(fsimpl, openFile(StrEq(filename), _)).Times(1).WillOnce(Return(descriptor));
}
void FuseTest::ReturnIsFileOnLstat(const bf::path &path) {
EXPECT_CALL(fsimpl, lstat(::testing::StrEq(path.c_str()), ::testing::_)).WillRepeatedly(ReturnIsFile);
}
2014-11-27 03:48:38 +01:00
void FuseTest::ReturnIsFileOnLstatWithSize(const bf::path &path, const size_t size) {
EXPECT_CALL(fsimpl, lstat(::testing::StrEq(path.c_str()), ::testing::_)).WillRepeatedly(ReturnIsFileWithSize(size));
}
2014-11-25 18:43:50 +01:00
void FuseTest::ReturnIsDirOnLstat(const bf::path &path) {
EXPECT_CALL(fsimpl, lstat(::testing::StrEq(path.c_str()), ::testing::_)).WillRepeatedly(ReturnIsDir);
}
void FuseTest::ReturnDoesntExistOnLstat(const bf::path &path) {
EXPECT_CALL(fsimpl, lstat(::testing::StrEq(path.c_str()), ::testing::_)).WillRepeatedly(ReturnDoesntExist);
}
void FuseTest::ReturnIsFileOnFstat(int descriptor) {
EXPECT_CALL(fsimpl, fstat(descriptor, _)).WillRepeatedly(ReturnIsFileFstat);
}