chromium/chrome/browser/ui/views/permissions/chip/permission_dashboard_unittest.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/test/scoped_feature_list.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.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/browser/ui/views/permissions/chip/chip_controller.h"
#include "chrome/browser/ui/views/permissions/chip/permission_chip_view.h"
#include "chrome/browser/ui/views/permissions/chip/permission_dashboard_controller.h"
#include "chrome/browser/ui/views/permissions/chip/permission_dashboard_view.h"
#include "chrome/browser/ui/views/permissions/permission_prompt_chip.h"
#include "components/content_settings/browser/page_specific_content_settings.h"
#include "components/content_settings/core/common/content_settings_types.h"
#include "components/content_settings/core/common/features.h"
#include "content/public/browser/web_contents.h"
#include "ui/gfx/animation/animation_test_api.h"
#include "ui/views/test/ax_event_counter.h"
#include "ui/views/test/button_test_api.h"

class AnimationObserver : public PermissionChipView::Observer {};

class PermissionDashboardUnitTest : public TestWithBrowserView {};

// TODO(crbug.com/41492809): Test LHS indicators animation on macOS as well.
#if !BUILDFLAG(IS_MAC)
// This test verifies:
// 1. Camera activity indicator chip is shown in verbose form after
// `PageSpecificContentSettings` updates camera usage.
// 2. The chip's verbose state collapses after 4 seconds.
// 3. The chip disappears after `PageSpecificContentSettings` resets camera
// usage.
TEST_F(PermissionDashboardUnitTest, DisplayLHSIndicatorForCamera) {}

// This test verifies:
// 1. Camera & Mic activity indicator chip is shown.
// 2. The chip disappears after `PageSpecificContentSettings` resets camera &
// microphone usage.
TEST_F(PermissionDashboardUnitTest, DisplayLHSIndicatorForCameraMic) {}

// This test verifies:
// 1. Camera activity indicator chip is shown.
// 2. After the Camera indicator collapsed, Microphone usage will not trigger
// expand animation because there is only one indicator for both camera and mic.
// 3. The chip does not disappears after `PageSpecificContentSettings` resets
// camera.
// 4. The chip disappears after `PageSpecificContentSettings` resets microphone
// usage.
TEST_F(PermissionDashboardUnitTest, DisplayLHSIndicatorForCameraAndThenMic) {}
#endif