chromium/base/files/file_enumerator_unittest.cc

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

#include "base/files/file_enumerator.h"

#include <string>
#include <utility>
#include <vector>

#include "base/containers/circular_deque.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/logging.h"
#include "build/build_config.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

ElementsAre;
IsEmpty;
UnorderedElementsAre;

namespace base {
namespace {

const FilePath::StringType kEmptyPattern;

const std::vector<FileEnumerator::FolderSearchPolicy> kFolderSearchPolicies{};

struct TestFile {};

struct TestDirectory {};

void CheckModificationTime(const FileEnumerator::FileInfo& actual,
                           Time expected_last_modified_time) {}

void CheckFileAgainstInfo(const FileEnumerator::FileInfo& actual,
                          TestFile& expected) {}

void CheckDirectoryAgainstInfo(const FileEnumerator::FileInfo& actual,
                               TestDirectory& expected) {}

circular_deque<FilePath> RunEnumerator(
    const FilePath& root_path,
    bool recursive,
    int file_type,
    const FilePath::StringType& pattern,
    FileEnumerator::FolderSearchPolicy folder_search_policy) {}

bool CreateDummyFile(const FilePath& path) {}

bool GetFileInfo(const FilePath& file_path, File::Info& info) {}

void SetUpTestFiles(const ScopedTempDir& temp_dir,
                    std::vector<TestFile>& files) {}

}  // namespace

TEST(FileEnumerator, NotExistingPath) {}

TEST(FileEnumerator, EmptyFolder) {}

TEST(FileEnumerator, SingleFileInFolderForFileSearch) {}

TEST(FileEnumerator, SingleFileInFolderForDirSearch) {}

TEST(FileEnumerator, SingleFileInFolderWithFiltering) {}

TEST(FileEnumerator, TwoFilesInFolder) {}

TEST(FileEnumerator, SingleFolderInFolderForFileSearch) {}

TEST(FileEnumerator, SingleFolderInFolderForDirSearch) {}

TEST(FileEnumerator, TwoFoldersInFolder) {}

TEST(FileEnumerator, FolderAndFileInFolder) {}

TEST(FileEnumerator, FilesInParentFolderAlwaysFirst) {}

TEST(FileEnumerator, FileInSubfolder) {}

TEST(FileEnumerator, FilesInSubfoldersWithFiltering) {}

TEST(FileEnumerator, InvalidDirectory) {}

#if BUILDFLAG(IS_POSIX)
TEST(FileEnumerator, SymLinkLoops) {}
#endif

// Test FileEnumerator::GetInfo() on some files and ensure all the returned
// information is correct.
TEST(FileEnumerator, GetInfo) {}

// Test that FileEnumerator::GetInfo() works when searching recursively. It also
// tests that it returns the correct information about directories.
TEST(FileEnumerator, GetInfoRecursive) {}

#if BUILDFLAG(IS_FUCHSIA)
// FileEnumerator::GetInfo does not work correctly with INCLUDE_DOT_DOT.
// https://crbug.com/1106172
#elif BUILDFLAG(IS_WIN)
// Windows has a bug in their handling of ".."; they always report the file
// modification time of the current directory, not the parent directory. This is
// a bug in Windows, not us -- you can see it with the "dir" command (notice
// that the time of . and .. always match). Skip this test.
// https://crbug.com/1119546
#else
// Tests that FileEnumerator::GetInfo() returns the correct info for the ..
// directory.
TEST(FileEnumerator, GetInfoDotDot) {}
#endif  // !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_WIN)

TEST(FileEnumerator, OnlyName) {}

struct FileEnumeratorForEachTestCase {};

class FileEnumeratorForEachTest
    : public ::testing::TestWithParam<FileEnumeratorForEachTestCase> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(FileEnumeratorForEachTest, TestCases) {}

}  // namespace base