chromium/components/content_settings/browser/page_specific_content_settings_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/browser/page_specific_content_settings.h"

#include <optional>
#include <string>

#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "components/browsing_data/content/browsing_data_helper.h"
#include "components/content_settings/browser/test_page_specific_content_settings_delegate.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/content_settings/core/common/features.h"
#include "components/security_state/core/security_state.h"
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "content/public/browser/cookie_access_details.h"
#include "content/public/browser/trust_token_access_details.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/mock_navigation_handle.h"
#include "content/public/test/navigation_handle_observer.h"
#include "content/public/test/navigation_simulator.h"
#include "content/public/test/prerender_test_util.h"
#include "content/public/test/test_renderer_host.h"
#include "content/public/test/web_contents_tester.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_access_result.h"
#include "net/cookies/cookie_options.h"
#include "net/shared_dictionary/shared_dictionary_isolation_key.h"
#include "services/network/public/mojom/shared_dictionary_access_observer.mojom.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"

namespace content_settings {

StorageType;

namespace {

constexpr int kTopicsAPITestTaxonomyVersion =;

class MockSiteDataObserver
    : public PageSpecificContentSettings::SiteDataObserver {};

class MockPageSpecificContentSettingsDelegate
    : public TestPageSpecificContentSettingsDelegate {};

blink::StorageKey CreateUnpartitionedStorageKey(const GURL& url) {}

}  // namespace

class PageSpecificContentSettingsTest
    : public content::RenderViewHostTestHarness {};

TEST_F(PageSpecificContentSettingsTest, BlockedContent) {}

TEST_F(PageSpecificContentSettingsTest, BlockedFileSystems) {}

TEST_F(PageSpecificContentSettingsTest, AllowedContent) {}

TEST_F(PageSpecificContentSettingsTest, AllowlistJavaScript) {}

TEST_F(PageSpecificContentSettingsTest, InterestGroupJoin) {}

TEST_F(PageSpecificContentSettingsTest, BrowsingDataAccessed) {}

TEST_F(PageSpecificContentSettingsTest, EmptyCookieList) {}

TEST_F(PageSpecificContentSettingsTest, BlockedThirdPartyCookie) {}

TEST_F(PageSpecificContentSettingsTest, SiteDataObserver) {}

TEST_F(PageSpecificContentSettingsTest, BrowsingDataModelTrustToken) {}

TEST_F(PageSpecificContentSettingsTest,
       BrowsingDataModelTrustTokenPendingNavigation) {}

TEST_F(PageSpecificContentSettingsTest, BrowsingDataModelSharedDictionary) {}

TEST_F(PageSpecificContentSettingsTest,
       BrowsingDataModelSharedDictionaryBlocked) {}

TEST_F(PageSpecificContentSettingsTest,
       BrowsingDataModelSharedDictionaryPendingNavigation) {}

TEST_F(PageSpecificContentSettingsTest,
       BrowsingDataModelSharedDictionaryPendingNavigationBlocked) {}

#if !BUILDFLAG(IS_IOS)
TEST_F(PageSpecificContentSettingsTest,
       IndicatorChangedOnContentSettingChange) {}
#endif

TEST_F(PageSpecificContentSettingsTest, AllowedSitesCountedFromBothModels) {}

TEST_F(PageSpecificContentSettingsTest, BrowsingDataModelStorageAccess) {}

class PageSpecificContentSettingsWithPrerenderTest
    : public PageSpecificContentSettingsTest {};

TEST_F(PageSpecificContentSettingsWithPrerenderTest, SiteDataAccessed) {}

TEST_F(PageSpecificContentSettingsWithPrerenderTest,
       DelegateUpdatesSentAfterActivation) {}

TEST_F(PageSpecificContentSettingsWithPrerenderTest,
       UpdateLocationBarAfterActivation) {}

TEST_F(PageSpecificContentSettingsWithPrerenderTest, ContentAllowedAndBlocked) {}

TEST_F(PageSpecificContentSettingsTest, Topics) {}

class PageSpecificContentSettingsWithFencedFrameTest
    : public PageSpecificContentSettingsTest {};

TEST_F(PageSpecificContentSettingsWithFencedFrameTest, SiteDataAccessed) {}

TEST_F(PageSpecificContentSettingsWithFencedFrameTest, DelegateUpdatesSent) {}

TEST_F(PageSpecificContentSettingsWithFencedFrameTest,
       ContentAllowedAndBlocked) {}

TEST_F(PageSpecificContentSettingsTest,
       MediaIndicatorsBlockedDoNotOverrideInUse) {}

TEST_F(PageSpecificContentSettingsTest, MediaIndicatorsMinHoldDurationDelay) {}

// Tests that if media indicator display time almost equals to the min hold
// duration, a delay should be not less than 1 second.
TEST_F(PageSpecificContentSettingsTest, AlmostExpiredMinHoldDurationDelay) {}

TEST_F(PageSpecificContentSettingsTest,
       MediaIndicatorsHoldAfterUseDurationDelay) {}

TEST_F(PageSpecificContentSettingsTest,
       MediaIndicatorsReenableCameraWhileMinHoldDurationDelay) {}

// Tests that `PageSpecificContentSettings` will return locally saved last used
// time if it exists.
TEST_F(PageSpecificContentSettingsTest, GetLastUsedTimeLocalTimeTest) {}

TEST_F(PageSpecificContentSettingsTest, GetLastUsedReturnsDefaultTimeTest) {}

TEST_F(PageSpecificContentSettingsTest, GetLastUsedReturnCorrectTimeTest) {}

// Tests that a permission blocked indicator is visible only for 60 seconds.
TEST_F(PageSpecificContentSettingsTest, MediaBlockedIndicatorsDismissDelay) {}

// Tests that a permission indicator will not be dismissed by a timer if was
// opened.
TEST_F(PageSpecificContentSettingsTest,
       MediaIndicatorsDoNotDismissIfOpenedDelay) {}

// Tests that a permission blocked state is reset after media started to be
// used.
TEST_F(PageSpecificContentSettingsTest, MediaBlockedStateIsResetIfMediaUsed) {}

class PageSpecificContentSettingsIframeTest
    : public PageSpecificContentSettingsTest {};

// Tests that the content settings are correctly set if a secondary url is
// blocked.
TEST_F(PageSpecificContentSettingsIframeTest, SecondaryUrlBlocked) {}

// Tests that the content settings are correctly set if an unrelated secondary
// url is blocked.
TEST_F(PageSpecificContentSettingsIframeTest, UnrelatedSecondaryUrlBlocked) {}

// Tests that the content settings are correctly set if the primary and
// secondary urls are identical.
TEST_F(PageSpecificContentSettingsIframeTest, PrimarySecondaryIdentical) {}

}  // namespace content_settings