chromium/chrome/browser/ui/views/user_education/feature_promo_lifecycle_interactive_uitest.cc

// Copyright 2020 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 <optional>
#include <sstream>
#include <utility>

#include "build/build_config.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "base/strings/stringprintf.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/time/time.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/user_education/browser_feature_promo_controller.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/browser/ui/web_applications/web_app_browsertest_base.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/test/user_education/interactive_feature_promo_test.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
#include "components/strings/grit/components_strings.h"
#include "components/user_education/common/feature_promo_controller.h"
#include "components/user_education/common/feature_promo_data.h"
#include "components/user_education/common/feature_promo_result.h"
#include "components/user_education/common/feature_promo_specification.h"
#include "components/user_education/common/feature_promo_storage_service.h"
#include "components/user_education/common/user_education_features.h"
#include "components/user_education/views/help_bubble_factory_views.h"
#include "components/user_education/views/help_bubble_view.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/test/browser_test.h"
#include "net/dns/mock_host_resolver.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/events/event_modifiers.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/views/interaction/widget_focus_observer.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"

_;
AnyNumber;
NiceMock;
Ref;
Return;

namespace {
BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();
BASE_FEATURE();
}  // namespace

TestBase;
FeaturePromoClosedReason;
FeaturePromoResult;

class FeaturePromoLifecycleUiTest : public TestBase {};

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, DismissDoesNotSnooze) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, SnoozeSetsCorrectTime) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, HasPromoBeenDismissed) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       HasPromoBeenDismissedWithReason) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, CanReSnooze) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, DoesNotShowIfDismissed) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       DoesNotShowBeforeSnoozeDuration) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, AbortPromoSetsPrefs) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, EndPromoSetsPrefs) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, WidgetCloseSetsPrefs) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, AnchorViewHiddenSetsPrefs) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, AnchorHideSetsPrefs) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, WorkWithoutNonClickerData) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       AbortPromoRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       SnoozePromoRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       CancelPromoRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       PressingEscRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       DismissPromoRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest, EndPromoRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       WidgetClosedRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       AnchorHideRecordsHistogram) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleUiTest,
                       DismissInRegionRecordsHistogram) {}

class FeaturePromoLifecycleAppUiTest : public FeaturePromoLifecycleUiTest {};

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, ShowForApp) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, ShowForAppThenBlocked) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, HasPromoBeenDismissed) {}

// TODO(crbug.com/362182859): flaky on Linux.
#if BUILDFLAG(IS_LINUX)
#define MAYBE_ShowForTwoApps
#else
#define MAYBE_ShowForTwoApps
#endif
IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleAppUiTest, MAYBE_ShowForTwoApps) {}

class FeaturePromoLifecycleCriticalUiTest : public FeaturePromoLifecycleUiTest {};

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest, ShowCriticalPromo) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       CannotRepeatDismissedPromo) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest, ReshowAfterAbort) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       HasPromoBeenDismissed) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       ShowSecondAfterDismiss) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       CriticalBlocksCritical) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest, AlertBlocksAlert) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       CriticalCancelsAlert) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       CriticalCancelsNormal) {}

IN_PROC_BROWSER_TEST_F(FeaturePromoLifecycleCriticalUiTest,
                       AlertCancelsNormal) {}