chromium/storage/browser/file_system/local_file_util_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.

#include <stdint.h>

#include <memory>
#include <string>

#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "storage/browser/file_system/async_file_util_adapter.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/local_file_util.h"
#include "storage/browser/file_system/native_file_util.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/async_file_test_helper.h"
#include "storage/browser/test/test_file_system_context.h"
#include "storage/common/file_system/file_system_types.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "url/gurl.h"
#include "url/origin.h"

#if BUILDFLAG(IS_POSIX)
#include <sys/stat.h>
#endif  // BUILDFLAG(IS_POSIX)

namespace storage {

namespace {

const FileSystemType kFileSystemType =;

}  // namespace

class LocalFileUtilTest : public testing::Test {};

TEST_F(LocalFileUtilTest, CreateAndClose) {}

// base::CreateSymbolicLink is supported on most POSIX, but not on Fuchsia.
#if BUILDFLAG(IS_POSIX)
TEST_F(LocalFileUtilTest, CreateFailForSymlink) {}
#endif

TEST_F(LocalFileUtilTest, EnsureFileExists) {}

// 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(LocalFileUtilTest, TouchFile) {}

TEST_F(LocalFileUtilTest, TouchDirectory) {}
#endif  // !BUILDFLAG(IS_FUCHSIA)

TEST_F(LocalFileUtilTest, Truncate) {}

TEST_F(LocalFileUtilTest, CopyFile) {}

TEST_F(LocalFileUtilTest, CopyDirectory) {}

TEST_F(LocalFileUtilTest, MoveFile) {}

TEST_F(LocalFileUtilTest, MoveDirectory) {}

// Test that CreateFileEnumerator will propagate any underlying file system
// error when walking a directory. An easy way to trigger a file system error,
// on POSIX, is to chmod a freshly created directory so that its rwx (read
// write execute) mode bits are all zero.
//
// There is an equivalent "remove permissions" mechanism on Windows, but it's
// simpler if this test is only enabled when BUILDFLAG(IS_POSIX). The
// LocalFileUtil code itself already uses the cross-platform abstractions in
// Chromium's base namespace.
#if BUILDFLAG(IS_POSIX)
TEST_F(LocalFileUtilTest, FileEnumeratorError) {}
#endif  // BUILDFLAG(IS_POSIX)

}  // namespace storage