# 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("//testing/test.gni")
import("//tools/grit/grit_rule.gni")
component("views_examples_lib") {
testonly = true
sources = [
"actions_example.cc",
"actions_example.h",
"animated_image_view_example.cc",
"animated_image_view_example.h",
"animation_example.cc",
"animation_example.h",
"ax_example.cc",
"ax_example.h",
"badge_example.cc",
"badge_example.h",
"box_layout_example.cc",
"box_layout_example.h",
"bubble_example.cc",
"bubble_example.h",
"button_example.cc",
"button_example.h",
"button_sticker_sheet.cc",
"button_sticker_sheet.h",
"checkbox_example.cc",
"checkbox_example.h",
"colored_dialog_example.cc",
"colored_dialog_example.h",
"colors_example.cc",
"colors_example.h",
"combobox_example.cc",
"combobox_example.h",
"create_examples.cc",
"create_examples.h",
"designer_example.cc",
"designer_example.h",
"dialog_example.cc",
"dialog_example.h",
"example_base.cc",
"example_base.h",
"example_combobox_model.cc",
"example_combobox_model.h",
"examples_action_id.h",
"examples_color_id.h",
"examples_color_mixer.cc",
"examples_color_mixer.h",
"examples_themed_label.cc",
"examples_themed_label.h",
"examples_window.cc",
"examples_window.h",
"fade_animation.cc",
"fade_animation.h",
"flex_layout_example.cc",
"flex_layout_example.h",
"ink_drop_example.cc",
"ink_drop_example.h",
"label_example.cc",
"label_example.h",
"layout_example_base.cc",
"layout_example_base.h",
"link_example.cc",
"link_example.h",
"login_bubble_dialog_example.cc",
"login_bubble_dialog_example.h",
"menu_example.cc",
"menu_example.h",
"message_box_example.cc",
"message_box_example.h",
"multiline_example.cc",
"multiline_example.h",
"notification_example.cc",
"notification_example.h",
"progress_bar_example.cc",
"progress_bar_example.h",
"radio_button_example.cc",
"radio_button_example.h",
"scroll_view_example.cc",
"scroll_view_example.h",
"slider_example.cc",
"slider_example.h",
"square_ink_drop_example.cc",
"square_ink_drop_example.h",
"tabbed_pane_example.cc",
"tabbed_pane_example.h",
"table_example.cc",
"table_example.h",
"text_example.cc",
"text_example.h",
"textarea_example.cc",
"textarea_example.h",
"textfield_example.cc",
"textfield_example.h",
"throbber_example.cc",
"throbber_example.h",
"toggle_button_example.cc",
"toggle_button_example.h",
"tree_view_example.cc",
"tree_view_example.h",
"typography_example.cc",
"typography_example.h",
"vector_example.cc",
"vector_example.h",
"views_examples_export.h",
"widget_example.cc",
"widget_example.h",
]
if (is_linux || is_chromeos || is_fuchsia) {
sources += [
"color_chooser_example.cc",
"color_chooser_example.h",
]
}
defines = [
"GFX_VECTOR_ICONS_UNSAFE",
"VIEWS_EXAMPLES_IMPLEMENTATION",
]
deps = [
":views_examples_resources_grd",
":views_examples_resources_pak",
"//base",
"//cc/paint",
"//skia",
"//third_party/icu",
"//ui/actions",
"//ui/base",
"//ui/color",
"//ui/events",
"//ui/gfx",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
"//ui/lottie",
"//ui/message_center",
"//ui/native_theme",
"//ui/resources",
"//ui/resources:ui_test_pak",
"//ui/strings:ui_strings",
"//ui/views",
]
public_deps = [ "//ui/base/mojom:mojom" ]
if (is_win) {
deps += [ "//third_party/wtl" ]
}
if (use_aura) {
deps += [ "//ui/aura" ]
}
}
source_set("views_examples_proc") {
testonly = true
sources = [
"examples_exit_code.h",
"examples_main_proc.cc",
"examples_main_proc.h",
]
deps = [
":views_examples_lib",
"//base",
"//base/test:test_support",
"//build:chromeos_buildflags",
"//cc/paint",
"//components/viz/host",
"//components/viz/service",
"//mojo/core/embedder",
"//skia",
"//ui/accessibility:test_support",
"//ui/base",
"//ui/color:mixers",
"//ui/compositor",
"//ui/compositor:test_support",
"//ui/gfx",
"//ui/views",
"//ui/views:test_support",
]
if (is_win || is_mac || is_linux || is_chromeos_lacros) {
sources += [
"examples_skia_gold_pixel_diff.cc",
"examples_skia_gold_pixel_diff.h",
]
deps += [
"//ui/base:pixel_diff_test_support",
"//ui/native_theme:native_theme",
"//ui/snapshot",
]
}
if (is_win) {
deps += [ "//build/win:default_exe_manifest" ]
}
if (use_aura) {
deps += [
"//ui/aura",
"//ui/wm",
]
}
if (is_chromeos_ash) {
sources += [
"examples_views_delegate_chromeos.cc",
"examples_views_delegate_chromeos.h",
]
deps += [ "//ui/wm:test_support" ]
}
}
executable("views_examples") {
testonly = true
sources = [ "examples_main.cc" ]
deps = [
":views_examples_lib",
":views_examples_proc",
"//base",
"//base/test:test_support",
"//build/win:default_exe_manifest",
"//ui/color:mixers",
"//ui/resources:ui_test_pak",
]
if (is_win) {
deps += [ "//ui/native_theme:native_theme_browser" ]
}
}
component("views_examples_with_content_lib") {
testonly = true
sources = [
"examples_window_with_content.cc",
"examples_window_with_content.h",
"views_examples_with_content_export.h",
"webview_example.cc",
"webview_example.h",
]
defines = [ "VIEWS_EXAMPLES_WITH_CONTENT_IMPLEMENTATION" ]
deps = [
":views_examples_resources_grd",
":views_examples_resources_pak",
"//base",
"//content",
"//skia",
"//ui/events",
"//ui/views",
"//ui/views/controls/webview",
"//url",
]
public_deps = [ ":views_examples_lib" ]
}
executable("views_examples_with_content") {
testonly = true
sources = [ "examples_with_content_main.cc" ]
defines = [ "VIEWS_EXAMPLES_WITH_CONTENT_IMPLEMENTATION" ]
deps = [
":copy_content_resources",
":views_examples_with_content_lib",
"//base",
"//build/win:default_exe_manifest",
"//content",
"//content:sandbox_helper_win",
"//sandbox",
"//ui/color:mixers",
"//ui/views_content_client",
]
if (is_win) {
configs += [ "//build/config/win:windowed" ]
configs -= [ "//build/config/win:console" ]
}
if (is_mac) {
deps += [ "//sandbox/mac:seatbelt" ]
}
}
copy("copy_content_resources") {
deps = [ "//content:content_resources" ]
sources = [ "$root_gen_dir/content/content_resources.pak" ]
outputs = [ "$root_out_dir/content_resources.pak" ]
}
grit("views_examples_resources_grd") {
testonly = true
source = "views_examples_resources.grd"
outputs = [
"grit/views_examples_resources.h",
"views_examples_resources.pak",
]
}
copy("views_examples_resources_pak") {
testonly = true
sources = [ "$target_gen_dir/views_examples_resources.pak" ]
outputs = [ "$root_out_dir/views_examples_resources.pak" ]
public_deps = [ ":views_examples_resources_grd" ]
}
test("views_examples_unittests") {
use_xvfb = use_xvfb_in_this_config
sources = [
"examples_unittest.cc",
"examples_unittest_main.cc",
]
deps = [
":views_examples_lib",
":views_examples_proc",
"//base",
"//base/test:test_support",
"//components/viz/host",
"//components/viz/service",
"//mojo/core/embedder",
"//ui/base",
"//ui/base/ime/init",
"//ui/compositor",
"//ui/compositor:test_support",
"//ui/gfx",
"//ui/gl",
"//ui/gl/init",
"//ui/resources:ui_test_pak",
"//ui/snapshot",
"//ui/views",
"//ui/views:test_support",
]
if (use_aura) {
deps += [
"//ui/aura",
"//ui/wm",
]
}
if (is_win) {
deps += [ "//ui/native_theme:native_theme_browser" ]
}
if (is_fuchsia) {
additional_manifest_fragments = [
"//build/config/fuchsia/test/fonts.shard.test-cml",
"//third_party/fuchsia-sdk/sdk/pkg/vulkan/client.shard.cml",
]
}
data_deps = [
":views_examples_resources_pak",
"//testing/buildbot/filters:views_examples_unittests_filters",
"//ui/resources:ui_test_pak_data",
]
data = [ "$root_out_dir/views_examples_resources.pak" ]
}