chromium/components/privacy_sandbox/privacy_sandbox_test_util_unittest.cc

// Copyright 2023 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/privacy_sandbox/privacy_sandbox_test_util.h"

#include "base/test/task_environment.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/mock_privacy_sandbox_settings.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/privacy_sandbox_attestations.h"
#include "components/privacy_sandbox/privacy_sandbox_attestations/scoped_privacy_sandbox_attestations.h"
#include "components/strings/grit/components_strings.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/l10n/l10n_util.h"

namespace privacy_sandbox_test_util {

namespace {

constexpr char kAccessingOrigin[] =;
constexpr char kTopFrameOrigin[] =;

static url::Origin AccessingOrigin() {}

static url::Origin TopFrameOrigin() {}

class MockPrivacySandboxServiceTestInterface
    : public PrivacySandboxServiceTestInterface {};

}  // namespace

// TODO (crbug.com/1408187): Add coverage for all state / input / output keys.
class PrivacySandboxTestUtilTest {};

class PrivacySandboxTestUtilBoolTest : public PrivacySandboxTestUtilTest,
                                       public testing::TestWithParam<bool> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyM1TopicsEnabledStateKeySetsPref) {}

TEST_P(PrivacySandboxTestUtilBoolTest,
       VerifykBlockAll3pcToggleEnabledStateKeySetsPref) {}

TEST_P(PrivacySandboxTestUtilBoolTest,
       VerifykTrackingProtection3pcdEnabledStateKeySetsPref) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyM1FledgeEnabledStateKeySetsPref) {}

TEST_P(PrivacySandboxTestUtilBoolTest,
       VerifyM1AdMeasurementEnabledStateKeySetsPref) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyIsIncognitoStateKey) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyIsRestrictedAccountStateKey) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyHasCurrentTopicsStateKey) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyHasBlockedTopicsStateKey) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyActiveTopicsConsentStateKey) {}

TEST_P(PrivacySandboxTestUtilBoolTest, VerifyTopicsToggleNewValueInputKey) {}

class PrivacySandboxTestUtilCookieControlsModeTest
    : public PrivacySandboxTestUtilTest,
      public testing::TestWithParam<content_settings::CookieControlsMode> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(PrivacySandboxTestUtilCookieControlsModeTest,
       VerifyCookieControlsModeStateKeySetsPref) {}

class PrivacySandboxTestUtilContentSettingTest
    : public PrivacySandboxTestUtilTest,
      public testing::TestWithParam<ContentSetting> {};

INSTANTIATE_TEST_SUITE_P();

TEST_P(PrivacySandboxTestUtilContentSettingTest,
       VerifySiteDataUserDefaultStateKey) {}

class PrivacySandboxBaseTestUtilTest : public PrivacySandboxTestUtilTest,
                                       public testing::Test {};

TEST_F(PrivacySandboxBaseTestUtilTest, VerifySiteDataUserExceptionStateKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyAdvanceClockByStateKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyPromptActionOccurredInputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsTopicsAllowedForContextOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyIsTopicsAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyIsFledgeAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsAttributionReportingAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyMaySendAttributionReportOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyIsSharedStorageAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsSharedStorageSelectURLAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsPrivateAggregationAllowedOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest, VerifyTopicsConsentGivenOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyTopicsConsentLastUpdateReasonOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyTopicsConsentLastUpdateTimeOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyTopicsConsentStringIdentifiersOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsSharedStorageAllowedDebugMessageOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsSharedStorageSelectURLAllowedDebugMessageOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsSharedStorageBlockSiteSettingSpecificOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsSharedStorageSelectURLBlockSiteSettingSpecificOutputKey) {}

TEST_F(PrivacySandboxBaseTestUtilTest,
       VerifyIsPrivateAggregationBlockSiteSettingSpecificOutputKey) {}

}  // namespace privacy_sandbox_test_util