#include "chrome/browser/ui/views/location_bar/cookie_controls/cookie_controls_icon_view.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.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/location_bar/location_bar_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 "cookie_controls_bubble_coordinator.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "ui/views/accessibility/ax_event_manager.h"
#include "ui/views/test/ax_event_counter.h"
namespace {
NiceMock;
std::u16string AllowedLabel() { … }
std::u16string BlockedLabel() { … }
std::u16string LimitedLabel() { … }
std::u16string TrackingProtectionLabel() { … }
std::u16string SiteNotWorkingLabel() { … }
const char kUMAIconShown[] = …;
const char kUMAIconOpened[] = …;
const char kUMAIconAnimated[] = …;
const char kUMAIconAnimatedOpened[] = …;
const char kUMABubbleOpenedBlocked[] = …;
const char kUMABubbleOpenedAllowed[] = …;
class MockCookieControlsBubbleCoordinator
: public CookieControlsBubbleCoordinator { … };
}
class CookieControlsIconViewUnitTest
: public TestWithBrowserView,
public testing::WithParamInterface<CookieBlocking3pcdStatus> { … };
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(CookieControlsIconViewUnitTest, DefaultNotVisible) { … }
TEST_P(CookieControlsIconViewUnitTest,
IconAnimatesWhenShouldHighlightIsTrueAndProtectionsAreOn) { … }
TEST_P(CookieControlsIconViewUnitTest,
IconAnimatesOnPageReloadWithChangedSettings) { … }
TEST_P(CookieControlsIconViewUnitTest, IconAnimationIsResetOnWebContentChange) { … }
TEST_P(CookieControlsIconViewUnitTest, HidingIconDoesNotRetriggerA11yReadOut) { … }
TEST_P(CookieControlsIconViewUnitTest,
IconDoesNotAnimateWhenShouldHighlightIsFalse) { … }
TEST_P(CookieControlsIconViewUnitTest, IconHiddenWhenIconVisibleIsFalse) { … }
TEST_P(CookieControlsIconViewUnitTest,
RecordsIconOpenMetricWhenProtectionsAreOff) { … }
TEST_P(CookieControlsIconViewUnitTest,
RecordsIconOpenMetricWhenProtectionsAreOn) { … }