#include "components/user_education/common/feature_promo_lifecycle.h"
#include <sstream>
#include <tuple>
#include <type_traits>
#include "base/callback_list.h"
#include "base/feature_list.h"
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/simple_test_clock.h"
#include "base/test/task_environment.h"
#include "base/time/clock.h"
#include "base/time/time.h"
#include "components/feature_engagement/test/mock_tracker.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/help_bubble_params.h"
#include "components/user_education/common/user_education_features.h"
#include "components/user_education/test/test_feature_promo_storage_service.h"
#include "components/user_education/test/test_help_bubble.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/element_test_util.h"
namespace user_education {
namespace {
BASE_FEATURE(…);
BASE_FEATURE(…);
constexpr char kAppName[] = …;
constexpr char kAppName2[] = …;
constexpr int kNumRotatingPromos = …;
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
const ui::ElementContext kTestElementContext{ … };
template <typename Arg, typename... Args>
std::string ParamToString(
const testing::TestParamInfo<std::tuple<Arg, Args...>>& param) { … }
}
PromoType;
PromoSubtype;
CloseReason;
class FeaturePromoLifecycleTest : public testing::Test { … };
TEST_F(FeaturePromoLifecycleTest, BubbleClosedOnDiscard) { … }
TEST_F(FeaturePromoLifecycleTest, BubbleClosedOnContinue) { … }
TEST_F(FeaturePromoLifecycleTest,
ClosePromoBubbleAndContinue_kNormal_TutorialSucceeds) { … }
TEST_F(FeaturePromoLifecycleTest,
ClosePromoBubbleAndContinue_kNormal_TutorialFails) { … }
TEST_F(FeaturePromoLifecycleTest,
ClosePromoBubbleAndContinue_DismissOnDiscard) { … }
TEST_F(FeaturePromoLifecycleTest, ClosePromoBubbleAndContinue_kLegalNotice) { … }
TEST_F(FeaturePromoLifecycleTest, ClosePromoBubbleAndContinue_kKeyedNotice) { … }
TEST_F(FeaturePromoLifecycleTest, RotatingPromoGetIndex) { … }
TEST_F(FeaturePromoLifecycleTest, RotatingPromoSetIndex) { … }
TEST_F(FeaturePromoLifecycleTest, ReshowAfterDelay) { … }
TEST_F(FeaturePromoLifecycleTest, ReshowAfterDelayWithLimit) { … }
template <typename... Args>
class FeaturePromoLifecycleParamTest
: public FeaturePromoLifecycleTest,
public testing::WithParamInterface<
std::tuple<PromoType, PromoSubtype, Args...>> { … };
FeaturePromoLifecycleWriteDataTest;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FeaturePromoLifecycleWriteDataTest, DoesDemoWriteData) { … }
TEST_P(FeaturePromoLifecycleWriteDataTest, DataWrittenAndTrackerDismissed) { … }
TEST_P(FeaturePromoLifecycleWriteDataTest, FirstAndLastShowTimeUpdated) { … }
FeaturePromoLifecycleTypesTest;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FeaturePromoLifecycleTypesTest, AllowFirstTimeIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, BlockDismissedIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, BlockSnoozedIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, ReleaseSnoozedIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, MultipleIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, SnoozeNonInteractedIPH) { … }
TEST_P(FeaturePromoLifecycleTypesTest, NewProfile) { … }
TEST_P(FeaturePromoLifecycleTypesTest, MaxShowCountReached) { … }
TEST_P(FeaturePromoLifecycleTypesTest, MaxShowCountNotReachedDueToSnooze) { … }
TEST_P(FeaturePromoLifecycleTypesTest, MaxShowCountReachedAfterSnooze) { … }
FeaturePromoLifecycleAppTest;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(FeaturePromoLifecycleAppTest, IPHBlockedKeyedNotice) { … }
TEST_P(FeaturePromoLifecycleAppTest, ReshowAfterDelay) { … }
TEST_P(FeaturePromoLifecycleAppTest, ReshowAfterDelayWithLimit) { … }
}