#include "chrome/browser/ui/views/page_info/page_info_cookies_content_view.h"
#include <memory>
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/page_info/chrome_page_info_delegate.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/page_info/page_info_view_factory.h"
#include "components/content_settings/core/common/cookie_blocking_3pcd_status.h"
#include "components/content_settings/core/common/features.h"
#include "components/page_info/page_info.h"
#include "components/strings/grit/components_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/views/test/widget_test.h"
#include "ui/views/vector_icons.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/login/users/fake_chrome_user_manager.h"
#include "components/user_manager/scoped_user_manager.h"
#endif
namespace {
Status;
FeatureType;
std::u16string GetManageButtonSubtitle(views::View* content_view) { … }
const char* GetVectorIconName(views::ImageView* image_view) { … }
PageInfoCookiesContentView::CookiesNewInfo DefaultCookieInfoForTests(
int days_to_expiration = 0) { … }
const int kDaysToExpiration = …;
}
class PageInfoCookiesContentViewBaseTestClass : public TestWithBrowserView { … };
class PageInfoCookiesContentViewPre3pcdTest
: public PageInfoCookiesContentViewBaseTestClass { … };
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedByDefault) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest, ThirdPartyCookiesBlocked) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedPermanent) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedTemporary) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesBlockedByPolicy) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedByPolicy) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesBlockedByExtension) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedByExtension) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesBlockedBySetting) { … }
TEST_F(PageInfoCookiesContentViewPre3pcdTest,
ThirdPartyCookiesAllowedBySetting) { … }
class PageInfoCookiesContentView3pcdTitleAndDescriptionTest
: public PageInfoCookiesContentViewBaseTestClass,
public testing::WithParamInterface<CookieBlocking3pcdStatus> { … };
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysTitleAndDescriptionWhenCookiesLimitedWithTemporaryException) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysTitleAndDescriptionWhenCookiesBlockedWithTemporaryException) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysBubbleDescriptionLabelWhenCookiesLimited) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysBubbleDescriptionLabelWhenCookiesBlocked) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysLabelsWhenCookiesBlockedInIncognitoMode) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysLabelsWhenCookiesAllowedInIncognitoMode) { … }
TEST_F(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysDescriptionWhenCookiesAllowedEnforcedByTpcdGrant) { … }
TEST_P(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysTitleAndDescriptionWhenCookiesBlocked) { … }
TEST_P(PageInfoCookiesContentView3pcdTitleAndDescriptionTest,
DisplaysTitleAndDescriptionWhenCookiesAllowedWithPermanentException) { … }
INSTANTIATE_TEST_SUITE_P(…);
class PageInfoCookiesContentView3pcdCookieToggleTest
: public PageInfoCookiesContentViewBaseTestClass,
public testing::WithParamInterface<CookieBlocking3pcdStatus> { … };
TEST_F(PageInfoCookiesContentView3pcdCookieToggleTest,
DisplaysOffToggleWhenCookiesLimited) { … }
TEST_F(PageInfoCookiesContentView3pcdCookieToggleTest,
DisplaysOffToggleWhenCookiesBlocked) { … }
TEST_F(PageInfoCookiesContentView3pcdCookieToggleTest,
DisplaysOffToggleWhenCookiesBlockedInIncognitoMode) { … }
TEST_F(PageInfoCookiesContentView3pcdCookieToggleTest,
DisplaysOnToggleWhenCookiesAllowedInIncognitoMode) { … }
TEST_P(PageInfoCookiesContentView3pcdCookieToggleTest,
DisplaysOnToggleWhenCookiesAllowed) { … }
TEST_P(PageInfoCookiesContentView3pcdCookieToggleTest,
LabelAndEnforcementShownWhenCookiesAllowedEnforcedBySetting) { … }
TEST_P(PageInfoCookiesContentView3pcdCookieToggleTest,
LabelHiddenAndEnforcementShownWhenCookiesAllowedEnforcedByPolicy) { … }
TEST_P(PageInfoCookiesContentView3pcdCookieToggleTest,
LabelHiddenAndEnforcementShownWhenCookiesAllowedEnforcedByExtension) { … }
INSTANTIATE_TEST_SUITE_P(…);