#include "remoting/host/file_transfer/local_file_operations.h"
#include "base/containers/queue.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/path_service.h"
#include "base/test/scoped_path_override.h"
#include "base/test/task_environment.h"
#include "remoting/host/file_transfer/directory_helpers.h"
#include "remoting/host/file_transfer/ensure_user.h"
#include "remoting/host/file_transfer/fake_file_chooser.h"
#include "remoting/host/file_transfer/test_byte_vector_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace remoting {
namespace {
template <typename T>
auto BindLambda(T lambda) { … }
}
class LocalFileOperationsTest : public testing::Test { … };
LocalFileOperationsTest::LocalFileOperationsTest()
: … { … }
void LocalFileOperationsTest::SetUp() { … }
void LocalFileOperationsTest::TearDown() { … }
base::FilePath LocalFileOperationsTest::TestDir() { … }
void LocalFileOperationsTest::WriteFile(
const base::FilePath& filename,
base::queue<std::vector<std::uint8_t>> chunks,
bool close) { … }
void LocalFileOperationsTest::OnOperationComplete(
base::queue<std::vector<std::uint8_t>> remaining_chunks,
bool close,
FileOperations::Writer::Result result) { … }
void LocalFileOperationsTest::OnCloseComplete(
FileOperations::Writer::Result result) { … }
TEST_F(LocalFileOperationsTest, WritesThreeChunks) { … }
TEST_F(LocalFileOperationsTest, WritesSmallTail) { … }
TEST_F(LocalFileOperationsTest, RenamesFileIfExists) { … }
TEST_F(LocalFileOperationsTest, DroppingDeletesTemp) { … }
TEST_F(LocalFileOperationsTest, CancelsWhileOperationPending) { … }
TEST_F(LocalFileOperationsTest, OpensReader) { … }
TEST_F(LocalFileOperationsTest, ReadsThreeChunks) { … }
TEST_F(LocalFileOperationsTest, ReaderHandlesEof) { … }
TEST_F(LocalFileOperationsTest, ReaderCancels) { … }
TEST_F(LocalFileOperationsTest, FileNotFound) { … }
}