#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "storage/browser/file_system/sandbox_file_system_backend.h"
#include <stddef.h>
#include <memory>
#include <set>
#include <vector>
#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/test/test_future.h"
#include "components/services/storage/public/cpp/constants.h"
#include "storage/browser/file_system/file_system_backend.h"
#include "storage/browser/file_system/file_system_features.h"
#include "storage/browser/file_system/file_system_url.h"
#include "storage/browser/file_system/obfuscated_file_util.h"
#include "storage/browser/file_system/sandbox_file_system_backend_delegate.h"
#include "storage/browser/quota/quota_manager.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "storage/browser/test/mock_special_storage_policy.h"
#include "storage/browser/test/test_file_system_options.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"
#include "third_party/leveldatabase/leveldb_chrome.h"
#include "url/gurl.h"
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
#define PS …
#else
#define PS …
#endif
namespace storage {
namespace {
const struct RootPathTest { … } kRootPathTestCases[] = …;
const struct RootPathFileURITest { … } kRootPathFileURITestCases[] = …;
const struct RootPathFileURINonDefaulBucketTest { … } kRootPathFileURIAndBucketTestCases[] = …;
void DidOpenFileSystem(base::File::Error* error_out,
const GURL& origin_url,
const std::string& name,
base::File::Error error) { … }
}
class SandboxFileSystemBackendTest
: public testing::Test,
public ::testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(SandboxFileSystemBackendTest, Empty) { … }
TEST_P(SandboxFileSystemBackendTest, EnumerateOrigins) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathCreateAndExamine) { … }
TEST_P(SandboxFileSystemBackendTest,
GetRootPathCreateAndExamineWithNewBackend) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathGetWithoutCreate) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathInIncognito) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathFileURI) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlag) { … }
TEST_P(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlagAndBucket) { … }
}