#include "components/services/storage/public/cpp/filesystem/filesystem_proxy.h"
#include <memory>
#include "base/check.h"
#include "base/files/file_error_or.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
#include "base/task/thread_pool.h"
#include "base/test/gmock_expected_support.h"
#include "base/test/task_environment.h"
#include "components/services/storage/public/cpp/filesystem/filesystem_impl.h"
#include "components/services/storage/public/mojom/filesystem/directory.mojom.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
FileErrorOr;
namespace storage {
namespace {
constexpr char kFile1Contents[] = …;
constexpr char kFile2Contents[] = …;
constexpr char kDir1File1Contents[] = …;
constexpr char kDir1File2Contents[] = …;
UnorderedElementsAre;
std::string ReadFileContents(base::File* file) { … }
}
class FilesystemProxyTest : public testing::TestWithParam<bool> { … };
TEST_P(FilesystemProxyTest, PathExists) { … }
TEST_P(FilesystemProxyTest, GetDirectoryEntries) { … }
TEST_P(FilesystemProxyTest, OpenFileOpenIfExists) { … }
TEST_P(FilesystemProxyTest, OpenFileCreateAndOpenOnlyIfNotExists) { … }
TEST_P(FilesystemProxyTest, OpenFileAlwaysOpen) { … }
TEST_P(FilesystemProxyTest, OpenFileAlwaysCreate) { … }
TEST_P(FilesystemProxyTest, OpenFileOpenIfExistsAndTruncate) { … }
TEST_P(FilesystemProxyTest, OpenFileReadOnly) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_OpenFileWriteOnly …
#else
#define MAYBE_OpenFileWriteOnly …
#endif
TEST_P(FilesystemProxyTest, MAYBE_OpenFileWriteOnly) { … }
#if BUILDFLAG(IS_FUCHSIA)
#define MAYBE_OpenFileAppendOnly …
#else
#define MAYBE_OpenFileAppendOnly …
#endif
TEST_P(FilesystemProxyTest, MAYBE_OpenFileAppendOnly) { … }
TEST_P(FilesystemProxyTest, DeleteFile) { … }
TEST_P(FilesystemProxyTest, CreateAndRemoveDirectory) { … }
TEST_P(FilesystemProxyTest, DeleteFileFailsOnSubDirectory) { … }
TEST_P(FilesystemProxyTest, GetFileInfo) { … }
TEST_P(FilesystemProxyTest, RenameFile) { … }
TEST_P(FilesystemProxyTest, RenameNonExistentFile) { … }
TEST_P(FilesystemProxyTest, LockFile) { … }
TEST_P(FilesystemProxyTest, AbsolutePathEqualToRoot) { … }
TEST_P(FilesystemProxyTest, AbsolutePathWithinRoot) { … }
INSTANTIATE_TEST_SUITE_P(…);
}