chromium/chrome/test/data/webui/chromeos/ash_common/BUILD.gn

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

import("//third_party/closure_compiler/compile_js.gni")
import("//tools/typescript/webui_ts_library.gni")
import("//ui/webui/resources/tools/generate_grd.gni")

webui_ts_library("build_ts") {
  root_dir = "."
  out_dir = "$target_gen_dir/tsc"
  tsconfig_base = "tsconfig_base.json"
  path_mappings = [ "chrome://webui-test/*|" +
                    rebase_path("$root_gen_dir/chrome/test/data/webui/tsc/*",
                                target_gen_dir) ]
  in_files = [
    "cr_container_shadow_behavior_test.ts",
    "cr_policy_indicator_behavior_test.ts",
    "cr_policy_strings.ts",
    "cr_scrollable_behavior_test.ts",
    "cr_test.js",
    "fake_method_resolver_test.js",
    "fake_observables_test.js",
    "i18n_behavior_test.js",
    "keyboard_diagram_test.js",
    "list_property_update_behavior_test.ts",
    "navigation_selector_test.js",
    "navigation_view_panel_test.js",
    "page_toolbar_test.js",
    "post_message_api/post_message_api_client_test.ts",
    "post_message_api/post_message_api_test.ts",
    "shortcut_input_key_test.ts",
    "shortcut_input_test.ts",
    "shortcut_utils_test.ts",
    "typescript_utils/strict_query_test.ts",
  ]
  deps = [
    "../..:build_ts",
    "//ash/webui/common/resources:build_ts",
    "//ash/webui/common/resources/cr_elements:build_ts",
    "//third_party/polymer/v3_0:library",
    "//ui/webui/resources/js:build_ts",
    "//ui/webui/resources/mojo:build_ts",
  ]
  extra_deps = [ "//ash/webui/common/resources:generate_definitions" ]
}

generate_grd("build_grdp") {
  grd_prefix = "webui_chromeos_ash_common"
  out_grd = "$target_gen_dir/resources.grdp"

  input_files = [
    "post_message_api/iframe.html",
    "cr_test.html",
  ]
  input_files_base_dir = rebase_path(".", "//")

  deps = [ ":build_ts" ]
  manifest_files =
      filter_include(get_target_outputs(":build_ts"), [ "*_manifest.json" ])
  resource_path_prefix = "chromeos/ash_common"
}

js_type_check("closure_compile") {
  is_polymer3 = true
  closure_flags = default_closure_args + [
                    "browser_resolver_prefix_replacements=\"chrome://resources/ash/common/=" + rebase_path(
                            "//ash/webui/common/resources/",
                            root_build_dir) + "\"",
                    "browser_resolver_prefix_replacements=\"chrome://webui-test/chromeos/=" + rebase_path(
                            "//chrome/test/data/webui/chromeos/",
                            root_build_dir) + "\"",
                    "browser_resolver_prefix_replacements=\"chrome://webui-test/=./gen/chrome/test/data/webui/tsc\"",
                    "js_module_root=" + rebase_path("//chrome/test/data/webui/",
                                                    root_build_dir),
                    "js_module_root=./gen/chrome/test/data/webui/",
                  ]
  deps = [
    ":fake_method_resolver_test",
    ":fake_observables_test",
    ":navigation_selector_test",
    ":navigation_view_panel_test",
    ":page_toolbar_test",
  ]
}

js_library("fake_observables_test") {
  deps = [
    "..:chai_assert",
    "//ash/webui/common/resources:fake_observables",
  ]
  externs_list = [ "$externs_path/mocha-2.5.js" ]
}

js_library("fake_method_resolver_test") {
  deps = [
    "..:chai_assert",
    "//ash/webui/common/resources:fake_method_resolver",
  ]
  externs_list = [ "$externs_path/mocha-2.5.js" ]
}

js_library("keyboard_diagram_test") {
  deps = [
    "..:chai_assert",
    "//ash/webui/common/resources:keyboard_diagram",
  ]
  externs_list = [ "$externs_path/mocha-2.5.js" ]
}

js_library("navigation_selector_test") {
  deps = [
    "..:chai_assert",
    "//ash/webui/common/resources:navigation_selector",
    "//third_party/polymer/v3_0/components-chromium/iron-collapse:iron-collapse",
  ]
  externs_list = [ "$externs_path/mocha-2.5.js" ]
}

js_library("navigation_view_panel_test") {
  deps = [
    "..:chai_assert",
    "//ash/webui/common/resources:navigation_selector",
    "//ash/webui/common/resources:navigation_view_panel",
  ]
  externs_list = [
    "//ash/webui/common/resources/cr_elements/cr_drawer/cr_drawer_externs.js",
    "$externs_path/mocha-2.5.js",
  ]
}

js_library("page_toolbar_test") {
  deps = [
    "..:chai_assert",
    "..:test_util",
    "//ash/webui/common/resources:page_toolbar",
  ]
  externs_list = [ "$externs_path/mocha-2.5.js" ]
}