chromium/chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc

// Copyright 2013 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 <stddef.h>

#include <memory>
#include <string>

#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/preference/preference_api.h"
#include "chrome/browser/extensions/extension_prefs_unittest.h"
#include "chrome/test/base/testing_profile.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/mock_pref_change_callback.h"
#include "extensions/browser/api/content_settings/content_settings_service.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_prefs_helper.h"
#include "extensions/common/api/types.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "testing/gtest/include/gtest/gtest.h"

Value;
ChromeSettingScope;

namespace extensions {

namespace {

const char kPref1[] =;
const char kPref2[] =;
const char kPref3[] =;
const char kPref4[] =;

// Default values in case an extension pref value is not overridden.
const char kDefaultPref1[] =;
const char kDefaultPref2[] =;
const char kDefaultPref3[] =;
const char kDefaultPref4[] =;

}  // namespace

class ExtensionControlledPrefsTest : public PrefsPrepopulatedTestBase {};

ExtensionControlledPrefsTest::ExtensionControlledPrefsTest()
    :{}

ExtensionControlledPrefsTest::~ExtensionControlledPrefsTest() {}

void ExtensionControlledPrefsTest::RegisterPreferences(
    user_prefs::PrefRegistrySyncable* registry) {}

void ExtensionControlledPrefsTest::InstallExtensionControlledPref(
    Extension* extension,
    const std::string& key,
    base::Value value) {}

void ExtensionControlledPrefsTest::InstallExtensionControlledPrefIncognito(
    Extension* extension,
    const std::string& key,
    base::Value value) {}

void ExtensionControlledPrefsTest::
    InstallExtensionControlledPrefIncognitoSessionOnly(Extension* extension,
                                                       const std::string& key,
                                                       base::Value value) {}

void ExtensionControlledPrefsTest::InstallExtension(Extension* extension) {}

void ExtensionControlledPrefsTest::UninstallExtension(
    const ExtensionId& extension_id) {}

void ExtensionControlledPrefsTest::EnsureExtensionInstalled(
    Extension* extension) {}

void ExtensionControlledPrefsTest::EnsureExtensionUninstalled(
    const ExtensionId& extension_id) {}

class ControlledPrefsInstallOneExtension
    : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsInstallOneExtension,
       ControlledPrefsInstallOneExtension) {}

// Check that we do not forget persistent incognito values after a reload.
class ControlledPrefsInstallIncognitoPersistent
    : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsInstallIncognitoPersistent,
       ControlledPrefsInstallIncognitoPersistent) {}

// Check that we forget 'session only' incognito values after a reload.
class ControlledPrefsInstallIncognitoSessionOnly
    : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsInstallIncognitoSessionOnly,
       ControlledPrefsInstallIncognitoSessionOnly) {}

class ControlledPrefsUninstallExtension : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsUninstallExtension,
       ControlledPrefsUninstallExtension) {}

// Tests triggering of notifications to registered observers.
class ControlledPrefsNotifyWhenNeeded : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsNotifyWhenNeeded,
       ControlledPrefsNotifyWhenNeeded) {}

// Tests disabling an extension.
class ControlledPrefsDisableExtension : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsDisableExtension, ControlledPrefsDisableExtension) {}

// Tests disabling and reenabling an extension.
class ControlledPrefsReenableExtension : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsDisableExtension, ControlledPrefsReenableExtension) {}

class ControlledPrefsSetExtensionControlledPref
    : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsSetExtensionControlledPref,
       ControlledPrefsSetExtensionControlledPref) {}

// Tests that the switches::kDisableExtensions command-line flag prevents
// extension controlled preferences from being enacted.
class ControlledPrefsDisableExtensions : public ExtensionControlledPrefsTest {};
TEST_F(ControlledPrefsDisableExtensions, ControlledPrefsDisableExtensions) {}

}  // namespace extensions