chromium/components/services/storage/dom_storage/local_storage_impl_unittest.cc

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

#include "components/services/storage/dom_storage/local_storage_impl.h"

#include <string_view>
#include <tuple>

#include "base/containers/span.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/services/storage/dom_storage/local_storage_database.pb.h"
#include "components/services/storage/dom_storage/storage_area_test_util.h"
#include "components/services/storage/public/cpp/constants.h"
#include "components/services/storage/public/cpp/filesystem/filesystem_proxy.h"
#include "components/services/storage/public/mojom/storage_usage_info.mojom.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/features.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/leveldatabase/env_chromium.h"
#include "third_party/leveldatabase/src/include/leveldb/db.h"
#include "url/gurl.h"

namespace storage {

namespace {

std::vector<uint8_t> StdStringToUint8Vector(const std::string& s) {}

std::string Uint8VectorToStdString(const std::vector<uint8_t>& v) {}

void GetStorageUsageCallback(
    const base::RepeatingClosure& callback,
    std::vector<mojom::StorageUsageInfoPtr>* out_result,
    std::vector<mojom::StorageUsageInfoPtr> result) {}

class TestLevelDBObserver : public blink::mojom::StorageAreaObserver {};

}  // namespace

class LocalStorageImplTest : public testing::Test {};

TEST_F(LocalStorageImplTest, Basic) {}

TEST_F(LocalStorageImplTest, StorageKeysAreIndependent) {}

TEST_F(LocalStorageImplTest, WrapperOutlivesMojoConnection) {}

TEST_F(LocalStorageImplTest, OpeningWrappersPurgesInactiveWrappers) {}

TEST_F(LocalStorageImplTest, ValidVersion) {}

TEST_F(LocalStorageImplTest, InvalidVersion) {}

TEST_F(LocalStorageImplTest, VersionOnlyWrittenOnCommit) {}

TEST_F(LocalStorageImplTest, GetStorageUsage_NoData) {}

TEST_F(LocalStorageImplTest, GetStorageUsage_Data) {}

TEST_F(LocalStorageImplTest, CheckAccessMetaData) {}

TEST_F(LocalStorageImplTest, MetaDataClearedOnDelete) {}

TEST_F(LocalStorageImplTest, MetaDataClearedOnDeleteAll) {}

TEST_F(LocalStorageImplTest, DeleteStorage) {}

TEST_F(LocalStorageImplTest, DeleteStorageWithoutConnection) {}

TEST_F(LocalStorageImplTest, DeleteStorageNotifiesWrapper) {}

TEST_F(LocalStorageImplTest, DeleteStorageWithPendingWrites) {}

TEST_F(LocalStorageImplTest, ShutdownClearsData) {}

TEST_F(LocalStorageImplTest, InMemory) {}

TEST_F(LocalStorageImplTest, InMemoryInvalidPath) {}

TEST_F(LocalStorageImplTest, OnDisk) {}

TEST_F(LocalStorageImplTest, InvalidVersionOnDisk) {}

TEST_F(LocalStorageImplTest, CorruptionOnDisk) {}

TEST_F(LocalStorageImplTest, RecreateOnCommitFailure) {}

TEST_F(LocalStorageImplTest, DontRecreateOnRepeatedCommitFailure) {}

class LocalStorageImplStaleDeletionTest
    : public LocalStorageImplTest,
      public testing::WithParamInterface<std::tuple<bool, bool>> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(LocalStorageImplStaleDeletionTest, StaleStorageAreaDeletion) {}

TEST_P(LocalStorageImplStaleDeletionTest, Orphan) {}

}  // namespace storage