#include "components/privacy_sandbox/privacy_sandbox_test_util.h"
#include <tuple>
#include "base/feature_list.h"
#include "base/test/metrics/histogram_tester.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/content_settings/core/test/content_settings_mock_provider.h"
#include "components/content_settings/core/test/content_settings_test_utils.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.h"
#include "components/privacy_sandbox/privacy_sandbox_features.h"
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/test/browser_task_environment.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/origin.h"
namespace privacy_sandbox_test_util {
namespace {
constexpr int kTestTaxonomyVersion = …;
template <typename T>
std::map<T, TestCaseItemValue> UnpackKeys(
const std::map<TestKey<T>, TestCaseItemValue>& test_key_to_test_value) { … }
template <typename T>
T GetItemValue(const TestCaseItemValue& value) { … }
template <typename V, typename K>
V GetItemValueForKey(K key, std::map<K, TestCaseItemValue> test_components) { … }
}
void ApplyTestState(
StateKey key,
const TestCaseItemValue& value,
content::BrowserTaskEnvironment* task_environment,
sync_preferences::TestingPrefServiceSyncable* testing_pref_service,
HostContentSettingsMap* map,
MockPrivacySandboxSettingsDelegate* mock_delegate,
PrivacySandboxServiceTestInterface* privacy_sandbox_service,
browsing_topics::MockBrowsingTopicsService* mock_browsing_topics_service,
privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings,
content_settings::MockProvider* user_content_setting_provider,
content_settings::MockProvider* managed_content_setting_provider) { … }
void ProvideInput(const std::pair<InputKey, TestCaseItemValue>& input,
PrivacySandboxServiceTestInterface* privacy_sandbox_service) { … }
void CheckOutput(
const std::map<InputKey, TestCaseItemValue>& input,
const std::pair<OutputKey, TestCaseItemValue>& output,
privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings,
PrivacySandboxServiceTestInterface* privacy_sandbox_service,
sync_preferences::TestingPrefServiceSyncable* testing_pref_service) { … }
MockPrivacySandboxObserver::MockPrivacySandboxObserver() = default;
MockPrivacySandboxObserver::~MockPrivacySandboxObserver() = default;
MockPrivacySandboxSettingsDelegate::MockPrivacySandboxSettingsDelegate() { … }
MockPrivacySandboxSettingsDelegate::~MockPrivacySandboxSettingsDelegate() =
default;
void RunTestCase(
content::BrowserTaskEnvironment* task_environment,
sync_preferences::TestingPrefServiceSyncable* testing_pref_service,
HostContentSettingsMap* host_content_settings_map,
MockPrivacySandboxSettingsDelegate* mock_delegate,
browsing_topics::MockBrowsingTopicsService* mock_browsing_topics_service_,
privacy_sandbox::PrivacySandboxSettings* privacy_sandbox_settings,
PrivacySandboxServiceTestInterface* privacy_sandbox_service,
content_settings::MockProvider* user_content_setting_provider,
content_settings::MockProvider* managed_content_setting_provider,
const TestCase& test_case) { … }
}