chromium/chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_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 <memory>

#include "base/feature_list.h"
#include "base/test/scoped_feature_list.h"
#include "base/time/time_override.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/test_with_browser_view.h"
#include "chrome/browser/ui/views/frame/toolbar_button_provider.h"
#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_coordinator.h"
#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_bubble_view.h"
#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_content_view.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/common/cookie_blocking_3pcd_status.h"
#include "components/content_settings/core/common/features.h"
#include "components/content_settings/core/common/tracking_protection_feature.h"
#include "components/strings/grit/components_strings.h"
#include "components/strings/grit/privacy_sandbox_strings.h"
#include "components/vector_icons/vector_icons.h"
#include "content/public/browser/web_contents.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/ui_base_features.h"
#include "ui/views/test/widget_test.h"
#include "ui/views/vector_icons.h"

const int kDaysToExpiration =;

Status;
FeatureType;

class MockCookieControlsBubbleView : public CookieControlsBubbleView {};

class MockCookieControlsContentView : public CookieControlsContentView {};

class CookieControlsBubbleCoordinatorTest : public TestWithBrowserView {};

TEST_F(CookieControlsBubbleCoordinatorTest, ShowBubbleTest) {}

class CookieControlsBubbleViewControllerTest : public TestWithBrowserView {};

TEST_F(CookieControlsBubbleViewControllerTest,
       WidgetClosesWhenControlsAreNotVisible) {}

TEST_F(CookieControlsBubbleViewControllerTest, WidgetClosesOnTpcdEnforcement) {}

class CookieControlsBubbleViewController3pcdBubbleTitleTest
    : public CookieControlsBubbleViewControllerTest,
      public testing::WithParamInterface<
          testing::tuple</*protections_on*/ bool,
                         CookieBlocking3pcdStatus,
                         /*is_permanent_exception*/ bool>> {};

TEST_P(CookieControlsBubbleViewController3pcdBubbleTitleTest,
       AlwaysDisplaysTrackingProtectionTitle) {}

INSTANTIATE_TEST_SUITE_P();

class CookieControlsBubbleViewController3pcdStatusesTest
    : public CookieControlsBubbleViewControllerTest,
      public testing::WithParamInterface<CookieBlocking3pcdStatus> {};

// Verify toggle states
TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       DisplaysAllowedToggleForSiteException) {}

TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       DisplaysOffToggleWhenCookiesBlockedOnSite) {}

// Verify feedback states
TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       FeedbackSectionIsVisibleWhenSiteHasExceptionAndNoEnforcement) {}

TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       FeedbackSectionIsNotVisibleWhenCookiesBlockedOnSite) {}

// Verify title and description states
TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       DisplaysTitleAndDescriptionWhenCookiesBlockedOnSite) {}

TEST_F(CookieControlsBubbleViewControllerTest,
       DisplaysTitleAndDescriptionForTemporaryException3pcLimited) {}

TEST_F(CookieControlsBubbleViewControllerTest,
       DisplaysTitleAndDescriptionForTemporaryExceptionAll3pcBlocked) {}

TEST_P(CookieControlsBubbleViewController3pcdStatusesTest,
       DisplaysTitleAndDescriptionWhenSiteHasPermanentException) {}

INSTANTIATE_TEST_SUITE_P();

class CookieControlsBubbleViewController3pcdEnforcementTest
    : public CookieControlsBubbleViewControllerTest,
      public testing::WithParamInterface<
          testing::tuple<CookieBlocking3pcdStatus,
                         /*is_permanent_exception*/ bool>> {};

TEST_P(CookieControlsBubbleViewController3pcdEnforcementTest,
       DisplaysCookieEnforcement) {}

// Verify enforcement states
TEST_P(CookieControlsBubbleViewController3pcdEnforcementTest,
       DisplaysPolicyEnforcement) {}

TEST_P(CookieControlsBubbleViewController3pcdEnforcementTest,
       DisplaysExtensionEnforcement) {}

INSTANTIATE_TEST_SUITE_P();

class CookieControlsBubbleViewControllerPre3pcdTest
    : public CookieControlsBubbleViewControllerTest {};

TEST_F(CookieControlsBubbleViewControllerPre3pcdTest,
       ThirdPartyCookiesBlocked) {}

TEST_F(CookieControlsBubbleViewControllerPre3pcdTest,
       ThirdPartyCookiesAllowedPermanent) {}

TEST_F(CookieControlsBubbleViewControllerPre3pcdTest,
       ThirdPartyCookiesAllowedTemporary) {}

class CookieControlsBubbleViewImplTest : public TestWithBrowserView {};

TEST_F(CookieControlsBubbleViewImplTest, BubbleWidth) {}