chromium/storage/browser/file_system/file_system_operation_impl_unittest.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "storage/browser/file_system/file_system_operation_impl.h"

#include <stddef.h>
#include <stdint.h>

#include <memory>
#include <string>
#include <utility>

#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/services/filesystem/public/mojom/types.mojom.h"
#include "storage/browser/blob/shareable_file_reference.h"
#include "storage/browser/file_system/copy_or_move_hook_delegate.h"
#include "storage/browser/file_system/file_system_context.h"
#include "storage/browser/file_system/file_system_file_util.h"
#include "storage/browser/file_system/file_system_operation_context.h"
#include "storage/browser/file_system/file_system_operation_runner.h"
#include "storage/browser/file_system/sandbox_file_system_backend.h"
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/async_file_test_helper.h"
#include "storage/browser/test/mock_file_change_observer.h"
#include "storage/browser/test/mock_file_update_observer.h"
#include "storage/browser/test/mock_quota_manager.h"
#include "storage/browser/test/mock_quota_manager_proxy.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/browser/test/sandbox_file_system_test_helper.h"
#include "storage/common/file_system/file_system_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"

namespace storage {

// Test class for FileSystemOperationImpl.
class FileSystemOperationImplTest : public testing::Test {};

TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestMoveFailureContainsPath) {}

TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcDirExistsDestFile) {}

TEST_F(FileSystemOperationImplTest,
       TestMoveFailureSrcFileExistsDestNonEmptyDir) {}

TEST_F(FileSystemOperationImplTest, TestMoveFailureSrcFileExistsDestDir) {}

TEST_F(FileSystemOperationImplTest, TestMoveFailureDestParentDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndOverwrite) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcFileAndNew) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirAndOverwrite) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirAndNew) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirRecursive) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSamePath) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureContainsPath) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcDirExistsDestFile) {}

TEST_F(FileSystemOperationImplTest,
       TestCopyFailureSrcFileExistsDestNonEmptyDir) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcFileExistsDestDir) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureDestParentDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestCopyFailureByQuota) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndOverwrite) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndOverwrite) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndNew) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSamePath) {}

TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileSuccess) {}

TEST_F(FileSystemOperationImplTest, TestCopyInForeignFileFailureByQuota) {}

TEST_F(FileSystemOperationImplTest, TestCreateFileFailure) {}

TEST_F(FileSystemOperationImplTest, TestCreateFileSuccessFileExists) {}

TEST_F(FileSystemOperationImplTest, TestCreateFileSuccessExclusive) {}

TEST_F(FileSystemOperationImplTest, TestCreateFileSuccessFileDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestCreateDirFailureDestParentDoesntExist) {}

TEST_F(FileSystemOperationImplTest, TestCreateDirFailureDirExists) {}

TEST_F(FileSystemOperationImplTest, TestCreateDirFailureFileExists) {}

TEST_F(FileSystemOperationImplTest, TestCreateDirSuccess) {}

TEST_F(FileSystemOperationImplTest, TestCreateDirSuccessExclusive) {}

TEST_F(FileSystemOperationImplTest, TestExistsAndMetadataFailure) {}

TEST_F(FileSystemOperationImplTest, TestExistsAndMetadataSuccess) {}

TEST_F(FileSystemOperationImplTest, TestTypeMismatchErrors) {}

TEST_F(FileSystemOperationImplTest, TestReadDirFailure) {}

TEST_F(FileSystemOperationImplTest, TestReadDirSuccess) {}

TEST_F(FileSystemOperationImplTest, TestRemoveFailure) {}

TEST_F(FileSystemOperationImplTest, TestRemoveSuccess) {}

TEST_F(FileSystemOperationImplTest, TestRemoveSuccessRecursive) {}

TEST_F(FileSystemOperationImplTest, TestTruncate) {}

TEST_F(FileSystemOperationImplTest, TestTruncateFailureByQuota) {}

// TODO(crbug.com/40511450): Remove this test once last_access_time has
// been removed after PPAPI has been deprecated. Fuchsia does not support touch,
// which breaks this test that relies on it. Since PPAPI is being deprecated,
// this test is excluded from the Fuchsia build.
// See https://crbug.com/1077456 for details.
#if !BUILDFLAG(IS_FUCHSIA)
TEST_F(FileSystemOperationImplTest, TestTouchFile) {}
#endif  // !BUILDFLAG(IS_FUCHSIA)

TEST_F(FileSystemOperationImplTest, TestCreateSnapshotFile) {}

TEST_F(FileSystemOperationImplTest, TestMoveSuccessSrcDirRecursiveWithQuota) {}

TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursiveWithQuota) {}

TEST_F(FileSystemOperationImplTest,
       TestCopySuccessSrcFileWithDifferentFileSize) {}

}  // namespace storage