#include "components/user_education/common/tutorial.h"
#include <optional>
#include <string>
#include <string_view>
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/bind.h"
#include "base/test/gtest_util.h"
#include "base/test/mock_callback.h"
#include "base/test/scoped_run_loop_timeout.h"
#include "base/test/task_environment.h"
#include "components/strings/grit/components_strings.h"
#include "components/user_education/common/events.h"
#include "components/user_education/common/help_bubble_factory_registry.h"
#include "components/user_education/common/help_bubble_params.h"
#include "components/user_education/common/tutorial_description.h"
#include "components/user_education/common/tutorial_identifier.h"
#include "components/user_education/common/tutorial_registry.h"
#include "components/user_education/common/tutorial_service.h"
#include "components/user_education/test/test_help_bubble.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_identifier.h"
#include "ui/base/interaction/element_test_util.h"
#include "ui/base/interaction/element_tracker.h"
#include "ui/base/interaction/expect_call_in_scope.h"
#include "ui/base/interaction/interaction_sequence.h"
#include "ui/base/interaction/interaction_sequence_test_util.h"
#include "ui/base/interaction/interactive_test.h"
#include "ui/base/l10n/l10n_util.h"
namespace user_education {
namespace {
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(…);
DEFINE_LOCAL_CUSTOM_ELEMENT_EVENT_TYPE(…);
const char kTestElementName1[] = …;
const ui::ElementContext kTestContext1(1);
const TutorialIdentifier kTestTutorial1{ … };
const TutorialIdentifier kTestTutorial2{ … };
const TutorialIdentifier kTestTutorial3{ … };
const char kHistogramName1[] = …;
const char kHistogramName2[] = …;
class TestTutorialService : public TutorialService { … };
class ScopedTestTutorialState : public user_education::ScopedTutorialState { … };
std::unique_ptr<HelpBubbleFactoryRegistry>
CreateTestTutorialBubbleFactoryRegistry() { … }
void ClickDismissButton(HelpBubble* bubble) { … }
void ClickCloseButton(HelpBubble* bubble) { … }
void ClickNextButton(HelpBubble* bubble) { … }
void ClickRestartButton(HelpBubble* bubble) { … }
bool HasButtonWithText(HelpBubble* bubble, int message_id) { … }
}
class TutorialTest : public testing::Test { … };
TEST_F(TutorialTest, TutorialBuilder) { … }
TEST_F(TutorialTest, RegisterTutorial) { … }
TEST_F(TutorialTest, RegisterMultipleTutorials) { … }
TEST_F(TutorialTest, RegisterSameTutorialTwice) { … }
TEST_F(TutorialTest, RegisterTutorialsWithAndWithoutHistograms) { … }
TEST_F(TutorialTest, RegisterSameTutorialInMultipleRegistries) { … }
TEST_F(TutorialTest, SingleInteractionTutorialRuns) { … }
TEST_F(TutorialTest, MultipleInteractionTutorialRuns) { … }
TEST_F(TutorialTest, StartTutorialAbortsExistingTutorial) { … }
TEST_F(TutorialTest, StartTutorialCompletesExistingTutorial) { … }
TEST_F(TutorialTest, TutorialWithCustomEvent) { … }
TEST_F(TutorialTest, TutorialWithNamedElement) { … }
TEST_F(TutorialTest, TutorialWithExtendedProperties) { … }
TEST_F(TutorialTest, SingleStepRestartTutorial) { … }
TEST_F(TutorialTest, SingleStepRestartTutorialCanRestartMultipleTimes) { … }
TEST_F(TutorialTest, MultiStepRestartTutorialWithCloseOnComplete) { … }
TEST_F(TutorialTest, MultiStepRestartTutorialWithDismissAfterRestart) { … }
TEST_F(TutorialTest, MultiStepRestartTutorialCanRestartMultipleTimes) { … }
TEST_F(TutorialTest, BubbleClosingProgrammaticallyOnlyEndsTutorialOnLastStep) { … }
TEST_F(TutorialTest, TimeoutBeforeFirstBubble) { … }
TEST_F(TutorialTest, TimeoutBetweenBubbles) { … }
TEST_F(TutorialTest, NoTimeoutIfBubbleShowing) { … }
TEST_F(TutorialTest, RegisterTutorialWithCreate) { … }
TEST_F(TutorialTest, RegisterTutorialWithCreateFromVector) { … }
TEST_F(TutorialTest, SetupTemporaryStateCallback) { … }
TEST_F(TutorialTest, CleanupTemporaryStateOnAbort) { … }
class ConditionalTutorialTest : public ui::test::InteractiveTestT<TutorialTest>,
public testing::WithParamInterface<int> { … };
ConditionalTutorialTest1;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ConditionalTutorialTest1, ConditionalAtStartOfTutorial) { … }
TEST_P(ConditionalTutorialTest1, ConditionalInMiddleOfTutorial) { … }
TEST_P(ConditionalTutorialTest1, ConditionalAtEndOfTutorial) { … }
TEST_P(ConditionalTutorialTest1, ConditionalAtEndOfTutorialUnevenSteps) { … }
TEST_P(ConditionalTutorialTest1, OptionalStep) { … }
TEST_P(ConditionalTutorialTest1, WaitForAnyOf) { … }
ConditionalTutorialTest2;
INSTANTIATE_TEST_SUITE_P(…);
TEST_P(ConditionalTutorialTest2, NestedConditionals) { … }
}