| # Copyright 2014 The Chromium Authors. All rights reserved. |
| # 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/compiler/compiler.gni") |
| import("//build/config/dcheck_always_on.gni") |
| import("//build/config/linux/gtk/gtk.gni") |
| import("//build/config/linux/pangocairo/pangocairo.gni") |
| import("//build/config/locales.gni") |
| import("//build/config/ozone.gni") |
| import("//build/config/sanitizers/sanitizers.gni") |
| import("//build/config/ui.gni") |
| import("//build/util/branding.gni") |
| import("//skia/features.gni") |
| import("//testing/libfuzzer/fuzzer_test.gni") |
| import("//testing/test.gni") |
| import("//tools/grit/grit_rule.gni") |
| import("//ui/base/ui_features.gni") |
| |
| if (is_android) { |
| import("//build/config/android/config.gni") |
| import("//build/config/android/rules.gni") |
| } else if (is_mac) { |
| import("//build/config/mac/rules.gni") |
| } |
| |
| build_ime = !is_ios |
| |
| # As part of building Chrome on iOS, it is necessary to run a tool on |
| # the host to load datapack and generate output in a format defined |
| # by the platform (this is to support notifications). |
| # |
| # Introduce a standalone target that can build on both 'host' and 'target' |
| # toolchains that just builds the support to load datapacks. The dependencies |
| # should be kept minimal to not have to build too many targets with multiple |
| # toolchains. |
| component("ui_data_pack") { |
| sources = [ |
| "resource/data_pack.cc", |
| "resource/data_pack.h", |
| "resource/data_pack_export.h", |
| "resource/resource_handle.h", |
| "resource/resource_scale_factor.cc", |
| "resource/resource_scale_factor.h", |
| "resource/scoped_file_writer.cc", |
| "resource/scoped_file_writer.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//net", |
| "//third_party/zlib/google:compression_utils", |
| ] |
| |
| defines = [ "UI_DATA_PACK_IMPLEMENTATION" ] |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| } |
| |
| buildflag_header("buildflags") { |
| header = "buildflags.h" |
| flags = [ |
| "ENABLE_HIDPI=$enable_hidpi", |
| "ENABLE_MESSAGE_CENTER=$enable_message_center", |
| "USE_ATK=$use_atk", |
| "USE_XKBCOMMON=$use_xkbcommon", |
| "HAS_NATIVE_ACCESSIBILITY=$has_native_accessibility", |
| "HAS_PLATFORM_ACCESSIBILITY_SUPPORT=$has_platform_accessibility_support", |
| "USE_GTK=$use_gtk", |
| ] |
| } |
| |
| source_set("hit_test") { |
| sources = [ |
| "hit_test.cc", |
| "hit_test.h", |
| ] |
| } |
| |
| component("base") { |
| output_name = "ui_base" |
| |
| sources = [ |
| "class_property.cc", |
| "class_property.h", |
| "default_style.h", |
| "device_form_factor.h", |
| "device_form_factor_desktop.cc", |
| "dragdrop/drop_target_event.cc", |
| "dragdrop/drop_target_event.h", |
| "dragdrop/os_exchange_data.cc", |
| "dragdrop/os_exchange_data.h", |
| "dragdrop/os_exchange_data_provider_factory.cc", |
| "dragdrop/os_exchange_data_provider_factory.h", |
| "ime/utf_offset.cc", |
| "ime/utf_offset.h", |
| "interaction/element_identifier.cc", |
| "interaction/element_identifier.h", |
| "interaction/element_tracker.cc", |
| "interaction/element_tracker.h", |
| "interaction/framework_specific_implementation.h", |
| "interaction/interaction_sequence.cc", |
| "interaction/interaction_sequence.h", |
| "l10n/formatter.cc", |
| "l10n/formatter.h", |
| "l10n/l10n_font_util.cc", |
| "l10n/l10n_font_util.h", |
| "l10n/l10n_util.cc", |
| "l10n/l10n_util.h", |
| "l10n/l10n_util_collator.h", |
| "l10n/time_format.cc", |
| "l10n/time_format.h", |
| "layout.cc", |
| "layout.h", |
| "models/button_menu_item_model.cc", |
| "models/button_menu_item_model.h", |
| "models/combobox_model.cc", |
| "models/combobox_model.h", |
| "models/combobox_model_observer.h", |
| "models/dialog_model.cc", |
| "models/dialog_model.h", |
| "models/dialog_model_field.cc", |
| "models/dialog_model_field.h", |
| "models/dialog_model_host.h", |
| "models/image_model.cc", |
| "models/image_model.h", |
| "models/list_model.h", |
| "models/list_model_observer.h", |
| "models/list_selection_model.cc", |
| "models/list_selection_model.h", |
| "models/menu_model.cc", |
| "models/menu_model.h", |
| "models/menu_model_delegate.h", |
| "models/menu_separator_types.h", |
| "models/simple_combobox_model.cc", |
| "models/simple_combobox_model.h", |
| "models/simple_menu_model.cc", |
| "models/simple_menu_model.h", |
| "models/table_model.cc", |
| "models/table_model.h", |
| "models/table_model_observer.h", |
| "models/tree_model.cc", |
| "models/tree_model.h", |
| "models/tree_node_iterator.h", |
| "models/tree_node_model.h", |
| "nine_image_painter_factory.cc", |
| "nine_image_painter_factory.h", |
| "page_transition_types.cc", |
| "page_transition_types.h", |
| "pointer/touch_ui_controller.cc", |
| "pointer/touch_ui_controller.h", |
| "resource/allowlist.h", |
| "resource/resource_bundle.cc", |
| "resource/resource_bundle.h", |
| "scoped_visibility_tracker.cc", |
| "scoped_visibility_tracker.h", |
| "template_expressions.cc", |
| "template_expressions.h", |
| "theme_provider.cc", |
| "theme_provider.h", |
| "ui_base_exports.cc", |
| "ui_base_paths.cc", |
| "ui_base_paths.h", |
| "ui_base_switches.cc", |
| "ui_base_switches.h", |
| "ui_base_switches_util.cc", |
| "ui_base_switches_util.h", |
| "view_prop.cc", |
| "view_prop.h", |
| "webui/i18n_source_stream.cc", |
| "webui/i18n_source_stream.h", |
| "webui/jstemplate_builder.cc", |
| "webui/jstemplate_builder.h", |
| "webui/resource_path.h", |
| "webui/web_ui_util.cc", |
| "webui/web_ui_util.h", |
| "window_open_disposition.cc", |
| "window_open_disposition.h", |
| ] |
| |
| libs = [] |
| |
| if (is_android) { |
| sources += [ |
| "device_form_factor_android.cc", |
| "l10n/l10n_util_android.cc", |
| "l10n/l10n_util_android.h", |
| "resource/resource_bundle_android.cc", |
| "resource/resource_bundle_android.h", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "dragdrop/drag_source_win.cc", |
| "dragdrop/drag_source_win.h", |
| "dragdrop/drop_target_win.cc", |
| "dragdrop/drop_target_win.h", |
| "dragdrop/os_exchange_data_provider_win.cc", |
| "dragdrop/os_exchange_data_provider_win.h", |
| "l10n/l10n_util_win.cc", |
| "l10n/l10n_util_win.h", |
| "resource/resource_bundle_win.cc", |
| "resource/resource_bundle_win.h", |
| "resource/resource_data_dll_win.cc", |
| "resource/resource_data_dll_win.h", |
| "win/accessibility_ids_win.h", |
| "win/atl_module.h", |
| "win/event_creation_utils.cc", |
| "win/event_creation_utils.h", |
| "win/foreground_helper.cc", |
| "win/foreground_helper.h", |
| "win/hidden_window.cc", |
| "win/hidden_window.h", |
| "win/hwnd_metrics.cc", |
| "win/hwnd_metrics.h", |
| "win/hwnd_subclass.cc", |
| "win/hwnd_subclass.h", |
| "win/internal_constants.cc", |
| "win/internal_constants.h", |
| "win/lock_state.cc", |
| "win/lock_state.h", |
| "win/message_box_win.cc", |
| "win/message_box_win.h", |
| "win/mouse_wheel_util.cc", |
| "win/mouse_wheel_util.h", |
| "win/power_setting_change_listener.cc", |
| "win/power_setting_change_listener.h", |
| "win/scoped_ole_initializer.cc", |
| "win/scoped_ole_initializer.h", |
| "win/session_change_observer.cc", |
| "win/session_change_observer.h", |
| "win/shell.cc", |
| "win/shell.h", |
| "win/touch_input.cc", |
| "win/touch_input.h", |
| "win/win_cursor.cc", |
| "win/win_cursor.h", |
| "win/win_cursor_factory.cc", |
| "win/win_cursor_factory.h", |
| "win/window_event_target.cc", |
| "win/window_event_target.h", |
| ] |
| ldflags = [ "/DELAYLOAD:dwmapi.dll" ] |
| libs += [ |
| "dwmapi.lib", |
| "wtsapi32.lib", |
| ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "cocoa/accessibility_focus_overrider.h", |
| "cocoa/accessibility_focus_overrider.mm", |
| "cocoa/animation_utils.h", |
| "cocoa/appkit_utils.h", |
| "cocoa/appkit_utils.mm", |
| "cocoa/base_view.h", |
| "cocoa/base_view.mm", |
| "cocoa/cocoa_base_utils.h", |
| "cocoa/cocoa_base_utils.mm", |
| "cocoa/command_dispatcher.h", |
| "cocoa/command_dispatcher.mm", |
| "cocoa/constrained_window/constrained_window_animation.h", |
| "cocoa/constrained_window/constrained_window_animation.mm", |
| "cocoa/controls/button_utils.h", |
| "cocoa/controls/button_utils.mm", |
| "cocoa/controls/textfield_utils.h", |
| "cocoa/controls/textfield_utils.mm", |
| "cocoa/defaults_utils.h", |
| "cocoa/defaults_utils.mm", |
| "cocoa/find_pasteboard.h", |
| "cocoa/find_pasteboard.mm", |
| "cocoa/flipped_view.h", |
| "cocoa/flipped_view.mm", |
| "cocoa/focus_tracker.h", |
| "cocoa/focus_tracker.mm", |
| "cocoa/menu_controller.h", |
| "cocoa/menu_controller.mm", |
| "cocoa/nsmenuitem_additions.h", |
| "cocoa/nsmenuitem_additions.mm", |
| "cocoa/permissions_utils.h", |
| "cocoa/permissions_utils.mm", |
| "cocoa/quartz_util.h", |
| "cocoa/quartz_util.mm", |
| "cocoa/remote_accessibility_api.h", |
| "cocoa/remote_accessibility_api.mm", |
| "cocoa/remote_layer_api.h", |
| "cocoa/remote_layer_api.mm", |
| "cocoa/secure_password_input.h", |
| "cocoa/secure_password_input.mm", |
| "cocoa/text_services_context_menu.cc", |
| "cocoa/text_services_context_menu.h", |
| "cocoa/tool_tip_base_view.h", |
| "cocoa/tool_tip_base_view.mm", |
| "cocoa/touch_bar_util.h", |
| "cocoa/touch_bar_util.mm", |
| "cocoa/tracking_area.h", |
| "cocoa/tracking_area.mm", |
| "cocoa/underlay_opengl_hosting_window.h", |
| "cocoa/underlay_opengl_hosting_window.mm", |
| "cocoa/user_interface_item_command_handler.h", |
| "cocoa/views_hostable.h", |
| "cocoa/weak_ptr_nsobject.h", |
| "cocoa/weak_ptr_nsobject.mm", |
| "cocoa/window_size_constants.h", |
| "cocoa/window_size_constants.mm", |
| "dragdrop/os_exchange_data_provider_builder_mac.h", |
| "dragdrop/os_exchange_data_provider_builder_mac.mm", |
| "dragdrop/os_exchange_data_provider_mac.h", |
| "dragdrop/os_exchange_data_provider_mac.mm", |
| "interaction/element_tracker_mac.h", |
| "interaction/element_tracker_mac.mm", |
| "l10n/l10n_util_mac.h", |
| "l10n/l10n_util_mac.mm", |
| "resource/resource_bundle_mac.mm", |
| ] |
| } |
| |
| if (is_ios) { |
| sources += [ |
| "device_form_factor_ios.mm", |
| "resource/resource_bundle_ios.mm", |
| ] |
| } |
| |
| if (!is_ios) { |
| sources += [ |
| "accelerators/accelerator.cc", |
| "accelerators/accelerator.h", |
| "accelerators/accelerator_manager.cc", |
| "accelerators/accelerator_manager.h", |
| "accelerators/accelerator_map.h", |
| "accelerators/media_keys_listener.cc", |
| "accelerators/media_keys_listener.h", |
| "accelerators/media_keys_util.cc", |
| "accelerators/media_keys_util.h", |
| "accelerators/menu_label_accelerator_util.cc", |
| "accelerators/menu_label_accelerator_util.h", |
| "base_window.cc", |
| "base_window.h", |
| "emoji/emoji_panel_helper.h", |
| "pointer/pointer_device.h", |
| "pointer/pointer_device_util.cc", |
| "pointer/touch_editing_controller.cc", |
| "pointer/touch_editing_controller.h", |
| "text/bytes_formatting.cc", |
| "text/bytes_formatting.h", |
| "themed_vector_icon.cc", |
| "themed_vector_icon.h", |
| "ui_base_types.cc", |
| "ui_base_types.h", |
| "user_activity/user_activity_detector.cc", |
| "user_activity/user_activity_detector.h", |
| "user_activity/user_activity_observer.h", |
| ] |
| |
| if (is_linux || is_chromeos) { |
| sources += [ |
| "accelerators/menu_label_accelerator_util_linux.cc", |
| "accelerators/menu_label_accelerator_util_linux.h", |
| "linux/linux_desktop.cc", |
| "linux/linux_desktop.h", |
| "linux/linux_ui_delegate.cc", |
| "linux/linux_ui_delegate.h", |
| "linux/linux_ui_delegate_stub.cc", |
| "linux/linux_ui_delegate_stub.h", |
| ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "accelerators/platform_accelerator_cocoa.h", |
| "accelerators/platform_accelerator_cocoa.mm", |
| "cocoa/bubble_closer.h", |
| "cocoa/bubble_closer.mm", |
| "dragdrop/cocoa_dnd_util.h", |
| "dragdrop/cocoa_dnd_util.mm", |
| ] |
| } |
| } |
| |
| if (is_mac) { |
| sources += [ "emoji/emoji_panel_helper_mac.mm" ] |
| } else if (is_win) { |
| sources += [ "emoji/emoji_panel_helper_win.cc" ] |
| } else if (is_chromeos_ash) { |
| sources += [ "emoji/emoji_panel_helper_chromeos.cc" ] |
| } else { |
| # Empty implementation for all other platforms. |
| sources += [ "emoji/emoji_panel_helper.cc" ] |
| } |
| |
| if (is_mac) { |
| sources += [ "accelerators/media_keys_listener_mac.mm" ] |
| } else if (is_win) { |
| sources += [ |
| "accelerators/global_media_keys_listener_win.cc", |
| "accelerators/global_media_keys_listener_win.h", |
| "accelerators/media_keys_listener_win.cc", |
| ] |
| } else { |
| sources += [ "accelerators/media_keys_listener_stub.cc" ] |
| } |
| |
| if (is_win) { |
| sources += [ "pointer/pointer_device_win.cc" ] |
| } else if (is_android) { |
| sources += [ "pointer/pointer_device_android.cc" ] |
| } else if (is_ios) { |
| sources += [ "pointer/pointer_device_ios.cc" ] |
| } else if (is_linux || is_chromeos) { |
| sources += [ "pointer/pointer_device_linux.cc" ] |
| } else { |
| # Empty implementation for all other cases. |
| sources += [ "pointer/pointer_device.cc" ] |
| sources -= [ "pointer/pointer_device_util.cc" ] |
| } |
| |
| if (is_fuchsia) { |
| sources += [ "resource/resource_bundle_fuchsia.cc" ] |
| } |
| |
| configs += [ "//build/config/compiler:wexit_time_destructors" ] |
| |
| defines = [ "IS_UI_BASE_IMPL" ] |
| |
| if (enable_pseudolocales) { |
| defines += [ "ENABLE_PSEUDOLOCALES" ] |
| } |
| |
| public_deps = [ |
| ":buildflags", |
| ":features", |
| ":hit_test", |
| ":ui_data_pack", |
| "//base", |
| "//skia", |
| "//third_party/abseil-cpp:absl", |
| "//ui/color:color_headers", |
| "//ui/gfx", |
| "//ui/gfx/geometry", |
| ] |
| |
| deps = [ |
| ":locales_list", |
| "//base", |
| "//base:base_static", |
| "//base:i18n", |
| "//base/third_party/dynamic_annotations", |
| "//build:chromeos_buildflags", |
| "//net", |
| "//third_party/brotli:dec", |
| "//third_party/icu", |
| "//third_party/modp_b64", |
| "//third_party/zlib:zlib", |
| "//third_party/zlib/google:compression_utils", |
| "//ui/base:data_exchange", |
| "//ui/base/clipboard:clipboard_types", |
| "//ui/base/dragdrop/mojom", |
| "//ui/color", |
| "//ui/display", |
| "//ui/display/util:gpu_info_util", |
| "//ui/events", |
| "//ui/events/devices", |
| "//ui/resources:webui_generated_resources_grd", |
| "//ui/strings", |
| "//url", |
| ] |
| |
| if (is_debug || dcheck_always_on) { |
| deps += [ "//third_party/re2" ] |
| } |
| |
| if (!is_ios) { |
| # iOS does not use Chromium-specific code for event handling. |
| public_deps += [ |
| "//ui/base/clipboard:file_info", |
| "//ui/events:dom_keycode_converter", |
| "//ui/events:events_base", |
| "//ui/events/platform", |
| ] |
| } |
| |
| if (is_ios) { |
| sources += [ |
| "l10n/l10n_util_mac.h", |
| "l10n/l10n_util_mac.mm", |
| "l10n/l10n_util_mac_bridge.h", |
| "l10n/l10n_util_mac_bridge.mm", |
| ] |
| public_deps += [ "//ui/events:event_constants" ] |
| deps -= [ |
| "//ui/events", |
| "//ui/events/devices", |
| ] |
| } |
| |
| if (is_win) { |
| public_deps += [ |
| "//ui/base/cursor", |
| "//ui/base/cursor/mojom:cursor_type_shared", |
| ] |
| deps += [ "//ui/resources:ui_unscaled_resources_grd" ] |
| } |
| |
| if (toolkit_views) { |
| deps += [ "//ui/events" ] |
| } |
| |
| if (use_aura && (is_linux || is_chromeos)) { |
| sources += [ "resource/resource_bundle_auralinux.cc" ] |
| } |
| |
| if (is_linux || is_chromeos) { |
| deps += [ "//third_party/fontconfig" ] |
| } |
| |
| if (use_glib) { |
| configs += [ "//build/config/linux:glib" ] |
| sources += [ |
| "glib/glib_cast.h", |
| "glib/glib_integers.h", |
| "glib/glib_signal.h", |
| "glib/scoped_gobject.h", |
| ] |
| } |
| |
| if (is_chromeos_ash || (use_aura && (is_linux || is_chromeos_lacros)) || |
| is_fuchsia) { |
| sources += [ |
| "dragdrop/os_exchange_data_provider_non_backed.cc", |
| "dragdrop/os_exchange_data_provider_non_backed.h", |
| ] |
| } |
| |
| if (is_mac || is_win) { |
| deps += [ "//ui/base/clipboard" ] |
| } |
| |
| if (!use_aura) { |
| sources -= [ |
| "view_prop.cc", |
| "view_prop.h", |
| ] |
| } |
| |
| if (is_mac) { |
| deps += [ "//third_party/mozilla" ] |
| |
| frameworks = [ |
| "Accelerate.framework", |
| "AppKit.framework", |
| "QuartzCore.framework", |
| "AudioUnit.framework", |
| "Carbon.framework", |
| "CoreVideo.framework", |
| "Foundation.framework", |
| ] |
| } |
| |
| if (!toolkit_views && !use_aura) { |
| sources -= [ |
| "dragdrop/drop_target_event.cc", |
| "dragdrop/drop_target_event.h", |
| "dragdrop/os_exchange_data.cc", |
| "dragdrop/os_exchange_data.h", |
| "dragdrop/os_exchange_data_provider_factory.cc", |
| "dragdrop/os_exchange_data_provider_factory.h", |
| "nine_image_painter_factory.cc", |
| "nine_image_painter_factory.h", |
| ] |
| } |
| |
| if (is_android) { |
| deps += [ ":ui_base_jni_headers" ] |
| libs += [ "jnigraphics" ] |
| |
| sources -= [ |
| "l10n/l10n_font_util.cc", |
| "models/button_menu_item_model.cc", |
| "pointer/touch_editing_controller.cc", |
| "theme_provider.cc", |
| "ui_base_types.cc", |
| ] |
| } |
| |
| if (is_android || is_ios) { |
| sources -= [ "device_form_factor_desktop.cc" ] |
| } |
| } |
| |
| component("data_exchange") { |
| defines = [ "IS_UI_BASE_DATA_EXCHANGE_IMPL" ] |
| |
| sources = [ |
| "dragdrop/download_file_info.cc", |
| "dragdrop/download_file_info.h", |
| "dragdrop/download_file_interface.h", |
| "dragdrop/os_exchange_data_provider.h", |
| "dragdrop/os_exchange_data_provider_factory_ozone.cc", |
| "dragdrop/os_exchange_data_provider_factory_ozone.h", |
| ] |
| |
| deps = [ |
| "//base", |
| "//ui/base/clipboard:clipboard_types", |
| "//ui/base/clipboard:file_info", |
| "//ui/gfx", |
| "//ui/gfx/geometry", |
| "//url", |
| ] |
| |
| public_deps = [ "//ui/base/data_transfer_policy" ] |
| } |
| |
| component("features") { |
| output_name = "ui_base_features" |
| |
| defines = [ "IS_UI_BASE_FEATURES_IMPL" ] |
| |
| sources = [ |
| "ui_base_features.cc", |
| "ui_base_features.h", |
| ] |
| |
| if (is_chromeos_ash) { |
| sources += [ |
| "shortcut_mapping_pref_delegate.cc", |
| "shortcut_mapping_pref_delegate.h", |
| ] |
| } |
| |
| deps = [ |
| ":buildflags", |
| "//base", |
| "//build:chromeos_buildflags", |
| ] |
| } |
| |
| # TODO(crbug.com/1091985): Support CrOS. |
| if (is_win || is_mac || is_linux || is_chromeos_lacros) { |
| static_library("pixel_diff_test_support") { |
| testonly = true |
| sources = [ |
| "test/skia_gold_matching_algorithm.cc", |
| "test/skia_gold_matching_algorithm.h", |
| "test/skia_gold_pixel_diff.cc", |
| "test/skia_gold_pixel_diff.h", |
| ] |
| deps = [ |
| "//base", |
| "//base/test:test_config", |
| "//build:chromeos_buildflags", |
| "//testing/gtest", |
| "//ui/gfx", |
| "//ui/snapshot", |
| ] |
| |
| if (!is_fuchsia) { |
| data_deps = [ ":goldctl" ] |
| } |
| } |
| } |
| |
| if (!is_ios) { |
| group("goldctl") { |
| data = [] |
| |
| # Because this links to a CIPD dependency, which is a symlink on Unix |
| # platforms, refer to the actual executable rather than the whole directory; |
| # copying the whole directory doesn't work, at least with "mb.py zip". |
| if (is_win) { |
| data += [ "//tools/skia_goldctl/win/goldctl.exe" ] |
| } else if (is_mac) { |
| data += [ |
| "//tools/skia_goldctl/mac_amd64/goldctl", |
| "//tools/skia_goldctl/mac_arm64/goldctl", |
| ] |
| } else { |
| data += [ "//tools/skia_goldctl/linux/goldctl" ] |
| } |
| } |
| } |
| |
| static_library("test_support") { |
| testonly = true |
| sources = [ |
| "interaction/element_test_util.cc", |
| "interaction/element_test_util.h", |
| "interaction/expect_call_in_scope.h", |
| "interaction/interaction_test_util.cc", |
| "interaction/interaction_test_util.h", |
| "resource/mock_resource_bundle_delegate.cc", |
| "resource/mock_resource_bundle_delegate.h", |
| ] |
| |
| if (is_mac) { |
| sources += [ |
| "interaction/interaction_test_util_mac.h", |
| "interaction/interaction_test_util_mac.mm", |
| "test/cocoa_helper.h", |
| "test/cocoa_helper.mm", |
| "test/menu_test_observer.h", |
| "test/menu_test_observer.mm", |
| "test/ns_ax_tree_validator.h", |
| "test/ns_ax_tree_validator.mm", |
| "test/nswindow_fullscreen_notification_waiter.h", |
| "test/nswindow_fullscreen_notification_waiter.mm", |
| "test/scoped_fake_full_keyboard_access.h", |
| "test/scoped_fake_full_keyboard_access.mm", |
| "test/scoped_fake_nswindow_focus.h", |
| "test/scoped_fake_nswindow_focus.mm", |
| "test/scoped_fake_nswindow_fullscreen.h", |
| "test/scoped_fake_nswindow_fullscreen.mm", |
| "test/scoped_preferred_scroller_style_mac.h", |
| "test/scoped_preferred_scroller_style_mac.mm", |
| "test/ui_controls_mac.mm", |
| "test/view_tree_validator.mm", |
| "test/windowed_nsnotification_observer.h", |
| "test/windowed_nsnotification_observer.mm", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "test/ui_controls_internal_win.cc", |
| "test/ui_controls_internal_win.h", |
| ] |
| } |
| |
| if (!is_ios) { |
| sources += [ |
| "accelerators/test_accelerator_target.cc", |
| "accelerators/test_accelerator_target.h", |
| "test/mock_base_window.cc", |
| "test/mock_base_window.h", |
| "test/test_dialog_model_host.cc", |
| "test/test_dialog_model_host.h", |
| "test/ui_controls.h", |
| "test/view_tree_validator.h", |
| ] |
| } else { |
| sources += [ |
| "test/ios/keyboard_appearance_listener.h", |
| "test/ios/keyboard_appearance_listener.mm", |
| "test/ios/ui_image_test_utils.h", |
| "test/ios/ui_image_test_utils.mm", |
| ] |
| } |
| |
| if (use_aura) { |
| sources += [ |
| "test/ui_controls_aura.cc", |
| "test/ui_controls_aura.h", |
| ] |
| } |
| |
| public_deps = [ ":base" ] |
| deps = [ |
| "//base", |
| "//base/test:test_config", |
| "//base/test:test_support", |
| "//build:chromeos_buildflags", |
| "//skia", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//ui/base:ui_data_pack", |
| "//ui/display:test_support", |
| "//ui/events:events_base", |
| "//ui/events:test_support", |
| "//ui/gfx", |
| "//ui/gfx/geometry", |
| ] |
| |
| if (is_ios) { |
| deps -= [ |
| "//ui/events:events_base", |
| "//ui/events:test_support", |
| ] |
| } |
| |
| if (build_ime) { |
| sources += [ |
| "ime/dummy_input_method.cc", |
| "ime/dummy_input_method.h", |
| "ime/dummy_text_input_client.cc", |
| "ime/dummy_text_input_client.h", |
| "ime/fake_text_input_client.cc", |
| "ime/fake_text_input_client.h", |
| ] |
| |
| deps += [ |
| "//ui/base/ime", |
| "//ui/events", |
| ] |
| |
| if (is_win) { |
| deps += [ "//ui/base/ime/win" ] |
| } |
| } |
| |
| if (is_chromeos_ash) { |
| sources += [ |
| "ime/ash/mock_component_extension_ime_manager.cc", |
| "ime/ash/mock_component_extension_ime_manager.h", |
| "ime/ash/mock_component_extension_ime_manager_delegate.cc", |
| "ime/ash/mock_component_extension_ime_manager_delegate.h", |
| "ime/ash/mock_ime_candidate_window_handler.cc", |
| "ime/ash/mock_ime_candidate_window_handler.h", |
| "ime/ash/mock_ime_engine_handler.cc", |
| "ime/ash/mock_ime_engine_handler.h", |
| "ime/ash/mock_ime_input_context_handler.cc", |
| "ime/ash/mock_ime_input_context_handler.h", |
| "ime/ash/mock_input_method_manager.cc", |
| "ime/ash/mock_input_method_manager.h", |
| ] |
| deps += [ |
| "//ui/base/ime/ash", |
| "//ui/base/ime/ash:typing_session_manager", |
| ] |
| } |
| } |
| |
| if (is_android) { |
| generate_jni("ui_base_jni_headers") { |
| sources = [ |
| "../android/java/src/org/chromium/ui/base/Clipboard.java", |
| "../android/java/src/org/chromium/ui/base/DeviceFormFactor.java", |
| "../android/java/src/org/chromium/ui/base/IdleDetector.java", |
| "../android/java/src/org/chromium/ui/base/LocalizationUtils.java", |
| "../android/java/src/org/chromium/ui/base/ResourceBundle.java", |
| "../android/java/src/org/chromium/ui/base/SelectFileDialog.java", |
| "../android/java/src/org/chromium/ui/base/TouchDevice.java", |
| ] |
| } |
| } |
| |
| bundle_data("ui_base_unittests_bundle_data") { |
| testonly = true |
| sources = [ "test/data/data_pack_unittest/truncated-header.pak" ] |
| outputs = [ "{{bundle_resources_dir}}/" + |
| "{{source_root_relative_dir}}/{{source_file_part}}" ] |
| } |
| |
| # The resource labels below should not end with "_resources" or the Android |
| # build rules will look for a nonexistent __build_config label. |
| grit("ui_base_test_resources_grit") { |
| testonly = true |
| source = "test/ui_base_test_resources.grd" |
| outputs = [ |
| "grit/ui_base_test_resources.h", |
| "ui_base_test_resources.pak", |
| ] |
| } |
| |
| copy("ui_base_test_resources_pak") { |
| testonly = true |
| sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] |
| outputs = [ "$root_out_dir/ui_base_test_resources.pak" ] |
| public_deps = [ ":ui_base_test_resources_grit" ] |
| } |
| |
| if (is_android) { |
| android_assets("ui_base_test_android_assets") { |
| testonly = true |
| |
| # Use $target_gen_dir so the associated .pak.info file is available. |
| sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] |
| deps = [ ":ui_base_test_resources_grit" ] |
| } |
| } |
| |
| if (is_ios) { |
| bundle_data("ui_base_test_bundle_data") { |
| testonly = true |
| public_deps = [ ":ui_base_test_resources_grit" ] |
| sources = [ "$target_gen_dir/ui_base_test_resources.pak" ] |
| outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ] |
| } |
| } |
| |
| test("ui_base_unittests") { |
| use_xvfb = use_xvfb_in_this_config |
| |
| sources = [ |
| "class_property_unittest.cc", |
| "clipboard/file_info_unittest.cc", |
| "ime/utf_offset_unittest.cc", |
| "interaction/element_identifier_unittest.cc", |
| "interaction/element_tracker_unittest.cc", |
| "interaction/framework_specific_implementation_unittest.cc", |
| "interaction/interaction_sequence_unittest.cc", |
| "interaction/interaction_test_util_unittest.cc", |
| "l10n/l10n_util_unittest.cc", |
| "l10n/time_format_unittest.cc", |
| "layout_unittest.cc", |
| "models/image_model_unittest.cc", |
| "models/simple_combobox_model_unittest.cc", |
| "models/simple_menu_model_unittest.cc", |
| "models/tree_node_iterator_unittest.cc", |
| "pointer/touch_ui_controller_unittest.cc", |
| "prediction/empty_filter_unittests.cc", |
| "prediction/input_filter_unittest_helpers.cc", |
| "prediction/input_filter_unittest_helpers.h", |
| "prediction/input_predictor_unittest_helpers.cc", |
| "prediction/input_predictor_unittest_helpers.h", |
| "prediction/kalman_predictor_unittest.cc", |
| "prediction/least_squares_predictor_unittest.cc", |
| "prediction/linear_predictor_unittest.cc", |
| "prediction/linear_resampling_unittest.cc", |
| "prediction/one_euro_filter_unittests.cc", |
| "prediction/prediction_metrics_handler_unittest.cc", |
| "prediction/prediction_unittest_helpers.h", |
| "resource/data_pack_literal.cc", |
| "resource/data_pack_literal.h", |
| "resource/data_pack_unittest.cc", |
| "resource/resource_bundle_unittest.cc", |
| "resource/scale_factor_unittest.cc", |
| "scoped_visibility_tracker_unittest.cc", |
| "template_expressions_unittest.cc", |
| "test/page_transition_types_unittest.cc", |
| "test/run_all_unittests.cc", |
| "webui/i18n_source_stream_unittest.cc", |
| ] |
| if (is_mac) { |
| sources += [ |
| "cocoa/defaults_utils_unittest.mm", |
| "cocoa/nsmenuitem_additions_unittest.mm", |
| "interaction/element_tracker_mac_unittest.mm", |
| "l10n/l10n_util_mac_unittest.mm", |
| ] |
| } |
| if (!is_ios) { |
| sources += [ |
| "themed_vector_icon_unittest.cc", |
| "user_activity/user_activity_detector_unittest.cc", |
| ] |
| |
| if (is_mac) { |
| sources += [ |
| "test/scoped_fake_nswindow_fullscreen_unittest.mm", |
| "test/view_tree_validator_unittest.mm", |
| ] |
| } |
| } |
| |
| data = [] |
| data_deps = [ "//testing/buildbot/filters:ui_base_unittests_filters" ] |
| deps = [ |
| ":ui_base_test_resources_grit", |
| ":ui_base_unittests_bundle_data", |
| "//base", |
| "//base/test:test_support", |
| "//build:chromeos_buildflags", |
| "//components/vector_icons", |
| "//mojo/core/embedder", |
| "//net", |
| "//net:test_support", |
| "//skia", |
| "//testing/gmock", |
| "//testing/gtest", |
| "//third_party/brotli:dec", |
| "//third_party/icu", |
| "//third_party/zlib/google:compression_utils", |
| "//ui/base", |
| "//ui/base:data_exchange", |
| "//ui/base:test_support", |
| "//ui/base:ui_data_pack", |
| "//ui/base/clipboard:clipboard_test", |
| "//ui/base/clipboard:clipboard_types", |
| "//ui/base/clipboard:file_info", |
| "//ui/base/cursor:unittests", |
| "//ui/base/data_transfer_policy:unittests", |
| "//ui/base/metadata:metadata_tests", |
| "//ui/base/prediction:prediction", |
| "//ui/color", |
| "//ui/display", |
| "//ui/events:events_base", |
| "//ui/events:test_support", |
| "//ui/gfx:test_support", |
| "//ui/resources", |
| "//ui/resources:ui_test_pak", |
| "//ui/strings", |
| "//url", |
| ] |
| |
| if (is_android) { |
| sources -= [ "user_activity/user_activity_detector_unittest.cc" ] |
| } |
| |
| if (is_ios) { |
| sources += [ |
| "l10n/l10n_util_mac_unittest.mm", |
| "test/ios/ui_image_test_utils_unittest.mm", |
| ] |
| deps -= [ |
| "//ui/events:events_base", |
| "//ui/events:test_support", |
| ] |
| } else { # !is_ios |
| sources += [ |
| "accelerators/accelerator_manager_unittest.cc", |
| "accelerators/accelerator_map_unittest.cc", |
| "accelerators/accelerator_unittest.cc", |
| "accelerators/menu_label_accelerator_util_unittest.cc", |
| "models/dialog_model_unittest.cc", |
| "models/list_model_unittest.cc", |
| "models/list_selection_model_unittest.cc", |
| "models/tree_node_model_unittest.cc", |
| "text/bytes_formatting_unittest.cc", |
| "webui/web_ui_util_unittest.cc", |
| ] |
| |
| if (is_linux || is_chromeos) { |
| sources += |
| [ "accelerators/menu_label_accelerator_util_linux_unittest.cc" ] |
| } |
| |
| if (is_mac) { |
| sources += [ |
| "accelerators/platform_accelerator_cocoa_unittest.mm", |
| "cocoa/base_view_unittest.mm", |
| "cocoa/bubble_closer_unittest.mm", |
| "cocoa/cocoa_base_utils_unittest.mm", |
| "cocoa/constrained_window/constrained_window_animation_unittest.mm", |
| "cocoa/focus_tracker_unittest.mm", |
| "cocoa/menu_controller_unittest.mm", |
| "cocoa/touch_bar_util_unittest.mm", |
| "cocoa/tracking_area_unittest.mm", |
| "cocoa/weak_ptr_nsobject_unittest.mm", |
| ] |
| } |
| } |
| |
| # TODO(crbug.com/1091985): Support CrOS. |
| if (is_win || is_mac || is_linux || is_chromeos_lacros) { |
| sources += [ |
| "test/skia_gold_matching_algorithm_unittest.cc", |
| "test/skia_gold_pixel_diff_unittest.cc", |
| ] |
| deps += [ ":pixel_diff_test_support" ] |
| } |
| |
| if (build_ime) { |
| sources += [ |
| "ime/candidate_window_unittest.cc", |
| "ime/composition_text_unittest.cc", |
| "ime/input_method_base_unittest.cc", |
| "ime/mojom/ime_mojom_traits_unittest.cc", |
| ] |
| if (is_win) { |
| sources += [ |
| "ime/win/imm32_manager_unittest.cc", |
| "ime/win/on_screen_keyboard_display_manager_unittest.cc", |
| "ime/win/tsf_input_scope_unittest.cc", |
| "ime/win/tsf_text_store_unittest.cc", |
| ] |
| deps += [ "//ui/base/ime/win" ] |
| } |
| if (is_chromeos_ash) { |
| sources += [ |
| "dragdrop/os_exchange_data_provider_non_backed_unittest.cc", |
| "ime/ash/extension_ime_util_unittest.cc", |
| "ime/ash/ime_keyboard_unittest.cc", |
| "ime/ash/input_method_ash_unittest.cc", |
| "ime/ash/input_method_descriptor_unittest.cc", |
| "ime/ash/input_method_util_unittest.cc", |
| "ime/ash/typing_session_manager_unittest.cc", |
| ] |
| deps += [ |
| "//build:branding_buildflags", |
| "//ui/base/ime/ash", |
| "//ui/base/ime/ash:typing_session_manager", |
| ] |
| } |
| if ((is_linux || is_chromeos_lacros) && use_aura) { |
| sources += [ |
| "dragdrop/os_exchange_data_provider_non_backed_unittest.cc", |
| "ime/input_method_minimal_unittest.cc", |
| "ime/linux/input_method_auralinux_unittest.cc", |
| ] |
| deps += [ |
| "//ui/base/ime/init", |
| "//ui/base/ime/linux", |
| ] |
| } |
| if (is_linux && !is_chromecast && !is_chromeos_lacros) { |
| sources += [ "ime/linux/composition_text_util_pango_unittest.cc" ] |
| } |
| if (is_chromeos_ash || use_ozone) { |
| sources += [ "ime/character_composer_unittest.cc" ] |
| } |
| } |
| |
| # Include the correct ui_base_test resources per platform. |
| if (is_android) { |
| deps += [ ":ui_base_test_android_assets" ] |
| data_deps += [ ":ui_base_test_resources_pak" ] |
| } else if (is_ios) { |
| deps += [ ":ui_base_test_bundle_data" ] |
| } else { |
| data += [ "$root_out_dir/ui_base_test_resources.pak" ] |
| data_deps += [ ":ui_base_test_resources_pak" ] |
| } |
| |
| if (build_ime) { |
| deps += [ |
| "//ui/base/ime", |
| "//ui/base/ime/mojom:test_interfaces", |
| ] |
| } |
| |
| if (is_ios) { |
| deps += [ "//ui/resources:ui_test_pak_bundle_data" ] |
| } else { |
| deps += [ |
| "//ui/base/accelerators/mojom:unittests", |
| "//ui/base/cursor/mojom:unittests", |
| ] |
| } |
| |
| if (is_win) { |
| sources += [ |
| "dragdrop/os_exchange_data_win_unittest.cc", |
| "view_prop_unittest.cc", |
| "win/hwnd_subclass_unittest.cc", |
| "win/win_cursor_factory_unittest.cc", |
| ] |
| deps += [ |
| "//ui/base/cursor", |
| "//ui/base/cursor/mojom:cursor_type_shared", |
| ] |
| } |
| |
| if (is_android) { |
| deps += [ |
| "//chrome:resources", |
| "//ui/android:ui_java", |
| ] |
| } |
| |
| if (use_pangocairo) { |
| configs += [ "//build/config/linux/pangocairo" ] |
| } |
| |
| if (is_mac) { |
| deps += [ |
| ":ui_unittests_framework", |
| "//third_party/mozilla", |
| ] |
| } |
| |
| if (use_aura || toolkit_views) { |
| sources += [ "dragdrop/os_exchange_data_unittest.cc" ] |
| deps += [ |
| "//ui/events", |
| "//ui/events/platform", |
| ] |
| } |
| |
| if (is_chromeos_ash) { |
| deps += [ "//ui/events:dom_keycode_converter" ] |
| } |
| |
| if (is_android || is_linux || is_chromeos || is_mac || is_win || is_fuchsia) { |
| # TODO(brettw): We should be able to depend on //ui/resources:ui_test_pak |
| # instead of depending directly on the non-test .pak files, but depending |
| # on ui_test_pak seems to have no effect. |
| data += [ |
| "test/data/data_pack_unittest/truncated-header.pak", |
| "$root_out_dir/ui_test.pak", # TODO(brettw): remove this line. |
| ] |
| data_deps += [ |
| "//third_party/mesa_headers", |
| "//ui/resources:ui_test_pak", # TODO(brettw): this does nothing. |
| ] |
| } |
| if (is_linux || is_chromeos || is_win || is_fuchsia) { |
| data += [ |
| # TODO(brettw): Remove these two lines. |
| "$root_out_dir/ui/en-US.pak", |
| "$root_gen_dir/ui/resources/ui_resources_100_percent.pak", |
| ] |
| } |
| if (is_mac) { |
| data += [ "$root_out_dir/ui_unittests Framework.framework/" ] |
| } |
| |
| if (skia_support_skottie && !is_ios) { |
| sources += [ "//ui/lottie/animation_unittest.cc" ] |
| deps += [ |
| "//cc:test_support", |
| "//cc/paint", |
| "//third_party/abseil-cpp:absl", |
| "//ui/lottie", |
| ] |
| } |
| } |
| |
| if (is_mac) { |
| mac_framework_bundle("ui_unittests_framework") { |
| testonly = true |
| framework_version = "U" |
| framework_contents = [ "Resources" ] |
| deps = [ "//ui/resources:ui_test_pak_bundle_data" ] |
| info_plist = "test/framework-Info.plist" |
| extra_substitutions = [ "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id" ] |
| output_name = "ui_unittests Framework" |
| } |
| } |
| |
| if (is_win) { |
| # This source set is used by both //chrome/browser and |
| # //chrome/installer/setup. It must have minimal dependencies for the latter |
| # (e.g., no skia). |
| source_set("fullscreen_win") { |
| sources = [ |
| "fullscreen_win.cc", |
| "fullscreen_win.h", |
| ] |
| } |
| } |
| |
| if (is_linux || is_chromeos) { |
| # This source set defines linux wm role names and must not have any external |
| # dependencies and be kept as minimal as possible. |
| source_set("wm_role_names") { |
| sources = [ |
| "wm_role_names_linux.cc", |
| "wm_role_names_linux.h", |
| ] |
| } |
| } |
| |
| # 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("base_interactive_ui_tests") { |
| testonly = true |
| if (is_win) { |
| sources = |
| [ "accelerators/global_media_keys_listener_win_interactive_test.cc" ] |
| |
| deps = [ |
| ":base", |
| ":test_support", |
| "//base/test:test_support", |
| "//testing/gtest", |
| "//ui/events:events", |
| ] |
| } |
| } |
| |
| fuzzer_test("file_info_fuzzer") { |
| sources = [ "clipboard/file_info_fuzzer.cc" ] |
| deps = [ |
| "//base", |
| "//ui/base/clipboard:file_info", |
| ] |
| } |
| |
| # Same as locales, but includes "en" on Apple platforms. |
| # Apple platforms use "en" instead of "en-US" (see the definition of |
| # |locales_as_apple_outputs| in locales.gni). However, we still want to keep |
| # "en-US" in the list as the |ResourceBundle::GetLocaleFilePath| implementations |
| # in ui/base/resource/resource_bundle_{mac,ios}.mm return a valid path for |
| # "en-US" (as they internally rewrite it as "en" instead). |
| locales_for_platform_list = platform_pak_locales |
| if (is_apple) { |
| locales_for_platform_list += [ "en" ] |
| } |
| |
| action("locales_list_gen") { |
| script = "//tools/l10n/generate_locales_list.py" |
| outputs = [ "$root_gen_dir/ui/base/l10n/l10n_util_locales_list.inc" ] |
| args = rebase_path(outputs, root_build_dir) + locales_for_platform_list |
| } |
| |
| source_set("locales_list") { |
| deps = [ ":locales_list_gen" ] |
| sources = [ "$root_gen_dir/ui/base/l10n/l10n_util_locales_list.inc" ] |
| } |