chromium/ui/aura/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/config/ui.gni")
import("//testing/test.gni")

component("aura") {
  public = [
    "client/aura_constants.h",
    "client/capture_client.h",
    "client/capture_client_observer.h",
    "client/capture_delegate.h",
    "client/cursor_client.h",
    "client/cursor_client_observer.h",
    "client/cursor_shape_client.h",
    "client/default_capture_client.h",
    "client/drag_drop_client.h",
    "client/drag_drop_client_observer.h",
    "client/drag_drop_delegate.h",
    "client/event_client.h",
    "client/focus_change_observer.h",
    "client/focus_client.h",
    "client/screen_position_client.h",
    "client/transient_window_client.h",
    "client/transient_window_client_observer.h",
    "client/visibility_client.h",
    "client/window_parenting_client.h",
    "client/window_stacking_client.h",
    "client/window_types.h",
    "env.h",
    "env_input_state_controller.h",
    "env_observer.h",
    "event_injector.h",
    "host_frame_rate_throttler.h",
    "input_state_lookup.h",
    "layout_manager.h",
    "native_window_occlusion_tracker.h",
    "null_window_targeter.h",
    "scoped_enable_unadjusted_mouse_events.h",
    "scoped_keyboard_hook.h",
    "scoped_simple_keyboard_hook.h",
    "scoped_window_capture_request.h",
    "scoped_window_event_targeting_blocker.h",
    "scoped_window_targeter.h",
    "window.h",
    "window_delegate.h",
    "window_event_dispatcher.h",
    "window_event_dispatcher_observer.h",
    "window_observer.h",
    "window_occlusion_change_builder.h",
    "window_occlusion_tracker.h",
    "window_targeter.h",
    "window_tracker.h",
    "window_tree_host.h",
    "window_tree_host_observer.h",
    "window_tree_host_platform.h",
  ]
  sources = [
    "aura_export.h",
    "client/aura_constants.cc",
    "client/capture_client.cc",
    "client/cursor_client.cc",
    "client/cursor_client_observer.cc",
    "client/cursor_shape_client.cc",
    "client/default_capture_client.cc",
    "client/drag_drop_client.cc",
    "client/drag_drop_delegate.cc",
    "client/event_client.cc",
    "client/focus_change_observer.cc",
    "client/focus_client.cc",
    "client/screen_position_client.cc",
    "client/transient_window_client.cc",
    "client/visibility_client.cc",
    "client/window_parenting_client.cc",
    "client/window_stacking_client.cc",
    "env.cc",
    "env_input_state_controller.cc",
    "event_injector.cc",
    "host_frame_rate_throttler.cc",
    "input_state_lookup.cc",
    "layout_manager.cc",
    "native_window_occlusion_tracker.cc",
    "null_window_targeter.cc",
    "scoped_keyboard_hook.cc",
    "scoped_simple_keyboard_hook.cc",
    "scoped_window_capture_request.cc",
    "scoped_window_event_targeting_blocker.cc",
    "scoped_window_targeter.cc",
    "window.cc",
    "window_delegate.cc",
    "window_event_dispatcher.cc",
    "window_observer.cc",
    "window_occlusion_change_builder.cc",
    "window_occlusion_tracker.cc",
    "window_targeter.cc",
    "window_tracker.cc",
    "window_tree_host.cc",
    "window_tree_host_platform.cc",
  ]

  friend = [ ":*" ]

  defines = [ "AURA_IMPLEMENTATION" ]

  deps = [
    "//base",
    "//base:i18n",
    "//build:chromeos_buildflags",
    "//cc",
    "//cc/mojo_embedder",
    "//components/discardable_memory/client",
    "//components/discardable_memory/public/mojom",
    "//components/viz/client",
    "//components/viz/common",
    "//components/viz/host",
    "//gpu/ipc/client",
    "//mojo/public/cpp/system",
    "//services/service_manager/public/cpp",
    "//skia",
    "//ui/base",
    "//ui/base/clipboard",
    "//ui/base/cursor/mojom:cursor_type",
    "//ui/base/ime/init",
    "//ui/display",
    "//ui/events",
    "//ui/events:dom_keyboard_layout",
    "//ui/events:events_base",
    "//ui/events:keyboard_hook",
    "//ui/events/platform",
    "//ui/gfx",
    "//ui/gfx:gfx_switches",
    "//ui/gfx/geometry",
    "//ui/gl",
    "//ui/platform_window",
    "//ui/platform_window/stub",
  ]

  public_deps = [
    "//ui/base/cursor",
    "//ui/base/dragdrop:types",
    "//ui/base/dragdrop/mojom:mojom_headers",
    "//ui/base/ime",
    "//ui/base/metadata",
    "//ui/base/mojom:mojom",
    "//ui/compositor",
  ]

  if (is_win) {
    public += [ "input_state_lookup_win.h" ]
    sources += [
      "input_state_lookup_win.cc",
      "native_window_occlusion_tracker_win.cc",
      "native_window_occlusion_tracker_win.h",
    ]
  }

  if (is_win) {
    sources -= [ "input_state_lookup.cc" ]

    deps += [
      "//ipc",
      "//ui/platform_window/win",
    ]
  }

  if (is_win) {
    libs = [
      "wtsapi32.lib",
      "dwmapi.lib",
    ]
  }

  if (use_ozone) {
    deps += [ "//ui/ozone" ]
    public += [ "screen_ozone.h" ]
    sources += [ "screen_ozone.cc" ]
  }
}

static_library("test_support") {
  testonly = true
  sources = [
    "test/aura_test_base.cc",
    "test/aura_test_base.h",
    "test/aura_test_helper.cc",
    "test/aura_test_helper.h",
    "test/aura_test_utils.cc",
    "test/aura_test_utils.h",
    "test/default_event_generator_delegate.cc",
    "test/default_event_generator_delegate.h",
    "test/env_test_helper.h",
    "test/event_generator_delegate_aura.cc",
    "test/event_generator_delegate_aura.h",
    "test/find_window.h",
    "test/test_cursor_client.cc",
    "test/test_cursor_client.h",
    "test/test_focus_client.cc",
    "test/test_focus_client.h",
    "test/test_screen.cc",
    "test/test_screen.h",
    "test/test_window_delegate.cc",
    "test/test_window_delegate.h",
    "test/test_window_parenting_client.cc",
    "test/test_window_parenting_client.h",
    "test/test_window_targeter.cc",
    "test/test_window_targeter.h",
    "test/test_windows.cc",
    "test/test_windows.h",
    "test/ui_controls_aurawin.h",
    "test/ui_controls_factory_aura.h",
    "test/window_event_dispatcher_test_api.cc",
    "test/window_event_dispatcher_test_api.h",
    "test/window_occlusion_tracker_test_api.cc",
    "test/window_occlusion_tracker_test_api.h",
    "test/window_test_api.cc",
    "test/window_test_api.h",
  ]

  public_deps = [
    ":aura",

    # Must be public as headers include buildflags.h.
    "//ui/base:buildflags",
  ]
  deps = [
    "//base",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//cc:test_support",
    "//components/viz/test:test_support",
    "//skia",
    "//testing/gtest",
    "//ui/base:test_support",
    "//ui/base/cursor",
    "//ui/base/cursor/mojom:cursor_type",
    "//ui/base/ime/init",
    "//ui/compositor:test_support",
    "//ui/display",
    "//ui/events",
    "//ui/events:events_base",
    "//ui/events:test_support",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/platform_window",
    "//ui/wm",
  ]

  if (is_win) {
    sources += [ "test/ui_controls_aurawin.cc" ]
  }

  if (use_ozone && (is_chromeos_ash || is_castos)) {
    sources += [
      "test/ui_controls_ozone.cc",
      "test/ui_controls_ozone.h",
    ]
  }

  if (is_linux || is_chromeos) {
    deps += [ "//ui/platform_window/common" ]
  }
}

executable("aura_demo") {
  testonly = true

  sources = [ "demo/demo_main.cc" ]

  deps = [
    ":aura",
    ":test_support",
    "//base",
    "//base:i18n",
    "//build/win:default_exe_manifest",
    "//components/viz/host",
    "//components/viz/service",
    "//mojo/core/embedder",
    "//skia",
    "//third_party/icu",
    "//ui/base",
    "//ui/base/ime/init",
    "//ui/compositor",
    "//ui/compositor:test_support",
    "//ui/display",
    "//ui/events",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gl",
    "//ui/gl/init",
  ]
}

test("aura_unittests") {
  use_xvfb = use_xvfb_in_this_config

  sources = [
    "../compositor_extra/shadow_unittest.cc",
    "client/screen_position_client_unittest.cc",
    "gestures/gesture_recognizer_unittest.cc",
    "test/aura_test_suite.h",
    "test/run_all_unittests.cc",
    "window_event_dispatcher_unittest.cc",
    "window_occlusion_change_builder_unittest.cc",
    "window_occlusion_tracker_unittest.cc",
    "window_targeter_unittest.cc",
    "window_tree_host_platform_unittest.cc",
    "window_tree_host_unittest.cc",
    "window_unittest.cc",
  ]

  if (is_win) {
    sources += [ "native_window_occlusion_tracker_unittest.cc" ]
    libs = [ "dwmapi.lib" ]
  }

  deps = [
    ":test_support",
    "//base/test:test_support",
    "//build:chromeos_buildflags",
    "//cc/mojo_embedder",
    "//components/viz/client",
    "//mojo/core/embedder",
    "//skia",
    "//testing/gtest",
    "//ui/aura_extra",
    "//ui/aura_extra:tests",
    "//ui/base:test_support",
    "//ui/base/clipboard:clipboard_types",
    "//ui/compositor:test_support",
    "//ui/compositor_extra",
    "//ui/display:test_support",
    "//ui/events:gesture_detection",
    "//ui/events:test_support",
    "//ui/gfx",
    "//ui/gfx/geometry",
    "//ui/gl:test_support",
    "//ui/platform_window",
    "//ui/platform_window/stub",
    "//ui/wm",
  ]

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

  if (is_fuchsia) {
    additional_manifest_fragments = [
      "//build/config/fuchsia/test/present_view.shard.test-cml",
      "//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
    ]
  }

  data_deps = [ "//third_party/angle:includes" ]
}

# 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("aura_interactive_ui_tests") {
  testonly = true
  if (is_win) {
    sources = [ "native_window_occlusion_tracker_win_interactive_test.cc" ]

    deps = [
      ":aura",
      ":test_support",
      "//base/test:test_support",
      "//mojo/core/embedder",
      "//testing/gtest",
      "//ui/base:test_support",
      "//ui/base/ime/init",
      "//ui/display:display",
      "//ui/gfx",
      "//ui/gfx/geometry",
      "//ui/gl:test_support",
      "//ui/gl/init",
      "//ui/views:views",
    ]
  }
}