chromium/chrome/browser/content_settings/content_settings_pref_provider_unittest.cc

// Copyright 2012 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/content_settings/core/browser/content_settings_pref_provider.h"

#include <memory>

#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/test/simple_test_clock.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "components/content_settings/core/browser/content_settings_mock_observer.h"
#include "components/content_settings/core/browser/content_settings_observable_provider.h"
#include "components/content_settings/core/browser/content_settings_pref.h"
#include "components/content_settings/core/browser/content_settings_registry.h"
#include "components/content_settings/core/browser/content_settings_rule.h"
#include "components/content_settings/core/browser/website_settings_info.h"
#include "components/content_settings/core/browser/website_settings_registry.h"
#include "components/content_settings/core/common/content_settings.h"
#include "components/content_settings/core/common/content_settings_constraints.h"
#include "components/content_settings/core/common/content_settings_metadata.h"
#include "components/content_settings/core/common/content_settings_partition_key.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/default_pref_store.h"
#include "components/prefs/overlay_user_pref_store.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/prefs/testing_pref_store.h"
#include "components/sync_preferences/pref_service_mock_factory.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "ppapi/buildflags/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"

_;

namespace content_settings {

class DeadlockCheckerThread : public base::PlatformThread::Delegate {};

// A helper for observing an preference changes and testing whether
// |PrefProvider| holds a lock when the preferences change.
class DeadlockCheckerObserver {};

class PrefProviderTest : public testing::Test {};

TEST_F(PrefProviderTest, Observer) {}

// Tests that obsolete content settings are cleared.
TEST_F(PrefProviderTest, DiscardObsoletePreferences) {}

// Test for regression in which the PrefProvider modified the user pref store
// of the OTR unintentionally: http://crbug.com/74466.
TEST_F(PrefProviderTest, Incognito) {}

TEST_F(PrefProviderTest, GetContentSettingsValue) {}

TEST_F(PrefProviderTest, Patterns) {}

// http://crosbug.com/17760
TEST_F(PrefProviderTest, Deadlock) {}

TEST_F(PrefProviderTest, IncognitoInheritsValueMap) {}

TEST_F(PrefProviderTest, ClearAllContentSettingsRules) {}

TEST_F(PrefProviderTest, LastModified) {}

// If a setting is constrained to a session scope it should only persist in
// memory.
TEST_F(PrefProviderTest, SessionScopeSettingsDontPersist) {}

// If a setting is constrained to a session scope and a provider is made with
// the `restore_Session` flag, the setting should not be cleared.
TEST_F(PrefProviderTest, SessionScopeSettingsRestoreSession) {}

// If a setting is constrained to a non-restorable session scope and a provider
// is made with the `restore_Session` flag, the setting should be restored.
// TODO(b/344678400): Non-restorable grants are temporarily restored as part of
// b/338367663 to migrate them to DURABLE SessionModel. This test needs to be
// deleted once NON_RESTORABLE_USER_SESSION is removed.
TEST_F(PrefProviderTest, SessionScopeSettingsRestoreSessionNonRestorable) {}

// Validate our settings will properly store our expiry time if specified.
TEST_F(PrefProviderTest, GetContentSettingsExpiry) {}

// Any specified expiry time should persist in our prefs and outlive a restart.
TEST_F(PrefProviderTest, GetContentSettingsExpiryPersists) {}

// Any specified expiry time should persist in our prefs and outlive a restart.
TEST_F(PrefProviderTest, GetContentSettingsExpiryAfterRestore) {}

// If we update a setting and change the scope from Session to Durable it
// should persist in the same way as an original Durable scoped setting.
TEST_F(PrefProviderTest, ScopeSessionToDurablePersists) {}

// If we update a setting and change the scope from Durable to Session it
// should drop in the same way as an original Session scoped setting would.
TEST_F(PrefProviderTest, ScopeDurableToSessionDrops) {}

TEST_F(PrefProviderTest, LastVisitedTimeIsTracked) {}

TEST_F(PrefProviderTest, RenewContentSetting) {}

TEST_F(PrefProviderTest, LastVisitedTimeStoredOnDisk) {}

TEST_F(PrefProviderTest, LastVisitedTimeUpdating) {}

}  // namespace content_settings