chromium/services/preferences/tracked/tracked_preferences_migration_unittest.cc

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

#include "services/preferences/tracked/tracked_preferences_migration.h"

#include <memory>
#include <set>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string_split.h"
#include "base/values.h"
#include "components/prefs/pref_name_set.h"
#include "components/prefs/testing_pref_service.h"
#include "services/preferences/tracked/dictionary_hash_store_contents.h"
#include "services/preferences/tracked/hash_store_contents.h"
#include "services/preferences/tracked/interceptable_pref_filter.h"
#include "services/preferences/tracked/pref_hash_store.h"
#include "services/preferences/tracked/pref_hash_store_impl.h"
#include "services/preferences/tracked/pref_hash_store_transaction.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {

// An unprotected pref.
const char kUnprotectedPref[] =;
// A protected pref.
const char kProtectedPref[] =;
// A protected pref which is initially stored in the unprotected store.
const char kPreviouslyUnprotectedPref[] =;
// An unprotected pref which is initially stored in the protected store.
const char kPreviouslyProtectedPref[] =;

const char kUnprotectedPrefValue[] =;
const char kProtectedPrefValue[] =;
const char kPreviouslyUnprotectedPrefValue[] =;
const char kPreviouslyProtectedPrefValue[] =;

// A simple InterceptablePrefFilter which doesn't do anything but hand the prefs
// back downstream in FinalizeFilterOnLoad.
class SimpleInterceptablePrefFilter final : public InterceptablePrefFilter {};

// A test fixture designed to be used like this:
//  1) Set up initial store prefs with PresetStoreValue().
//  2) Hand both sets of prefs to the migrator via HandPrefsToMigrator().
//  3) Migration completes synchronously when the second store hands its prefs
//     over.
//  4) Verifications can be made via various methods of this fixture.
// Call Reset() to perform a second migration.
class TrackedPreferencesMigrationTest : public testing::Test {};

// static
const char TrackedPreferencesMigrationTest::kSeed[] =;

// static
const char TrackedPreferencesMigrationTest::kDeviceId[] =;

}  // namespace

TEST_F(TrackedPreferencesMigrationTest, NoMigrationRequired) {}

TEST_F(TrackedPreferencesMigrationTest, FullMigration) {}

TEST_F(TrackedPreferencesMigrationTest, CleanupOnly) {}