chromium/chrome/browser/prefs/profile_pref_store_manager_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.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/prefs/profile_pref_store_manager.h"

#include <stddef.h>

#include <memory>
#include <utility>
#include <vector>

#include "base/compiler_specific.h"
#include "base/containers/contains.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "base/values.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/persistent_pref_store.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/pref_service_factory.h"
#include "components/prefs/pref_store.h"
#include "components/prefs/testing_pref_service.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/preferences/public/cpp/tracked/configuration.h"
#include "services/preferences/public/cpp/tracked/mock_validation_delegate.h"
#include "services/preferences/public/cpp/tracked/pref_names.h"
#include "services/preferences/public/mojom/preferences.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

#if BUILDFLAG(IS_WIN)
#include "base/test/test_reg_util_win.h"
#endif  // BUILDFLAG(IS_WIN)

namespace {

EnforcementLevel;
PrefTrackingStrategy;
ValueType;

// Observes changes to the PrefStore and verifies that only registered prefs are
// written.
class RegistryVerifier : public PrefStore::Observer {};

class PrefStoreReadObserver : public PrefStore::Observer {};

const char kUnprotectedPref[] =;
const char kTrackedAtomic[] =;
const char kProtectedAtomic[] =;

const char kFoobar[] =;
const char kBarfoo[] =;
const char kHelloWorld[] =;
const char kGoodbyeWorld[] =;

const prefs::TrackedPreferenceMetadata kConfiguration[] =;

const size_t kExtraReportingId =;
const size_t kReportingIdCount =;

}  // namespace

class ProfilePrefStoreManagerTest : public testing::Test,
                                    public prefs::mojom::ResetOnLoadObserver {};

TEST_F(ProfilePrefStoreManagerTest, StoreValues) {}

TEST_F(ProfilePrefStoreManagerTest, ProtectValues) {}

TEST_F(ProfilePrefStoreManagerTest, InitializePrefsFromMasterPrefs) {}

TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtected) {}

TEST_F(ProfilePrefStoreManagerTest, NewPrefWhenFirstProtecting) {}

TEST_F(ProfilePrefStoreManagerTest, UnprotectedToProtectedWithoutTrust) {}

// This test verifies that preference values are correctly maintained when a
// preference's protection state changes from protected to unprotected.
TEST_F(ProfilePrefStoreManagerTest, ProtectedToUnprotected) {}