# 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/chromeos/ui_mode.gni")
import("//build/config/ui.gni")
import("//remoting/remoting_enable.gni")
import("//testing/test.gni")
component("display_features") {
output_name = "display_features"
sources = [
"display_features.cc",
"display_features.h",
]
defines = [ "IS_DISPLAY_FEATURES_IMPL" ]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
"//base",
"//build:chromeos_buildflags",
]
}
component("display") {
sources = [
"display.cc",
"display.h",
"display_change_notifier.cc",
"display_change_notifier.h",
"display_export.h",
"display_finder.cc",
"display_finder.h",
"display_layout.cc",
"display_layout.h",
"display_layout_builder.cc",
"display_layout_builder.h",
"display_list.cc",
"display_list.h",
"display_observer.cc",
"display_observer.h",
"display_switches.cc",
"display_switches.h",
"display_transform.cc",
"display_transform.h",
"display_util.cc",
"display_util.h",
"scoped_display_for_new_windows.cc",
"scoped_display_for_new_windows.h",
"screen.cc",
"screen.h",
"screen_base.cc",
"screen_base.h",
"screen_info.cc",
"screen_info.h",
"screen_infos.cc",
"screen_infos.h",
"tablet_state.cc",
"tablet_state.h",
"unified_desktop_utils.cc",
"unified_desktop_utils.h",
]
if (is_android) {
sources += [ "screen_android.cc" ]
}
if (is_mac) {
sources += [
"mac/ca_display_link_mac.h",
"mac/ca_display_link_mac.mm",
"mac/cv_display_link_mac.h",
"mac/cv_display_link_mac.mm",
"mac/display_link_mac.h",
"mac/display_link_mac.mm",
"mac/screen_mac.mm",
]
}
if (is_win) {
sources += [
"win/audio_edid_scan.cc",
"win/audio_edid_scan.h",
"win/base_window_finder_win.cc",
"win/base_window_finder_win.h",
"win/color_profile_reader.cc",
"win/color_profile_reader.h",
"win/display_config_helper.cc",
"win/display_config_helper.h",
"win/display_info.cc",
"win/display_info.h",
"win/dpi.cc",
"win/dpi.h",
"win/local_process_window_finder_win.cc",
"win/local_process_window_finder_win.h",
"win/scaling_util.cc",
"win/scaling_util.h",
"win/screen_win.cc",
"win/screen_win.h",
"win/screen_win_display.cc",
"win/screen_win_display.h",
"win/uwp_text_scale_factor.cc",
"win/uwp_text_scale_factor.h",
]
}
if (is_ios) {
sources += [ "ios/screen_ios.mm" ]
}
defines = [ "DISPLAY_IMPLEMENTATION" ]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [
":display_features",
"//ui/display/types",
"//ui/gfx:color_space",
"//ui/gfx:gfx",
]
deps = [
"//base",
"//base:i18n",
"//build:chromeos_buildflags",
"//components/device_event_log",
"//mojo/public/cpp/bindings:struct_traits",
"//ui/display/mojom:mojom_shared_cpp_sources",
"//ui/display/util",
"//ui/gfx",
"//ui/gfx/geometry",
]
if (is_ios) {
deps += [ "//build:ios_buildflags" ]
}
if (is_win) {
# Don't conflict with Windows' "display.dll".
output_name = "ui_display"
deps += [ "//ui/gfx/mojom:dxgi_info" ]
libs = [ "shcore.lib" ]
ldflags = [ "/DELAYLOAD:shcore.dll" ]
}
if (use_aura) {
sources += [ "screen_aura.cc" ]
}
if (is_mac) {
frameworks = [
"AppKit.framework",
"CoreGraphics.framework",
"QuartzCore.framework",
"IOKit.framework",
]
}
}
if (is_chromeos_lacros) {
component("managed_display_info") {
testonly = true
sources = [
"manager/managed_display_info.cc",
"manager/managed_display_info.h",
"manager/util/display_manager_test_util.cc",
"manager/util/display_manager_test_util.h",
"manager/util/display_manager_util.cc",
"manager/util/display_manager_util.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps = [ "//ui/display" ]
deps = [
"//base",
"//build:chromeos_buildflags",
"//ui/base:base",
"//ui/display",
"//ui/display/types",
"//ui/display/util",
"//ui/display/util",
]
defines = [ "DISPLAY_MANAGER_IMPLEMENTATION" ]
}
}
if (is_chromeos_ash) {
component("display_manager_test_api") {
testonly = true
sources = [
"test/display_manager_test_api.cc",
"test/display_manager_test_api.h",
]
defines = [ "DISPLAY_IMPLEMENTATION" ]
public_deps = [ "//ui/display/manager" ]
deps = [
"//base",
"//build:chromeos_buildflags",
"//ui/display",
"//ui/display:test_support",
"//ui/display/types",
"//ui/display/util",
]
}
}
static_library("test_support") {
testonly = true
sources = [
"test/display_matchers.cc",
"test/display_matchers.h",
"test/display_test_util.h",
"test/test_screen.cc",
"test/test_screen.h",
"test/virtual_display_util.h",
]
public_deps = [ ":display" ]
deps = [
"//base",
"//skia",
"//testing/gmock",
"//third_party/re2",
"//ui/display",
"//ui/display/types",
"//ui/display/util",
"//ui/events/devices",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
]
if (is_win) {
sources += [
"win/test/scoped_screen_win.cc",
"win/test/scoped_screen_win.h",
"win/test/screen_util_win.cc",
"win/test/screen_util_win.h",
"win/test/virtual_display_util_win.cc",
"win/test/virtual_display_util_win.h",
]
deps += [
"//third_party/win_virtual_display/controller",
"//third_party/win_virtual_display/driver/public",
]
}
if (is_mac) {
sources += [
"mac/test/test_screen_mac.h",
"mac/test/test_screen_mac.mm",
"mac/test/virtual_display_util_mac.h",
"mac/test/virtual_display_util_mac.mm",
]
}
if (is_linux && ozone_platform_x11 && enable_remoting) {
sources += [
"linux/test/virtual_display_util_linux.cc",
"linux/test/virtual_display_util_linux.h",
]
deps += [
"//remoting/host:display_layout",
"//remoting/host:x11_display_utils",
"//ui/gfx/x:x",
]
}
if (is_chromeos) {
sources += [ "test/display_test_util.cc" ]
}
if (is_chromeos_ash) {
sources += [
"manager/test/action_logger.cc",
"manager/test/action_logger.h",
"manager/test/action_logger_util.cc",
"manager/test/action_logger_util.h",
"manager/test/fake_display_delegate.cc",
"manager/test/fake_display_delegate.h",
"manager/test/fake_display_snapshot.cc",
"manager/test/fake_display_snapshot.h",
"manager/test/test_display_layout_manager.cc",
"manager/test/test_display_layout_manager.h",
"manager/test/test_native_display_delegate.cc",
"manager/test/test_native_display_delegate.h",
"manager/test/touch_device_manager_test_api.cc",
"manager/test/touch_device_manager_test_api.h",
"manager/test/touch_transform_controller_test_api.cc",
"manager/test/touch_transform_controller_test_api.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
public_deps += [ "//ui/display/manager" ]
}
if (is_chromeos_lacros) {
public_deps += [ "//ui/display:managed_display_info" ]
}
if (!is_mac && !is_win &&
!(is_linux && ozone_platform_x11 && enable_remoting)) {
sources += [
# Virtual display util stub for unimplemented platforms.
"test/virtual_display_util_stub.cc",
]
}
}
# This test covers all testable components in display.
test("display_unittests") {
sources = [
"display_layout_builder_unittest.cc",
"display_layout_unittest.cc",
"display_list_unittest.cc",
"display_unittest.cc",
"mojom/display_mojom_traits_unittest.cc",
"mojom/screen_infos_mojom_traits_unittest.cc",
"screen_unittest.cc",
"unified_desktop_utils_unittests.cc",
"util/display_util_unittest.cc",
"util/edid_parser_unittest.cc",
]
if (is_win) {
sources += [
"win/scaling_util_unittest.cc",
"win/screen_win_unittest.cc",
]
}
deps = [
":display",
":test_support",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//cc/base",
"//mojo/public/cpp/test_support:test_utils",
"//testing/gmock",
"//testing/gtest",
"//ui/display:test_support",
"//ui/display/mojom",
"//ui/display/types",
"//ui/display/util",
"//ui/events:test_support",
"//ui/events/devices",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
]
if (!is_android) {
# Do not run display_change_notifier_unittest.cc on Android because it
# does not compile display_observer.cc
sources += [ "display_change_notifier_unittest.cc" ]
}
if (is_chromeos_ash) {
sources += [
"manager/apply_content_protection_task_unittest.cc",
"manager/configure_displays_task_unittest.cc",
"manager/content_protection_key_manager_unittest.cc",
"manager/content_protection_manager_unittest.cc",
"manager/display_change_observer_unittest.cc",
"manager/display_configurator_unittest.cc",
"manager/display_port_observer_unittest.cc",
"manager/display_properties_parser_unittest.cc",
"manager/json_converter_unittest.cc",
"manager/managed_display_info_unittest.cc",
"manager/query_content_protection_task_unittest.cc",
"manager/test/fake_display_snapshot_unittest.cc",
"manager/touch_device_manager_unittest.cc",
"manager/touch_transform_controller_unittest.cc",
"manager/update_display_configuration_task_unittest.cc",
"manager/util/display_manager_test_util_unittest.cc",
"manager/util/display_manager_util_unittest.cc",
]
deps += [
":display_manager_test_api",
"//ui/base:run_all_unittests",
"//ui/display/manager",
"//ui/ozone:ozone_switches",
]
data_deps = [
"//ui/base:ui_base_test_resources_pak",
"//ui/resources:ui_test_pak_data",
]
} else {
deps += [ "//mojo/core/test:run_all_unittests" ]
}
}