chromium/chrome/browser/ui/views/omnibox/omnibox_popup_view_views_browsertest.cc

// Copyright 2018 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/omnibox/omnibox_popup_view_views.h"

#include <memory>

#include "base/strings/utf_string_conversions.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
#include "chrome/browser/extensions/chrome_test_extension_loader.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/test/theme_service_changed_waiter.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_popup_view_views_test.h"
#include "chrome/browser/ui/views/omnibox/omnibox_result_view.h"
#include "chrome/browser/ui/views/omnibox/omnibox_view_views.h"
#include "chrome/browser/ui/views/omnibox/rounded_omnibox_results_frame.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/omnibox/browser/actions/tab_switch_action.h"
#include "components/omnibox/browser/fake_autocomplete_provider.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/browser/omnibox_popup_selection.h"
#include "components/omnibox/browser/omnibox_prefs.h"
#include "components/omnibox/browser/omnibox_triggered_feature_service.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/test_utils.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/theme_provider.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider_utils.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/accessibility/ax_event_manager.h"
#include "ui/views/accessibility/ax_event_observer.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/test/views_test_utils.h"
#include "ui/views/widget/widget.h"

#if defined(USE_AURA)
#include "ui/aura/window.h"
#endif

namespace {

bool contains(std::string str, std::string substr) {}

// A View that positions itself over another View to intercept clicks.
class ClickTrackingOverlayView : public views::View {};

BEGIN_METADATA()

class TestAXEventObserver : public views::AXEventObserver {};

}  // namespace

// Tests widget alignment of the different popup types.
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest, PopupAlignment) {}

// Integration test for omnibox popup theming in regular.
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest, ThemeIntegration) {}

IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest, ThemeIntegrationInIncognito) {}

// TODO(tapted): https://crbug.com/905508 Fix and enable on Mac.
#if BUILDFLAG(IS_MAC)
#define MAYBE_ClickOmnibox
#else
#define MAYBE_ClickOmnibox
#endif
// Test that clicks over the omnibox do not hit the popup.
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest, MAYBE_ClickOmnibox) {}

// Flaky on Mac: https://crbug.com/1140153.
#if BUILDFLAG(IS_MAC)
#define MAYBE_EmitAccessibilityEvents
#else
#define MAYBE_EmitAccessibilityEvents
#endif
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       MAYBE_EmitAccessibilityEvents) {}

IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       AccessibleSelectionOnResultSelection) {}

// Flaky on Mac: https://crbug.com/1146627.
#if BUILDFLAG(IS_MAC)
#define MAYBE_EmitAccessibilityEventsOnButtonFocusHint
#else
#define MAYBE_EmitAccessibilityEventsOnButtonFocusHint
#endif
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       MAYBE_EmitAccessibilityEventsOnButtonFocusHint) {}

IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       EmitSelectedChildrenChangedAccessibilityEvent) {}

IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest, DeleteSuggestion) {}

// Flaky on Mac: https://crbug.com/1511356
#if BUILDFLAG(IS_MAC)
#define MAYBE_SpaceEntersKeywordMode
#else
#define MAYBE_SpaceEntersKeywordMode
#endif
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       MAYBE_SpaceEntersKeywordMode) {}

IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       AccesibilityAttributePopupForId) {}

// Changing selection in omnibox popup view should update activedescendant id in
// omnibox view.
IN_PROC_BROWSER_TEST_F(OmniboxPopupViewViewsTest,
                       AccessibleActivedescendantId) {}