chromium/ui/views/BUILD.gn

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/features.gni")
import("//build/config/ozone.gni")
import("//build/config/ui.gni")
import("//build/nocompile.gni")
import("//components/metrics/generate_allowlist_from_histograms_file.gni")
import("//components/vector_icons/vector_icons.gni")
import("//skia/features.gni")
import("//testing/test.gni")
import("//ui/base/ui_features.gni")
import("//ui/views/features.gni")

assert(toolkit_views)

config("flags") {
  defines = [ "TOOLKIT_VIEWS=1" ]
}

aggregate_vector_icons("views_vector_icons") {
  icon_directory = "vector_icons"

  sources = [
    "checkbox_active.icon",
    "checkbox_check_cr2023.icon",
    "checkbox_normal.icon",
    "checkbox_normal_cr2023.icon",
    "close.icon",
    "drag_general_selection.icon",
    "eye.icon",
    "eye_crossed.icon",
    "eye_crossed_refresh.icon",
    "eye_refresh.icon",
    "ic_close.icon",
    "info.icon",
    "info_chrome_refresh.icon",
    "launch.icon",
    "linux_high_density.icon",
    "linux_low_density.icon",
    "menu_check.icon",
    "menu_drop_arrow.icon",
    "menu_radio_empty.icon",
    "menu_radio_selected.icon",
    "new_incognito_window.icon",
    "new_tab.icon",
    "new_window.icon",
    "open.icon",
    "options.icon",
    "pin.icon",
    "radio_button_active.icon",
    "radio_button_normal.icon",
    "uninstall.icon",
    "unpin.icon",
  ]
}

generate_allowlist_from_histograms_file("bubble_histograms_variant") {
  namespace = "views_metrics"
  input_xml_file = "//tools/metrics/histograms/metadata/views/histograms.xml"
  tag = "variant"
  output_file = "bubble_histograms_variant.h"
  allow_list_name = "BubbleName"
}

buildflag_header("buildflags") {
  header = "buildflags.h"
  flags = [
    "ENABLE_DESKTOP_AURA=$enable_desktop_aura",
    "SUPPORTS_AX_TEXT_OFFSETS=$supports_ax_text_offsets",
  ]
}

component("views") {
  all_dependent_configs = [ ":flags" ]

  public = [
    "accessibility/accessibility_paint_checks.h",
    "accessibility/atomic_view_ax_tree_manager.h",
    "accessibility/ax_event_manager.h",
    "accessibility/ax_event_observer.h",
    "accessibility/ax_virtual_view.h",
    "accessibility/view_accessibility.h",
    "accessibility/view_accessibility_utils.h",
    "accessibility/widget_ax_tree_id_map.h",
    "accessible_pane_view.h",
    "actions/action_view_controller.h",
    "actions/action_view_interface.h",
    "animation/animation_abort_handle.h",
    "animation/animation_builder.h",
    "animation/animation_delegate_views.h",
    "animation/animation_sequence_block.h",
    "animation/bounds_animator.h",
    "animation/bounds_animator_observer.h",
    "animation/bubble_slide_animator.h",
    "animation/compositor_animation_runner.h",
    "animation/flood_fill_ink_drop_ripple.h",
    "animation/ink_drop.h",
    "animation/ink_drop_animation_ended_reason.h",
    "animation/ink_drop_event_handler.h",
    "animation/ink_drop_highlight.h",
    "animation/ink_drop_highlight_observer.h",
    "animation/ink_drop_host.h",
    "animation/ink_drop_impl.h",
    "animation/ink_drop_mask.h",
    "animation/ink_drop_observer.h",
    "animation/ink_drop_painted_layer_delegates.h",
    "animation/ink_drop_ripple.h",
    "animation/ink_drop_ripple_observer.h",
    "animation/ink_drop_state.h",
    "animation/ink_drop_stub.h",
    "animation/ink_drop_util.h",
    "animation/pulsing_ink_drop_mask.h",
    "animation/scroll_animator.h",
    "animation/slide_out_controller.h",
    "animation/slide_out_controller_delegate.h",
    "animation/square_ink_drop_ripple.h",
    "animation/widget_fade_animator.h",
    "background.h",
    "badge_painter.h",
    "border.h",
    "bubble/bubble_border.h",
    "bubble/bubble_border_arrow_utils.h",
    "bubble/bubble_dialog_delegate_view.h",
    "bubble/bubble_dialog_model_host.h",
    "bubble/bubble_dialog_utils.h",
    "bubble/bubble_frame_view.h",
    "bubble/info_bubble.h",
    "bubble/tooltip_icon.h",
    "button_drag_utils.h",
    "cascading_property.h",
    "color_chooser/color_chooser_listener.h",
    "context_menu_controller.h",
    "controls/animated_image_view.h",
    "controls/badge.h",
    "controls/bulleted_label_list/bulleted_label_list_view.h",
    "controls/button/button.h",
    "controls/button/button_controller.h",
    "controls/button/button_controller_delegate.h",
    "controls/button/checkbox.h",
    "controls/button/image_button.h",
    "controls/button/image_button_factory.h",
    "controls/button/label_button.h",
    "controls/button/label_button_border.h",
    "controls/button/label_button_image_container.h",
    "controls/button/md_text_button.h",
    "controls/button/md_text_button_with_down_arrow.h",
    "controls/button/menu_button.h",
    "controls/button/menu_button_controller.h",
    "controls/button/radio_button.h",
    "controls/button/toggle_button.h",
    "controls/combobox/combobox.h",
    "controls/combobox/combobox_menu_model.h",
    "controls/combobox/combobox_util.h",
    "controls/dot_indicator.h",
    "controls/editable_combobox/editable_combobox.h",
    "controls/editable_combobox/editable_password_combobox.h",
    "controls/focus_ring.h",
    "controls/focusable_border.h",
    "controls/highlight_path_generator.h",
    "controls/image_view.h",
    "controls/image_view_base.h",
    "controls/label.h",
    "controls/link.h",
    "controls/link_fragment.h",
    "controls/menu/menu_config.h",
    "controls/menu/menu_controller.h",
    "controls/menu/menu_controller_delegate.h",
    "controls/menu/menu_delegate.h",
    "controls/menu/menu_host.h",
    "controls/menu/menu_host_root_view.h",
    "controls/menu/menu_insertion_delegate_win.h",
    "controls/menu/menu_item_view.h",
    "controls/menu/menu_model_adapter.h",
    "controls/menu/menu_runner.h",
    "controls/menu/menu_runner_handler.h",
    "controls/menu/menu_runner_impl.h",
    "controls/menu/menu_runner_impl_adapter.h",
    "controls/menu/menu_runner_impl_interface.h",
    "controls/menu/menu_scroll_view_container.h",
    "controls/menu/menu_separator.h",
    "controls/menu/menu_types.h",
    "controls/menu/submenu_view.h",
    "controls/message_box_view.h",
    "controls/native/native_view_host.h",
    "controls/native/native_view_host_mac.h",
    "controls/native/native_view_host_wrapper.h",
    "controls/prefix_delegate.h",
    "controls/prefix_selector.h",
    "controls/progress_bar.h",
    "controls/progress_ring_utils.h",
    "controls/resize_area.h",
    "controls/resize_area_delegate.h",
    "controls/scroll_view.h",
    "controls/scrollbar/base_scroll_bar_thumb.h",
    "controls/scrollbar/overlay_scroll_bar.h",
    "controls/scrollbar/scroll_bar.h",
    "controls/scrollbar/scroll_bar_button.h",
    "controls/scrollbar/scroll_bar_views.h",
    "controls/separator.h",
    "controls/slider.h",
    "controls/styled_label.h",
    "controls/tabbed_pane/tabbed_pane.h",
    "controls/tabbed_pane/tabbed_pane_listener.h",
    "controls/table/table_grouper.h",
    "controls/table/table_header.h",
    "controls/table/table_utils.h",
    "controls/table/table_view.h",
    "controls/table/table_view_observer.h",
    "controls/textarea/textarea.h",
    "controls/textfield/textfield.h",
    "controls/textfield/textfield_controller.h",
    "controls/textfield/textfield_model.h",
    "controls/theme_tracking_image_view.h",
    "controls/throbber.h",
    "controls/tree/tree_view.h",
    "controls/tree/tree_view_controller.h",
    "controls/tree/tree_view_drawing_provider.h",
    "controls/views_text_services_context_menu.h",
    "controls/views_text_services_context_menu_base.h",
    "debug_utils.h",
    "dialog_model_context_menu_controller.h",
    "drag_controller.h",
    "drag_utils.h",
    "event_monitor.h",
    "focus/external_focus_tracker.h",
    "focus/focus_manager.h",
    "focus/focus_manager_delegate.h",
    "focus/focus_manager_factory.h",
    "focus/focus_search.h",
    "focus/widget_focus_manager.h",
    "input_event_activation_protector.h",
    "interaction/element_tracker_views.h",
    "interaction/interaction_sequence_views.h",
    "layout/animating_layout_manager.h",
    "layout/box_layout.h",
    "layout/box_layout_view.h",
    "layout/delegating_layout_manager.h",
    "layout/fill_layout.h",
    "layout/flex_layout.h",
    "layout/flex_layout_types.h",
    "layout/flex_layout_view.h",
    "layout/layout_manager.h",
    "layout/layout_manager_base.h",
    "layout/layout_provider.h",
    "layout/layout_types.h",
    "layout/normalized_geometry.h",
    "layout/proposed_layout.h",
    "layout/table_layout.h",
    "layout/table_layout_view.h",
    "masked_targeter_delegate.h",
    "metadata/type_conversion.h",
    "metadata/view_factory.h",
    "metadata/view_factory_internal.h",
    "metrics.h",
    "mouse_constants.h",
    "mouse_watcher.h",
    "mouse_watcher_view_host.h",
    "native_theme_delegate.h",
    "native_window_tracker.h",
    "paint_info.h",
    "painter.h",
    "rect_based_targeting_utils.h",
    "repeat_controller.h",
    "round_rect_painter.h",
    "selection_controller.h",
    "selection_controller_delegate.h",
    "style/platform_style.h",
    "style/typography.h",
    "style/typography_provider.h",
    "touchui/touch_selection_controller.h",
    "view.h",
    "view_class_properties.h",
    "view_constants.h",
    "view_model.h",
    "view_model_utils.h",
    "view_observer.h",
    "view_shadow.h",
    "view_targeter.h",
    "view_targeter_delegate.h",
    "view_tracker.h",
    "view_utils.h",
    "views_delegate.h",
    "views_export.h",
    "views_features.h",
    "views_switches.h",
    "widget/any_widget_observer.h",
    "widget/any_widget_observer_singleton.h",
    "widget/drop_helper.h",
    "widget/native_widget.h",
    "widget/native_widget_delegate.h",
    "widget/native_widget_private.h",
    "widget/root_view.h",
    "widget/root_view_targeter.h",
    "widget/sublevel_manager.h",
    "widget/tooltip_manager.h",
    "widget/unique_widget_ptr.h",
    "widget/widget.h",
    "widget/widget_delegate.h",
    "widget/widget_deletion_observer.h",
    "widget/widget_observer.h",
    "widget/widget_removals_observer.h",
    "widget/widget_utils.h",
    "window/caption_button_layout_constants.h",
    "window/caption_button_types.h",
    "window/client_view.h",
    "window/custom_frame_view.h",
    "window/dialog_client_view.h",
    "window/dialog_delegate.h",
    "window/dialog_observer.h",
    "window/frame_background.h",
    "window/frame_buttons.h",
    "window/frame_caption_button.h",
    "window/hit_test_utils.h",
    "window/native_frame_view.h",
    "window/non_client_view.h",
    "window/window_button_order_provider.h",
    "window/window_resources.h",
    "window/window_shape.h",
    "windows_stationarity_monitor.h",
    "word_lookup_client.h",
  ]

  sources = [
    "accessibility/accessibility_paint_checks.cc",
    "accessibility/atomic_view_ax_tree_manager.cc",
    "accessibility/ax_event_manager.cc",
    "accessibility/ax_event_observer.cc",
    "accessibility/ax_virtual_view.cc",
    "accessibility/view_accessibility.cc",
    "accessibility/view_accessibility_utils.cc",
    "accessible_pane_view.cc",
    "actions/action_view_controller.cc",
    "actions/action_view_interface.cc",
    "animation/animation_abort_handle.cc",
    "animation/animation_builder.cc",
    "animation/animation_delegate_views.cc",
    "animation/animation_key.h",
    "animation/animation_sequence_block.cc",
    "animation/bounds_animator.cc",
    "animation/bubble_slide_animator.cc",
    "animation/compositor_animation_runner.cc",
    "animation/flood_fill_ink_drop_ripple.cc",
    "animation/ink_drop.cc",
    "animation/ink_drop_animation_ended_reason.cc",
    "animation/ink_drop_event_handler.cc",
    "animation/ink_drop_highlight.cc",
    "animation/ink_drop_host.cc",
    "animation/ink_drop_impl.cc",
    "animation/ink_drop_mask.cc",
    "animation/ink_drop_painted_layer_delegates.cc",
    "animation/ink_drop_ripple.cc",
    "animation/ink_drop_state.cc",
    "animation/ink_drop_stub.cc",
    "animation/ink_drop_util.cc",
    "animation/pulsing_ink_drop_mask.cc",
    "animation/scroll_animator.cc",
    "animation/slide_out_controller.cc",
    "animation/square_ink_drop_ripple.cc",
    "animation/widget_fade_animator.cc",
    "background.cc",
    "badge_painter.cc",
    "border.cc",
    "bubble/bubble_border.cc",
    "bubble/bubble_border_arrow_utils.cc",
    "bubble/bubble_dialog_delegate_view.cc",
    "bubble/bubble_dialog_model_host.cc",
    "bubble/bubble_dialog_utils.cc",
    "bubble/bubble_frame_view.cc",
    "bubble/footnote_container_view.cc",
    "bubble/info_bubble.cc",
    "bubble/tooltip_icon.cc",
    "button_drag_utils.cc",
    "cascading_property.cc",
    "context_menu_controller.cc",
    "controls/animated_image_view.cc",
    "controls/badge.cc",
    "controls/bulleted_label_list/bulleted_label_list_view.cc",
    "controls/button/button.cc",
    "controls/button/button_controller.cc",
    "controls/button/checkbox.cc",
    "controls/button/image_button.cc",
    "controls/button/image_button_factory.cc",
    "controls/button/label_button.cc",
    "controls/button/label_button_border.cc",
    "controls/button/label_button_image_container.cc",
    "controls/button/md_text_button.cc",
    "controls/button/md_text_button_with_down_arrow.cc",
    "controls/button/menu_button.cc",
    "controls/button/menu_button_controller.cc",
    "controls/button/radio_button.cc",
    "controls/button/toggle_button.cc",
    "controls/combobox/combobox.cc",
    "controls/combobox/combobox_menu_model.cc",
    "controls/combobox/combobox_util.cc",
    "controls/combobox/empty_combobox_model.cc",
    "controls/combobox/empty_combobox_model.h",
    "controls/dot_indicator.cc",
    "controls/editable_combobox/editable_combobox.cc",
    "controls/editable_combobox/editable_password_combobox.cc",
    "controls/focus_ring.cc",
    "controls/focusable_border.cc",
    "controls/highlight_path_generator.cc",
    "controls/image_view.cc",
    "controls/image_view_base.cc",
    "controls/label.cc",
    "controls/link.cc",
    "controls/link_fragment.cc",
    "controls/menu/menu_config.cc",
    "controls/menu/menu_controller.cc",
    "controls/menu/menu_delegate.cc",
    "controls/menu/menu_host.cc",
    "controls/menu/menu_host_root_view.cc",
    "controls/menu/menu_item_view.cc",
    "controls/menu/menu_model_adapter.cc",
    "controls/menu/menu_runner.cc",
    "controls/menu/menu_runner_impl.cc",
    "controls/menu/menu_runner_impl_adapter.cc",
    "controls/menu/menu_scroll_view_container.cc",
    "controls/menu/menu_separator.cc",
    "controls/menu/submenu_view.cc",
    "controls/message_box_view.cc",
    "controls/native/native_view_host.cc",
    "controls/prefix_selector.cc",
    "controls/progress_bar.cc",
    "controls/progress_ring_utils.cc",
    "controls/resize_area.cc",
    "controls/scroll_view.cc",
    "controls/scrollbar/base_scroll_bar_thumb.cc",
    "controls/scrollbar/overlay_scroll_bar.cc",
    "controls/scrollbar/scroll_bar.cc",
    "controls/scrollbar/scroll_bar_button.cc",
    "controls/scrollbar/scroll_bar_views.cc",
    "controls/separator.cc",
    "controls/slider.cc",
    "controls/styled_label.cc",
    "controls/tabbed_pane/tabbed_pane.cc",
    "controls/table/table_header.cc",
    "controls/table/table_utils.cc",
    "controls/table/table_view.cc",
    "controls/textarea/textarea.cc",
    "controls/textfield/textfield.cc",
    "controls/textfield/textfield_controller.cc",
    "controls/textfield/textfield_model.cc",
    "controls/theme_tracking_image_view.cc",
    "controls/throbber.cc",
    "controls/tree/tree_view.cc",
    "controls/tree/tree_view_controller.cc",
    "controls/tree/tree_view_drawing_provider.cc",
    "controls/views_text_services_context_menu_base.cc",
    "debug_utils.cc",
    "dialog_model_context_menu_controller.cc",
    "drag_utils.cc",
    "focus/external_focus_tracker.cc",
    "focus/focus_manager.cc",
    "focus/focus_manager_factory.cc",
    "focus/focus_search.cc",
    "focus/widget_focus_manager.cc",
    "input_event_activation_protector.cc",
    "interaction/element_tracker_views.cc",
    "interaction/interaction_sequence_views.cc",
    "layout/animating_layout_manager.cc",
    "layout/box_layout.cc",
    "layout/box_layout_view.cc",
    "layout/delegating_layout_manager.cc",
    "layout/fill_layout.cc",
    "layout/flex_layout.cc",
    "layout/flex_layout_types.cc",
    "layout/flex_layout_view.cc",
    "layout/layout_manager.cc",
    "layout/layout_manager_base.cc",
    "layout/layout_provider.cc",
    "layout/layout_types.cc",
    "layout/normalized_geometry.cc",
    "layout/proposed_layout.cc",
    "layout/table_layout.cc",
    "layout/table_layout_view.cc",
    "masked_targeter_delegate.cc",
    "metadata/type_conversion.cc",
    "metadata/view_factory_internal.cc",
    "metrics.cc",
    "mouse_watcher.cc",
    "mouse_watcher_view_host.cc",
    "paint_info.cc",
    "painter.cc",
    "rect_based_targeting_utils.cc",
    "repeat_controller.cc",
    "round_rect_painter.cc",
    "selection_controller.cc",
    "style/platform_style.cc",
    "style/typography_provider.cc",
    "view.cc",
    "view_class_properties.cc",
    "view_constants.cc",
    "view_model.cc",
    "view_model_utils.cc",
    "view_shadow.cc",
    "view_targeter.cc",
    "view_targeter_delegate.cc",
    "view_tracker.cc",
    "view_utils.cc",
    "views_delegate.cc",
    "views_features.cc",
    "views_switches.cc",
    "widget/any_widget_observer.cc",
    "widget/any_widget_observer_singleton.cc",
    "widget/drop_helper.cc",
    "widget/native_widget_private.cc",
    "widget/root_view.cc",
    "widget/root_view_targeter.cc",
    "widget/sublevel_manager.cc",
    "widget/tooltip_manager.cc",
    "widget/unique_widget_ptr.cc",
    "widget/widget.cc",
    "widget/widget_aura_utils.cc",
    "widget/widget_delegate.cc",
    "widget/widget_deletion_observer.cc",
    "widget/widget_utils.cc",
    "window/caption_button_layout_constants.cc",
    "window/client_view.cc",
    "window/custom_frame_view.cc",
    "window/dialog_client_view.cc",
    "window/dialog_delegate.cc",
    "window/frame_background.cc",
    "window/frame_caption_button.cc",
    "window/hit_test_utils.cc",
    "window/native_frame_view.cc",
    "window/non_client_view.cc",
    "window/window_button_order_provider.cc",
    "window/window_shape.cc",
    "windows_stationarity_monitor.cc",
  ]

  # Other targets in this file (e.g. tests) get access to the internal headers.
  friend = [ ":*" ]

  # Internal sources. TODO(crbug.com/41406123): Move more headers from
  # public into this list, along with the implementation file.
  sources += [
    "controls/button/label_button_label.cc",
    "controls/button/label_button_label.h",
    "controls/menu/menu_pre_target_handler.h",
  ]

  sources += get_target_outputs(":bubble_histograms_variant")
  sources += get_target_outputs(":views_vector_icons")

  configs += [
    "//build/config:precompiled_headers",
    "//build/config/compiler:prevent_unsafe_narrowing",
  ]

  defines = [ "VIEWS_IMPLEMENTATION" ]

  deps = [
    "//base:i18n",
    "//build:chromeos_buildflags",
    "//cc/paint",
    "//components/url_formatter",
    "//mojo/public/cpp/bindings",
    "//skia",
    "//third_party/icu",
    "//ui/accessibility",
    "//ui/actions",
    "//ui/base/clipboard",
    "//ui/base/dragdrop/mojom",
    "//ui/base/emoji",
    "//ui/color",
    "//ui/color:mixers",
    "//ui/compositor_extra",
    "//ui/display",
    "//ui/gfx:native_widget_types",
    "//ui/latency",
    "//ui/lottie",
    "//ui/native_theme",
    "//ui/native_theme:native_theme_browser",
    "//ui/resources",
    "//ui/strings",
    "//ui/touch_selection",
    "//ui/views/debug:views_debug",
    "//ui/views/resources",
    "//url",
  ]

  public_deps = [
    ":bubble_histograms_variant",
    ":buildflags",
    ":views_vector_icons",
    "//base",
    "//components/vector_icons",
    "//third_party/abseil-cpp:absl",
    "//ui/accessibility:ax_enums_mojo",
    "//ui/base",
    "//ui/base/clipboard",
    "//ui/base/cursor",
    "//ui/base/dragdrop:types",
    "//ui/base/dragdrop/mojom:mojom_headers",
    "//ui/base/emoji",
    "//ui/base/ime/init",
    "//ui/base/metadata",
    "//ui/base/mojom:mojom",
    "//ui/base/mojom:ui_base_types",
    "//ui/compositor",
    "//ui/display",
    "//ui/events",
    "//ui/events:events_base",
    "//ui/events/platform",
    "//ui/gfx",
    "//ui/gfx/animation",
    "//ui/gfx/geometry",
    "//ui/touch_selection/vector_icons",
    "//ui/views/resources",
    "//ui/views/window/vector_icons",
  ]

  if (is_chromeos_ash) {
    deps += [
      "//ash/constants",
      "//ui/base/ime/ash",
    ]
  }

  if (is_chromeos) {
    public += [ "highlight_border.h" ]
    sources += [ "highlight_border.cc" ]
    deps += [
      "//chromeos/constants",
      "//ui/chromeos/styles:cros_tokens_color_mappings_generator",
    ]
  }

  if (is_linux) {
    public_deps += [ "//ui/linux:linux_ui" ]
  }

  if (is_linux || is_chromeos || is_fuchsia) {
    public += [ "color_chooser/color_chooser_view.h" ]
    sources += [ "color_chooser/color_chooser_view.cc" ]
  }

  if (is_linux || is_chromeos_lacros) {
    deps += [ "//ui/base/ime/linux" ]
    if (!is_chromeos_lacros) {
      sources += [ "controls/menu/menu_config_linux.cc" ]
    }
  }

  if (is_chromeos) {
    public += [ "controls/views_text_services_context_menu_chromeos.h" ]
    sources += [
      "controls/menu/menu_config_chromeos.cc",
      "controls/views_text_services_context_menu_chromeos.cc",
    ]
  }

  if (is_mac) {
    public += [
      "cocoa/immersive_mode_reveal_client.h",
      "cocoa/native_widget_mac_ns_window_host.h",
      "controls/menu/menu_closure_animation_mac.h",
      "controls/menu/menu_cocoa_watcher_mac.h",
      "controls/menu/menu_controller_cocoa_delegate_params.h",
      "controls/menu/menu_runner_impl_cocoa.h",
      "controls/menu/menu_runner_impl_mac.h",
      "controls/menu/menu_runner_impl_remote_cocoa.h",
      "controls/scrollbar/cocoa_scroll_bar.h",
      "event_monitor_mac.h",
      "widget/native_widget_mac.h",
      "widget/widget_utils_mac.h",
      "window/native_frame_view_mac.h",
      "windows_stationarity_monitor_mac.h",
    ]
    sources += [
      "accessibility/ax_virtual_view_mac.mm",
      "cocoa/drag_drop_client_mac.h",
      "cocoa/drag_drop_client_mac.mm",
      "cocoa/native_widget_mac_event_monitor.h",
      "cocoa/native_widget_mac_event_monitor.mm",
      "cocoa/native_widget_mac_ns_window_host.mm",
      "cocoa/native_window_tracker_cocoa.h",
      "cocoa/native_window_tracker_cocoa.mm",
      "cocoa/text_input_host.h",
      "cocoa/text_input_host.mm",
      "cocoa/tooltip_manager_mac.h",
      "cocoa/tooltip_manager_mac.mm",
      "controls/menu/menu_closure_animation_mac.mm",
      "controls/menu/menu_cocoa_watcher_mac.mm",
      "controls/menu/menu_config_mac.mm",
      "controls/menu/menu_controller_cocoa_delegate_params.cc",
      "controls/menu/menu_pre_target_handler_mac.h",
      "controls/menu/menu_pre_target_handler_mac.mm",
      "controls/menu/menu_runner_impl_cocoa.mm",
      "controls/menu/menu_runner_impl_mac.mm",
      "controls/menu/menu_runner_impl_remote_cocoa.mm",
      "controls/native/native_view_host_mac.mm",
      "controls/scrollbar/cocoa_scroll_bar.mm",
      "controls/views_text_services_context_menu_mac.mm",
      "drag_utils_mac.mm",
      "event_monitor_mac.mm",
      "metrics_mac.cc",
      "style/platform_style_mac.mm",
      "widget/native_widget_mac.mm",
      "widget/widget_utils_mac.mm",
      "window/native_frame_view_mac.mm",
      "windows_stationarity_monitor_mac.mm",
    ]
    public_deps += [ "//components/remote_cocoa/common:mojo" ]
    deps += [
      "//components/crash/core/common",
      "//components/remote_cocoa/app_shim",
      "//components/remote_cocoa/browser",
      "//ui/accelerated_widget_mac",
      "//ui/events:dom_keycode_converter",
    ]
    frameworks = [
      "AppKit.framework",
      "CoreGraphics.framework",
      "Foundation.framework",
      "IOSurface.framework",
      "QuartzCore.framework",
    ]
  }

  if (is_win) {
    public += [
      "controls/menu/native_menu_win.h",
      "widget/widget_hwnd_utils.h",
      "win/fullscreen_handler.h",
      "win/hwnd_message_handler.h",
      "win/hwnd_message_handler_delegate.h",
      "win/hwnd_message_handler_headless.h",
      "win/hwnd_util.h",
      "win/pen_event_handler_util.h",
      "win/pen_event_processor.h",
      "win/pen_id_handler.h",
      "win/scoped_enable_unadjusted_mouse_events_win.h",
      "win/scoped_fullscreen_visibility.h",
    ]
    sources += [
      "controls/menu/menu_config_win.cc",
      "controls/menu/native_menu_win.cc",
      "widget/widget_hwnd_utils.cc",
      "win/fullscreen_handler.cc",
      "win/hwnd_message_handler.cc",
      "win/hwnd_message_handler_headless.cc",
      "win/hwnd_util.cc",
      "win/pen_event_processor.cc",
      "win/pen_id_handler.cc",
      "win/scoped_enable_unadjusted_mouse_events_win.cc",
      "win/scoped_fullscreen_visibility.cc",
    ]
    libs = [
      "dwmapi.lib",
      "imm32.lib",
      "oleacc.lib",
      "uiautomationcore.lib",
    ]
    ldflags = [
      "/DELAYLOAD:dwmapi.dll",
      "/DELAYLOAD:imm32.dll",
      "/DELAYLOAD:oleacc.dll",
      "/DELAYLOAD:user32.dll",
    ]
    deps += [
      "//services/tracing/public/cpp:cpp",
      "//third_party/iaccessible2",
      "//third_party/wtl",
    ]
  }

  if (use_aura) {
    public += [
      "accessibility/accessibility_alert_window.h",
      "accessibility/ax_aura_obj_cache.h",
      "accessibility/ax_aura_obj_wrapper.h",
      "accessibility/ax_root_obj_wrapper.h",
      "accessibility/ax_tree_source_views.h",
      "accessibility/ax_view_obj_wrapper.h",
      "accessibility/ax_virtual_view_wrapper.h",
      "accessibility/ax_widget_obj_wrapper.h",
      "accessibility/ax_window_obj_wrapper.h",
      "controls/native/native_view_host_aura.h",
      "corewm/tooltip.h",
      "corewm/tooltip_controller.h",
      "corewm/tooltip_state_manager.h",
      "corewm/tooltip_view_aura.h",
      "event_monitor_aura.h",
      "native_window_tracker_aura.h",
      "touchui/touch_selection_controller_impl.h",
      "view_constants_aura.h",
      "widget/focus_manager_event_handler.h",
      "widget/native_widget_aura.h",
      "widget/tooltip_manager_aura.h",
      "widget/widget_aura_utils.h",
      "widget/window_reorderer.h",
      "windows_stationarity_monitor_aura.h",
    ]

    sources += [
      "accessibility/accessibility_alert_window.cc",
      "accessibility/ax_aura_obj_cache.cc",
      "accessibility/ax_aura_obj_wrapper.cc",
      "accessibility/ax_root_obj_wrapper.cc",
      "accessibility/ax_tree_source_views.cc",
      "accessibility/ax_view_obj_wrapper.cc",
      "accessibility/ax_virtual_view_wrapper.cc",
      "accessibility/ax_widget_obj_wrapper.cc",
      "accessibility/ax_window_obj_wrapper.cc",
      "controls/menu/menu_pre_target_handler_aura.cc",
      "controls/menu/menu_pre_target_handler_aura.h",
      "controls/native/native_view_host_aura.cc",
      "corewm/tooltip_controller.cc",
      "corewm/tooltip_state_manager.cc",
      "corewm/tooltip_view_aura.cc",
      "drag_utils_aura.cc",
      "event_monitor_aura.cc",
      "metrics_aura.cc",
      "native_window_tracker_aura.cc",
      "touchui/touch_selection_controller_impl.cc",
      "view_constants_aura.cc",
      "widget/focus_manager_event_handler.cc",
      "widget/native_widget_aura.cc",
      "widget/tooltip_manager_aura.cc",
      "widget/window_reorderer.cc",
      "windows_stationarity_monitor_aura.cc",
    ]
    if (!is_chromeos_ash) {
      sources += [ "accessibility/widget_ax_tree_id_map.cc" ]
    }
    if (is_chromeos_lacros) {
      public += [ "corewm/tooltip_lacros.h" ]
      sources += [ "corewm/tooltip_lacros.cc" ]
    } else {
      public += [ "corewm/tooltip_aura.h" ]
      sources += [ "corewm/tooltip_aura.cc" ]
    }
    deps += [
      "//ui/aura",
      "//ui/base/cursor/mojom:cursor_type_shared",
      "//ui/events",
      "//ui/platform_window",
      "//ui/platform_window/wm",
      "//ui/wm",
      "//ui/wm/public",
    ]
    if (enable_desktop_aura || is_chromeos_ash) {
      public += [
        "touchui/touch_selection_menu_runner_views.h",
        "touchui/touch_selection_menu_views.h",
      ]
      sources += [
        "touchui/touch_selection_menu_runner_views.cc",
        "touchui/touch_selection_menu_views.cc",
      ]
    }
    if (enable_desktop_aura) {
      public += [
        "widget/desktop_aura/desktop_capture_client.h",
        "widget/desktop_aura/desktop_drop_target_win.h",
        "widget/desktop_aura/desktop_event_client.h",
        "widget/desktop_aura/desktop_focus_rules.h",
        "widget/desktop_aura/desktop_native_cursor_manager.h",
        "widget/desktop_aura/desktop_native_widget_aura.h",
        "widget/desktop_aura/desktop_screen.h",
        "widget/desktop_aura/desktop_screen_position_client.h",
        "widget/desktop_aura/desktop_window_tree_host.h",
      ]
      sources += [
        "widget/desktop_aura/desktop_capture_client.cc",
        "widget/desktop_aura/desktop_event_client.cc",
        "widget/desktop_aura/desktop_focus_rules.cc",
        "widget/desktop_aura/desktop_native_cursor_manager.cc",
        "widget/desktop_aura/desktop_native_widget_aura.cc",
        "widget/desktop_aura/desktop_screen_position_client.cc",
        "widget/desktop_aura/desktop_window_tree_host.cc",
      ]
      if (is_win) {
        public += [ "widget/desktop_aura/desktop_window_tree_host_win.h" ]
        sources += [
          "widget/desktop_aura/desktop_drag_drop_client_win.cc",
          "widget/desktop_aura/desktop_drag_drop_client_win.h",
          "widget/desktop_aura/desktop_drop_target_win.cc",
          "widget/desktop_aura/desktop_native_cursor_manager_win.cc",
          "widget/desktop_aura/desktop_native_cursor_manager_win.h",
          "widget/desktop_aura/desktop_screen_win.cc",
          "widget/desktop_aura/desktop_screen_win.h",
          "widget/desktop_aura/desktop_window_tree_host_win.cc",
        ]
        deps += [
          "//ui/events:dom_keyboard_layout",
          "//ui/events:keyboard_hook",
        ]
      }
      if (use_ozone) {
        public += [ "widget/desktop_aura/desktop_screen_ozone.h" ]
        sources += [ "widget/desktop_aura/desktop_screen_ozone.cc" ]
      }
      if (is_linux) {
        public += [ "widget/desktop_aura/desktop_window_tree_host_linux.h" ]
        sources += [
          "widget/desktop_aura/desktop_window_tree_host_linux.cc",
          "widget/desktop_aura/window_event_filter_linux.cc",
          "widget/desktop_aura/window_event_filter_linux.h",
        ]
        deps += [
          "//ui/base:hit_test",
          "//ui/base:ozone_buildflags",
        ]
      }
      if (is_chromeos_lacros) {
        public += [ "widget/desktop_aura/desktop_window_tree_host_lacros.h" ]
        sources += [
          "widget/desktop_aura/desktop_window_tree_host_lacros.cc",
          "widget/desktop_aura/window_event_filter_lacros.cc",
          "widget/desktop_aura/window_event_filter_lacros.h",
        ]
        deps += [
          "//chromeos/ui/base",
          "//ui/base:hit_test",
        ]
      }
      if (is_linux || is_chromeos_lacros || is_fuchsia) {
        public += [
          "widget/desktop_aura/desktop_window_tree_host_platform.h",
          "widget/desktop_aura/window_move_client_platform.h",
        ]
        sources += [
          "widget/desktop_aura/desktop_drag_drop_client_ozone.cc",
          "widget/desktop_aura/desktop_drag_drop_client_ozone.h",
          "widget/desktop_aura/desktop_window_tree_host_platform.cc",
          "widget/desktop_aura/window_move_client_platform.cc",
        ]
        public_deps += [ "//ui/base/dragdrop/mojom:mojom_shared" ]
      }
      if (is_linux) {
        sources += [
          "widget/desktop_aura/desktop_drag_drop_client_ozone_linux.cc",
          "widget/desktop_aura/desktop_drag_drop_client_ozone_linux.h",
        ]
      }
      if (use_atk) {
        sources += [
          "accessibility/view_ax_platform_node_delegate_auralinux.cc",
          "accessibility/view_ax_platform_node_delegate_auralinux.h",
        ]
        configs += [ "//build/config/linux/atk" ]
      }
    }
  }

  if (has_native_accessibility) {
    sources += [
      "accessibility/view_ax_platform_node_delegate.cc",
      "accessibility/view_ax_platform_node_delegate.h",
    ]

    if (use_aura) {
      sources += [
        "accessibility/views_utilities_aura.cc",
        "accessibility/views_utilities_aura.h",
      ]
    }

    if (is_mac) {
      sources += [
        "accessibility/view_ax_platform_node_delegate_mac.h",
        "accessibility/view_ax_platform_node_delegate_mac.mm",
      ]
    }

    if (is_win) {
      sources += [
        "accessibility/view_ax_platform_node_delegate_win.cc",
        "accessibility/view_ax_platform_node_delegate_win.h",
      ]
    }
  }

  if (is_fuchsia) {
    sources += [ "controls/menu/menu_config_fuchsia.cc" ]
  }

  if (use_ozone) {
    deps += [ "//ui/ozone" ]
  }
}

if (is_win || is_mac || is_linux || is_chromeos) {
  static_library("view_pixel_diff_test_support") {
    testonly = true
    sources = [
      "test/view_skia_gold_pixel_diff.cc",
      "test/view_skia_gold_pixel_diff.h",
    ]

    deps = [
      ":views",
      "//base",
      "//skia",
      "//testing/gtest",
      "//ui/base:pixel_diff_test_support",
      "//ui/gfx",
      "//ui/snapshot",
    ]
  }
}

source_set("test_support") {
  testonly = true
  sources = [
    "animation/test/flood_fill_ink_drop_ripple_test_api.cc",
    "animation/test/flood_fill_ink_drop_ripple_test_api.h",
    "animation/test/ink_drop_highlight_test_api.cc",
    "animation/test/ink_drop_highlight_test_api.h",
    "animation/test/ink_drop_host_test_api.cc",
    "animation/test/ink_drop_host_test_api.h",
    "animation/test/ink_drop_impl_test_api.cc",
    "animation/test/ink_drop_impl_test_api.h",
    "animation/test/ink_drop_ripple_test_api.cc",
    "animation/test/ink_drop_ripple_test_api.h",
    "animation/test/ink_drop_utils.cc",
    "animation/test/square_ink_drop_ripple_test_api.cc",
    "animation/test/square_ink_drop_ripple_test_api.h",
    "animation/test/test_ink_drop.cc",
    "animation/test/test_ink_drop.h",
    "animation/test/test_ink_drop_animation_observer_helper.h",
    "animation/test/test_ink_drop_highlight_observer.cc",
    "animation/test/test_ink_drop_highlight_observer.h",
    "animation/test/test_ink_drop_host.cc",
    "animation/test/test_ink_drop_host.h",
    "animation/test/test_ink_drop_ripple_observer.cc",
    "animation/test/test_ink_drop_ripple_observer.h",
    "controls/table/test_table_model.cc",
    "controls/table/test_table_model.h",
    "controls/textfield/textfield_test_api.cc",
    "controls/textfield/textfield_test_api.h",
    "interaction/interaction_test_util_mouse.cc",
    "interaction/interaction_test_util_mouse.h",
    "interaction/interaction_test_util_views.cc",
    "interaction/interaction_test_util_views.h",
    "interaction/interactive_views_test.cc",
    "interaction/interactive_views_test.h",
    "interaction/interactive_views_test_internal.cc",
    "interaction/interactive_views_test_internal.h",
    "interaction/polling_view_observer.h",
    "interaction/view_focus_observer.cc",
    "interaction/view_focus_observer.h",
    "interaction/widget_focus_observer.cc",
    "interaction/widget_focus_observer.h",
    "layout/animating_layout_manager_test_util.cc",
    "layout/animating_layout_manager_test_util.h",
    "test/ax_event_counter.cc",
    "test/ax_event_counter.h",
    "test/button_test_api.cc",
    "test/button_test_api.h",
    "test/capture_tracking_view.cc",
    "test/capture_tracking_view.h",
    "test/combobox_test_api.cc",
    "test/combobox_test_api.h",
    "test/desktop_test_views_delegate.h",
    "test/dialog_test.cc",
    "test/dialog_test.h",
    "test/focus_manager_test.cc",
    "test/focus_manager_test.h",
    "test/layout_test_utils.cc",
    "test/menu_runner_test_api.cc",
    "test/menu_runner_test_api.h",
    "test/menu_test_utils.cc",
    "test/menu_test_utils.h",
    "test/mock_drag_controller.cc",
    "test/mock_drag_controller.h",
    "test/mock_input_event_activation_protector.cc",
    "test/mock_input_event_activation_protector.h",
    "test/mock_native_widget.cc",
    "test/mock_native_widget.h",
    "test/native_widget_factory.cc",
    "test/native_widget_factory.h",
    "test/scoped_views_test_helper.cc",
    "test/scoped_views_test_helper.h",
    "test/slider_test_api.cc",
    "test/slider_test_api.h",
    "test/test_layout_manager.cc",
    "test/test_layout_manager.h",
    "test/test_layout_provider.cc",
    "test/test_layout_provider.h",
    "test/test_platform_native_widget.h",
    "test/test_views.cc",
    "test/test_views.h",
    "test/test_views_delegate.h",
    "test/test_widget_observer.cc",
    "test/test_widget_observer.h",
    "test/view_metadata_test_utils.cc",
    "test/view_metadata_test_utils.h",
    "test/views_drawing_test_utils.cc",
    "test/views_drawing_test_utils.h",
    "test/views_test_base.cc",
    "test/views_test_base.h",
    "test/views_test_helper.cc",
    "test/views_test_helper.h",
    "test/views_test_utils.cc",
    "test/views_test_utils.h",
    "test/widget_activation_waiter.cc",
    "test/widget_activation_waiter.h",
    "test/widget_animation_waiter.cc",
    "test/widget_animation_waiter.h",
    "test/widget_show_state_waiter.cc",
    "test/widget_show_state_waiter.h",
    "test/widget_test.cc",
    "test/widget_test.h",
    "test/widget_test_api.cc",
    "test/widget_test_api.h",
    "view_test_api.h",
    "views_test_suite.cc",
    "views_test_suite.h",
    "widget/widget_interactive_uitest_utils.cc",
    "widget/widget_interactive_uitest_utils.h",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  deps = [
    ":views",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//gpu/ipc/service",
    "//ipc:test_support",
    "//mojo/core/embedder",
    "//skia",
    "//ui/accessibility:test_support",
    "//ui/base",
    "//ui/base:test_support",
    "//ui/base/clipboard:clipboard_test_support",
    "//ui/base/dragdrop:types",
    "//ui/base/dragdrop/mojom",
    "//ui/base/emoji",
    "//ui/base/ime/init",
    "//ui/compositor",
    "//ui/compositor:test_support",
    "//ui/events",
    "//ui/events:events_base",
    "//ui/events:test_support",
    "//ui/events/platform",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gl:test_support",
  ]
  public_deps = [
    "//testing/gmock",
    "//testing/gtest",
    "//ui/base/mojom:mojom",
  ]

  if (is_win) {
    sources += [
      "test/desktop_window_tree_host_win_test_api.cc",
      "test/desktop_window_tree_host_win_test_api.h",
      "win/test_support/fake_ipen_device.cc",
      "win/test_support/fake_ipen_device.h",
      "win/test_support/fake_ipen_device_statics.cc",
      "win/test_support/fake_ipen_device_statics.h",
    ]
  }
  if (is_mac) {
    sources += [
      "test/desktop_test_views_delegate_mac.mm",
      "test/event_generator_delegate_mac.h",
      "test/event_generator_delegate_mac.mm",
      "test/scoped_views_test_helper_cocoa.mm",
      "test/test_views_delegate_mac.mm",
      "test/views_test_base_mac.mm",
      "test/views_test_helper_mac.h",
      "test/views_test_helper_mac.mm",
      "test/widget_test_mac.mm",
    ]

    deps += [
      "//components/remote_cocoa/app_shim",
      "//ui/display:test_support",
    ]
  }

  if (is_chromeos_lacros) {
    deps += [ "//chromeos/startup" ]
  }

  if (use_aura) {
    sources += [
      "corewm/tooltip_controller_test_helper.cc",
      "corewm/tooltip_controller_test_helper.h",
      "test/desktop_test_views_delegate_aura.cc",
      "test/test_views_delegate_aura.cc",
      "test/views_test_helper_aura.cc",
      "test/views_test_helper_aura.h",
      "test/widget_test_aura.cc",
    ]
    if (!is_chromeos_lacros) {
      sources += [
        "corewm/test/tooltip_aura_test_api.cc",
        "corewm/test/tooltip_aura_test_api.h",
      ]
    }
    deps += [
      "//ui/aura",
      "//ui/aura:test_support",
      "//ui/wm",
      "//ui/wm/public",
    ]
  }
  if (use_ozone) {
    deps += [ "//ui/ozone" ]
  }

  if (use_ozone && enable_desktop_aura) {
    sources += [
      "test/test_desktop_screen_ozone.cc",
      "test/test_desktop_screen_ozone.h",
      "test/ui_controls_factory_desktop_aura_ozone.cc",
    ]
    deps += [ "//ui/ozone:ui_test_support" ]
  }
}

test("views_unittests") {
  use_xvfb = use_xvfb_in_this_config

  sources = [
    "accessibility/accessibility_paint_checks_unittest.cc",
    "accessible_pane_view_unittest.cc",
    "actions/action_view_controller_unittest.cc",
    "animation/animation_builder_unittest.cc",
    "animation/bounds_animator_unittest.cc",
    "animation/bubble_slide_animator_unittest.cc",
    "animation/compositor_animation_runner_unittest.cc",
    "animation/flood_fill_ink_drop_ripple_unittest.cc",
    "animation/ink_drop_highlight_unittest.cc",
    "animation/ink_drop_host_unittest.cc",
    "animation/ink_drop_impl_unittest.cc",
    "animation/ink_drop_mask_unittest.cc",
    "animation/ink_drop_ripple_unittest.cc",
    "animation/ink_drop_unittest.cc",
    "animation/slide_out_controller_unittest.cc",
    "animation/square_ink_drop_ripple_unittest.cc",
    "animation/widget_fade_animator_unittest.cc",
    "border_unittest.cc",
    "bubble/bubble_border_unittest.cc",
    "bubble/bubble_dialog_delegate_view_unittest.cc",
    "bubble/bubble_dialog_model_host_unittest.cc",
    "bubble/bubble_frame_view_unittest.cc",
    "bubble/info_bubble_unittest.cc",
    "bubble/tooltip_icon_unittest.cc",
    "controls/base_control_test_widget.cc",
    "controls/base_control_test_widget.h",
    "controls/button/button_unittest.cc",
    "controls/button/checkbox_unittest.cc",
    "controls/button/image_button_factory_unittest.cc",
    "controls/button/image_button_unittest.cc",
    "controls/button/label_button_label_unittest.cc",
    "controls/button/label_button_unittest.cc",
    "controls/button/md_text_button_unittest.cc",
    "controls/button/menu_button_controller_unittest.cc",
    "controls/button/menu_button_unittest.cc",
    "controls/button/radio_button_unittest.cc",
    "controls/button/toggle_button_unittest.cc",
    "controls/combobox/combobox_unittest.cc",
    "controls/editable_combobox/editable_combobox_unittest.cc",
    "controls/editable_combobox/editable_password_combobox_unittest.cc",
    "controls/focus_ring_unittest.cc",
    "controls/image_view_unittest.cc",
    "controls/label_unittest.cc",
    "controls/link_fragment_unittest.cc",
    "controls/link_unittest.cc",
    "controls/menu/menu_controller_unittest.cc",
    "controls/menu/menu_item_view_unittest.cc",
    "controls/menu/menu_model_adapter_unittest.cc",
    "controls/menu/menu_runner_unittest.cc",
    "controls/menu/menu_separator_unittest.cc",
    "controls/menu/submenu_view_unittest.cc",
    "controls/menu/test_menu_item_view.cc",
    "controls/menu/test_menu_item_view.h",
    "controls/message_box_view_unittest.cc",
    "controls/native/native_view_host_test_base.cc",
    "controls/native/native_view_host_test_base.h",
    "controls/native/native_view_host_unittest.cc",
    "controls/prefix_selector_unittest.cc",
    "controls/progress_bar_unittest.cc",
    "controls/resize_area_unittest.cc",
    "controls/scroll_view_unittest.cc",
    "controls/scrollbar/scroll_bar_button_unittest.cc",
    "controls/scrollbar/scrollbar_unittest.cc",
    "controls/separator_unittest.cc",
    "controls/slider_unittest.cc",
    "controls/styled_label_unittest.cc",
    "controls/tabbed_pane/tabbed_pane_unittest.cc",
    "controls/table/table_utils_unittest.cc",
    "controls/table/table_view_unittest.cc",
    "controls/textarea/textarea_unittest.cc",
    "controls/textfield/textfield_model_unittest.cc",
    "controls/textfield/textfield_unittest.cc",
    "controls/textfield/textfield_unittest.h",
    "controls/theme_tracking_image_view_unittest.cc",
    "controls/tree/tree_view_unittest.cc",
    "event_monitor_unittest.cc",
    "focus/focus_manager_unittest.cc",
    "focus/focus_traversal_unittest.cc",
    "interaction/element_tracker_views_unittest.cc",
    "interaction/interaction_sequence_views_unittest.cc",
    "interaction/interaction_test_util_views_unittest.cc",
    "interaction/interactive_views_test_unittest.cc",
    "interaction/view_focus_observer_unittest.cc",
    "interaction/widget_focus_observer_unittest.cc",
    "layout/animating_layout_manager_unittest.cc",
    "layout/box_layout_unittest.cc",
    "layout/box_layout_view_unittest.cc",
    "layout/composite_layout_tests.cc",
    "layout/fill_layout_unittest.cc",
    "layout/flex_layout_unittest.cc",
    "layout/flex_layout_view_unittest.cc",
    "layout/layout_manager_base_unittest.cc",
    "layout/normalized_geometry_unittest.cc",
    "layout/proposed_layout_unittest.cc",
    "layout/table_layout_unittest.cc",
    "metadata/type_conversion_unittest.cc",
    "metadata/view_factory_unittest.cc",
    "paint_info_unittest.cc",
    "rect_based_targeting_utils_unittest.cc",
    "repeat_controller_unittest.cc",
    "run_all_unittests_main.cc",
    "selection_controller_unittest.cc",
    "test/widget_test_unittest.cc",
    "view_model_unittest.cc",
    "view_model_utils_unittest.cc",
    "view_shadow_unittest.cc",
    "view_targeter_unittest.cc",
    "view_tracker_unittest.cc",
    "view_unittest.cc",
    "widget/any_widget_observer_unittest.cc",
    "widget/drop_helper_unittest.cc",
    "widget/native_widget_unittest.cc",
    "widget/root_view_unittest.cc",
    "widget/sublevel_manager_unittest.cc",
    "widget/unique_widget_ptr_unittest.cc",
    "widget/widget_delegate_unittest.cc",
    "widget/widget_unittest.cc",
    "window/custom_frame_view_unittest.cc",
    "window/dialog_client_view_unittest.cc",
    "window/dialog_delegate_unittest.cc",
    "window/frame_caption_button_unittest.cc",
    "window/hit_test_utils_unittest.cc",
  ]

  configs += [ "//build/config:precompiled_headers" ]

  deps = [
    ":test_support",
    ":views",
    "//base",
    "//base:i18n",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//cc:test_support",
    "//cc/paint",
    "//components/vector_icons",
    "//components/viz/common",
    "//mojo/core/embedder",
    "//skia",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/icu",
    "//ui/accessibility:test_support",
    "//ui/actions",
    "//ui/base",
    "//ui/base:ozone_buildflags",
    "//ui/base:test_support",
    "//ui/base/clipboard",
    "//ui/base/clipboard:clipboard_test_support",
    "//ui/base/dragdrop:types",
    "//ui/base/dragdrop/mojom",
    "//ui/base/emoji",
    "//ui/base/ime/init",
    "//ui/base/mojom:mojom",
    "//ui/color",
    "//ui/color:mixers",
    "//ui/compositor:test_support",
    "//ui/compositor_extra",
    "//ui/display:test_support",
    "//ui/events:dom_keycode_converter",
    "//ui/events:events_base",
    "//ui/events:test_support",
    "//ui/events/platform",
    "//ui/gfx:test_support",
    "//ui/gfx/geometry",
    "//ui/gl:test_support",
    "//ui/native_theme",
    "//ui/native_theme:test_support",
    "//ui/platform_window/wm",
    "//ui/resources",
    "//ui/resources:ui_test_pak",
    "//ui/strings",
    "//ui/touch_selection",
    "//url",
  ]

  data_deps = [
    "//testing/buildbot/filters:views_unittests_filters",
    "//ui/resources:ui_test_pak_data",
  ]

  if (is_win) {
    public_deps = [
      "//build/win:default_exe_manifest",
      "//third_party/iaccessible2",
      "//third_party/wtl",
    ]

    deps += [ "//ui/base:data_exchange" ]

    libs = [
      "imm32.lib",
      "oleacc.lib",
      "comctl32.lib",
      "uiautomationcore.lib",
    ]

    sources += [
      "accessibility/atomic_view_ax_tree_manager_unittest.cc",
      "accessibility/test_list_grid_view.cc",
      "accessibility/test_list_grid_view.h",
      "accessibility/view_ax_platform_node_delegate_win_unittest.cc",
      "win/pen_event_processor_unittest.cc",
      "win/pen_id_handler_unittest.cc",
    ]
  }

  if (is_linux) {
    deps += [ "//ui/linux:test_support" ]
  }

  if (is_linux || is_chromeos_lacros) {
    deps += [ "//ui/base/ime/linux" ]
  }

  if (has_native_accessibility) {
    sources += [
      "accessibility/ax_virtual_view_unittest.cc",
      "accessibility/view_accessibility_unittest.cc",
      "accessibility/view_ax_platform_node_delegate_unittest.cc",
    ]
  }

  if (skia_support_skottie) {
    sources += [ "controls/animated_image_view_unittest.cc" ]

    deps += [ "//ui/lottie" ]
  }

  if (is_mac) {
    sources += [
      "accessibility/view_ax_platform_node_delegate_mac_unittest.cc",
      "cocoa/bridged_native_widget_unittest.mm",
      "cocoa/cocoa_mouse_capture_unittest.mm",
      "cocoa/drag_drop_client_mac_unittest.mm",
      "cocoa/fullscreen_controller_unittest.cc",
      "cocoa/immersive_mode_controller_unittest.mm",
      "controls/menu/menu_closure_animation_mac_unittest.cc",
      "controls/menu/menu_runner_cocoa_unittest.mm",
      "controls/native/native_view_host_mac_unittest.mm",
      "controls/tabbed_pane/tabbed_pane_accessibility_mac_unittest.mm",
      "view_unittest_mac.mm",
      "widget/ax_native_widget_mac_unittest.mm",
      "widget/native_widget_mac_unittest.mm",
      "widget/sublevel_manager_mac_unittest.mm",
    ]

    # views_unittests not yet compiling on Mac. http://crbug.com/378134
    sources -= [ "controls/native/native_view_host_unittest.cc" ]

    public_deps = [
      "//components/remote_cocoa/app_shim",
      "//ui/accelerated_widget_mac",
    ]
  }

  if (is_fuchsia) {
    # These tests use SwiftShader (crbug.com/1022542), which uses JIT.
    test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"

    additional_manifest_fragments = [
      "//build/config/fuchsia/test/fonts.shard.test-cml",
      "//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml",
      "//build/config/fuchsia/test/present_view.shard.test-cml",
      "//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
    ]
  }

  if (use_aura) {
    sources += [
      "accessibility/accessibility_alert_window_unittest.cc",
      "accessibility/ax_aura_obj_cache_unittest.cc",
      "accessibility/ax_tree_source_views_unittest.cc",
      "controls/native/native_view_host_aura_unittest.cc",
      "corewm/tooltip_controller_unittest.cc",
      "touchui/touch_selection_controller_impl_unittest.cc",
      "view_unittest_aura.cc",
      "widget/native_widget_aura_unittest.cc",
      "widget/window_reorderer_unittest.cc",
    ]
    deps += [
      "//ui/aura",
      "//ui/aura:test_support",
      "//ui/base/cursor/mojom:cursor_type",
      "//ui/wm",
      "//ui/wm/public",
    ]

    if (is_mac) {
      # views_unittests not yet compiling on Mac. http://crbug.com/378134
      sources -= [ "widget/window_reorderer_unittest.cc" ]
    }

    if (is_win) {
      sources +=
          [ "widget/desktop_aura/desktop_window_tree_host_win_unittest.cc" ]
    }

    if (enable_desktop_aura || is_chromeos_ash) {
      sources += [ "touchui/touch_selection_menu_runner_views_unittest.cc" ]
    }

    if (enable_desktop_aura) {
      sources += [
        "widget/desktop_aura/desktop_focus_rules_unittest.cc",
        "widget/desktop_aura/desktop_native_widget_aura_unittest.cc",
        "widget/desktop_widget_unittest.cc",
      ]
      if (is_linux || is_chromeos || is_fuchsia) {
        sources += [
          "widget/desktop_aura/desktop_window_tree_host_platform_unittest.cc",
        ]
        if (is_linux || is_chromeos) {
          deps += [ "//ui/platform_window/stub:stub" ]
        }
      }
      if (is_linux || is_chromeos) {
        sources += [ "widget/desktop_aura/desktop_window_tree_host_platform_impl_unittest.cc" ]
      }
      if (use_ozone) {
        sources +=
            [ "widget/desktop_aura/desktop_drag_drop_client_ozone_unittest.cc" ]
        deps += [ "//ui/platform_window" ]
      }
    }
  }

  if ((is_linux || is_chromeos_lacros) && use_ozone) {
    data_deps +=
        [ "//testing/buildbot/filters:linux_ozone_views_unittests_filters" ]
  }

  if (use_atk) {
    sources +=
        [ "accessibility/view_ax_platform_node_delegate_auralinux_unittest.cc" ]
    configs += [ "//build/config/linux/atk" ]
  }

  if (use_ozone) {
    deps += [
      "//ui/events/ozone/layout:test_support",
      "//ui/ozone",
    ]
  }

  if (is_linux || is_chromeos) {
    sources += [ "color_chooser/color_chooser_unittest.cc" ]
  }

  if (is_win || is_mac || is_linux || is_chromeos) {
    sources += [ "test/view_skia_gold_pixel_diff_unittest.cc" ]
    deps += [ "//ui/views:view_pixel_diff_test_support" ]
  }

  if (enable_nocompile_tests) {
    deps += [ ":views_nocompile_tests" ]
  }
}

if (enable_nocompile_tests) {
  nocompile_source_set("views_nocompile_tests") {
    sources = [ "view_nocompile.nc" ]
    deps = [ ":views" ]
  }
}

# This target is added as a dependency of browser interactive_ui_tests. It must
# be source_set, otherwise the linker will drop the tests as dead code.
source_set("views_interactive_ui_tests") {
  testonly = true

  sources = [ "widget/widget_interactive_uitest.cc" ]

  deps = [
    ":test_support",
    ":views",
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//mojo/core/embedder",
    "//skia",
    "//testing/gtest",
    "//ui/base:test_support",
    "//ui/base/ime",
    "//ui/compositor",
    "//ui/events:test_support",
    "//ui/gl:test_support",
    "//ui/resources",
    "//ui/resources:ui_test_pak",
    "//ui/strings",
  ]

  public_deps = [ "//ui/base/mojom:mojom" ]

  if (is_win) {
    sources += [ "accessibility/ax_system_caret_win_interactive_uitest.cc" ]
  }

  if (is_mac) {
    sources += [
      "cocoa/bridged_native_widget_interactive_uitest.mm",
      "widget/native_widget_mac_interactive_uitest.mm",
    ]
    deps += [ "//components/remote_cocoa/app_shim" ]
  }

  if (use_aura) {
    sources += [
      "bubble/bubble_dialog_delegate_view_interactive_uitest_aura.cc",
      "corewm/desktop_capture_controller_unittest.cc",
      "widget/native_widget_aura_interactive_uitest.cc",
    ]

    deps += [
      "//ui/aura",
      "//ui/aura:test_support",
      "//ui/wm",
      "//ui/wm/public",
    ]

    if (is_linux || is_chromeos_lacros) {
      sources += [ "widget/desktop_aura/desktop_window_tree_host_platform_impl_interactive_uitest.cc" ]
    }

    deps += [
      "//ui/events/platform",
      "//ui/platform_window",
      "//ui/platform_window/wm",
    ]

    if (enable_desktop_aura) {
      sources += [
        "widget/desktop_aura/desktop_native_widget_aura_interactive_uitest.cc",
      ]
    }
  }

  if (is_chromeos_ash) {
    sources -= [ "corewm/desktop_capture_controller_unittest.cc" ]
  }
}

test("views_perftests") {
  sources = [
    "controls/label_perftest.cc",
    "views_perftests.cc",
  ]

  deps = [
    ":test_support",
    ":views",
    "//base/test:test_support",
    "//cc/base:base",
    "//mojo/core/embedder",
    "//testing/perf",
    "//ui/resources:ui_test_pak",
  ]

  data_deps = [
    "//testing:run_perf_test",
    "//ui/resources:ui_test_pak_data",
  ]
}