#include "chrome/browser/ui/views/user_education/browser_user_education_service.h"
#include <cstdint>
#include <map>
#include <optional>
#include <ostream>
#include <sstream>
#include <vector>
#include "base/command_line.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/feature_engagement/tracker_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/user_education/user_education_service.h"
#include "chrome/browser/user_education/user_education_service_factory.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "components/feature_engagement/public/configuration.h"
#include "components/feature_engagement/public/feature_configurations.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/feature_list.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/feature_engagement/test/scoped_iph_feature_list.h"
#include "components/user_education/common/feature_promo_registry.h"
#include "components/user_education/common/feature_promo_specification.h"
#include "components/user_education/common/tutorial_identifier.h"
#include "components/user_education/common/user_education_features.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/interaction_sequence.h"
namespace {
enum class IPHFailureReason { … };
struct IPHException { … };
struct IPHFailure { … };
std::ostream& operator<<(std::ostream& os,
feature_engagement::ComparatorType type) { … }
std::ostream& operator<<(std::ostream& os,
feature_engagement::SessionRateImpact::Type type) { … }
std::ostream& operator<<(std::ostream& os, const IPHFailure& failure) { … }
template <typename T, typename U>
void MaybeAddFailure(T& failures,
const U& exceptions,
const base::Feature* feature,
IPHFailureReason reason,
const feature_engagement::FeatureConfig* feature_config) { … }
template <typename T>
std::string FailuresToString(const T& failures, const char* type) { … }
bool IsComparatorLimited(const feature_engagement::Comparator& comparator,
uint32_t max_count) { … }
}
BrowserUserEducationServiceBrowserTest;
IN_PROC_BROWSER_TEST_F(BrowserUserEducationServiceBrowserTest,
FeatureConfigurationConsistencyCheck) { … }
namespace {
enum class TutorialFailureReason { … };
struct TutorialFailure { … };
std::ostream& operator<<(std::ostream& os, const TutorialFailure& failure) { … }
}
IN_PROC_BROWSER_TEST_F(BrowserUserEducationServiceBrowserTest,
TutorialConsistencyCheck) { … }
IN_PROC_BROWSER_TEST_F(BrowserUserEducationServiceBrowserTest, AutoConfigure) { … }
class BrowserUserEducationServiceNewBadgeBrowserTest
: public InProcessBrowserTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(BrowserUserEducationServiceNewBadgeBrowserTest,
ShowsNewBadge) { … }
IN_PROC_BROWSER_TEST_P(BrowserUserEducationServiceNewBadgeBrowserTest,
IncognitoDoesNotShowBadge) { … }
class BrowserUserEducationServiceRecentSessionsTest
: public InProcessBrowserTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(BrowserUserEducationServiceRecentSessionsTest,
RecentSessionTrackerDependsOnFlag) { … }
class BrowserUserEducationServiceCommandLineTest
: public BrowserUserEducationServiceBrowserTest,
public testing::WithParamInterface<bool> { … };
INSTANTIATE_TEST_SUITE_P(…);
IN_PROC_BROWSER_TEST_P(BrowserUserEducationServiceCommandLineTest,
DisableUserEducationRateLimiting) { … }