chromium/ash/webui/help_app_ui/BUILD.gn

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

import("//ash/webui/help_app_ui/help_app_ui.gni")
import("//ash/webui/web_applications/system_apps.gni")
import("//build/buildflag_header.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//mojo/public/tools/bindings/mojom.gni")

assert(is_chromeos_ash, "Help App is ash-chrome only")

static_library("help_app_ui") {
  sources = [
    "help_app_kids_magazine_untrusted_ui.cc",
    "help_app_kids_magazine_untrusted_ui.h",
    "help_app_manager.cc",
    "help_app_manager.h",
    "help_app_manager_factory.cc",
    "help_app_manager_factory.h",
    "help_app_page_handler.cc",
    "help_app_page_handler.h",
    "help_app_ui.cc",
    "help_app_ui.h",
    "help_app_ui_delegate.h",
    "help_app_untrusted_ui.cc",
    "help_app_untrusted_ui.h",
    "search/search_concept.cc",
    "search/search_concept.h",
    "search/search_handler.cc",
    "search/search_handler.h",
    "search/search_metadata.cc",
    "search/search_metadata.h",
    "search/search_tag_registry.cc",
    "search/search_tag_registry.h",
    "url_constants.cc",
    "url_constants.h",
  ]

  deps = [
    ":mojo_bindings",
    ":mojo_bindings_js",
    "//ash/constants",
    "//ash/webui/help_app_ui/search:mojo_bindings",
    "//ash/webui/help_app_ui/search:mojo_bindings_js",
    "//ash/webui/help_app_ui/search:proto",
    "//ash/webui/resources:help_app_bundle_resources",
    "//ash/webui/resources:help_app_kids_magazine_bundle_resources",
    "//ash/webui/resources:help_app_resources",
    "//ash/webui/system_apps/public:system_web_app_config",
    "//ash/webui/system_apps/public:system_web_app_type",
    "//ash/webui/web_applications",
    "//chromeos/ash/components/local_search_service/public/cpp",
    "//chromeos/ash/components/local_search_service/public/mojom",
    "//chromeos/ash/components/local_search_service/public/mojom:mojom_js",
    "//chromeos/ash/components/system",
    "//chromeos/constants",
    "//chromeos/strings",
    "//components/keyed_service/content:content",
    "//content/public/browser",
    "//content/public/common",
    "//mojo/public/cpp/bindings",
    "//mojo/public/cpp/platform",
    "//ui/resources:webui_resources_grd_grit",
    "//ui/webui",
  ]
}

mojom("mojo_bindings") {
  sources = [ "help_app_ui.mojom" ]
  public_deps = [ "//url/mojom:url_mojom_gurl" ]
  webui_module_path = "/"

  # Help app is still using JS + Closure Compiler.
  generate_webui_js_bindings = true
}

source_set("unit_tests") {
  testonly = true

  sources = [
    "search/search_concept_unittest.cc",
    "search/search_handler_unittest.cc",
    "search/search_tag_registry_unittest.cc",
  ]

  deps = [
    ":help_app_ui",
    "//ash/webui/help_app_ui/search:mojo_bindings",
    "//ash/webui/help_app_ui/search:proto",
    "//base/test:test_support",
    "//chromeos/ash/components/local_search_service/public/mojom",
    "//mojo/public/cpp/bindings:bindings",
    "//testing/gtest",
  ]
}

source_set("browser_test_support") {
  testonly = true
  sources = [
    "test/help_app_ui_browsertest.cc",
    "test/help_app_ui_browsertest.h",
  ]

  defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]

  deps = [
    ":help_app_ui",
    "resources:test_build_ts",
    "//ash/public/cpp:cpp",
    "//ash/webui/web_applications/test:test_support",
    "//chrome/test:test_support_ui",
  ]
  data = [
    "$target_gen_dir/resources/driver.js",
    "$target_gen_dir/resources/guest_query_receiver.js",
    "$target_gen_dir/resources/help_app_guest_ui_browsertest.js",
    "$target_gen_dir/resources/help_app_ui_browsertest.js",
  ]
}

# Used to turn off tests that only work with our CIPD package.
buildflag_header("buildflags") {
  header = "buildflags.h"

  flags = [ "ENABLE_CROS_HELP_APP=$enable_cros_help_app" ]
}