1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
// 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 "chrome/browser/ui/views/user_education/browser_help_bubble.h"
#include <string>
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/test/interaction/interactive_browser_test.h"
#include "components/user_education/common/feature_promo/feature_promo_specification.h"
#include "content/public/test/browser_test.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/interaction/element_tracker.h"
class BrowserHelpBubbleBrowsertest : public InteractiveBrowserTest {
public:
BrowserHelpBubbleBrowsertest() = default;
~BrowserHelpBubbleBrowsertest() override = default;
};
IN_PROC_BROWSER_TEST_F(BrowserHelpBubbleBrowsertest,
GetFocusHelpBubbleScreenReaderHint_Toast) {
RunTestSequence(CheckElement(
kToolbarAppMenuButtonElementId,
[this](ui::TrackedElement* el) {
return BrowserHelpBubble::GetFocusHelpBubbleScreenReaderHint(
user_education::FeaturePromoSpecification::PromoType::kToast,
BrowserView::GetBrowserViewForBrowser(browser()), el);
},
testing::Eq(std::u16string())));
}
IN_PROC_BROWSER_TEST_F(BrowserHelpBubbleBrowsertest,
GetFocusHelpBubbleScreenReaderHint_Abridged) {
RunTestSequence(CheckElement(
kTabIconElementId,
[this](ui::TrackedElement* el) {
return BrowserHelpBubble::GetFocusHelpBubbleScreenReaderHint(
user_education::FeaturePromoSpecification::PromoType::kSnooze,
BrowserView::GetBrowserViewForBrowser(browser()), el);
},
testing::Ne(std::u16string())));
}
IN_PROC_BROWSER_TEST_F(BrowserHelpBubbleBrowsertest,
GetFocusHelpBubbleScreenReaderHint_Tutorial) {
RunTestSequence(CheckElement(
kToolbarAppMenuButtonElementId,
[this](ui::TrackedElement* el) {
return BrowserHelpBubble::GetFocusHelpBubbleScreenReaderHint(
user_education::FeaturePromoSpecification::PromoType::kTutorial,
BrowserView::GetBrowserViewForBrowser(browser()), el);
},
testing::Ne(std::u16string())));
}
IN_PROC_BROWSER_TEST_F(BrowserHelpBubbleBrowsertest,
GetFocusTutorialBubbleScreenReaderHint) {
RunTestSequence(CheckElement(
kToolbarAppMenuButtonElementId,
[this](ui::TrackedElement* el) {
return BrowserHelpBubble::GetFocusTutorialBubbleScreenReaderHint(
BrowserView::GetBrowserViewForBrowser(browser()));
},
testing::Ne(std::u16string())));
}
IN_PROC_BROWSER_TEST_F(BrowserHelpBubbleBrowsertest,
GetFocusBubbleAcceleratorText) {
RunTestSequence(CheckView(
kBrowserViewElementId,
[](BrowserView* browser_view) {
return BrowserHelpBubble::GetFocusBubbleAcceleratorText(browser_view);
},
testing::Ne(std::u16string())));
}
|