chromium/ui/accessibility/extensions/BUILD.gn

# Copyright 2017 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("//testing/test.gni")
import("//tools/grit/grit_rule.gni")

if (is_chromeos_ash) {
  import("//chrome/test/base/ash/js2gtest.gni")
}

group("extensions") {
  deps = [
    ":caretbrowsing",
    ":colorenhancer",
    ":highcontrast",
  ]
}

group("extension_tests") {
  testonly = true
  if (is_chromeos_ash) {
    deps = [
      ":colorenhancer_tests",
      ":highcontrast_tests",
    ]
  }
}

locale_files = [
  "_locales/am/messages.json",
  "_locales/ar/messages.json",
  "_locales/bg/messages.json",
  "_locales/bn/messages.json",
  "_locales/ca/messages.json",
  "_locales/cs/messages.json",
  "_locales/da/messages.json",
  "_locales/de/messages.json",
  "_locales/el/messages.json",
  "_locales/en_GB/messages.json",
  "_locales/en/messages.json",
  "_locales/es/messages.json",
  "_locales/es_419/messages.json",
  "_locales/et/messages.json",
  "_locales/fa/messages.json",
  "_locales/fi/messages.json",
  "_locales/fil/messages.json",
  "_locales/fr/messages.json",
  "_locales/gu/messages.json",
  "_locales/he/messages.json",
  "_locales/hi/messages.json",
  "_locales/hr/messages.json",
  "_locales/hu/messages.json",
  "_locales/id/messages.json",
  "_locales/it/messages.json",
  "_locales/ja/messages.json",
  "_locales/kn/messages.json",
  "_locales/ko/messages.json",
  "_locales/lt/messages.json",
  "_locales/lv/messages.json",
  "_locales/ml/messages.json",
  "_locales/mr/messages.json",
  "_locales/ms/messages.json",
  "_locales/nl/messages.json",
  "_locales/nb/messages.json",
  "_locales/pl/messages.json",
  "_locales/pt_BR/messages.json",
  "_locales/pt_PT/messages.json",
  "_locales/ro/messages.json",
  "_locales/ru/messages.json",
  "_locales/sk/messages.json",
  "_locales/sl/messages.json",
  "_locales/sr/messages.json",
  "_locales/sv/messages.json",
  "_locales/sw/messages.json",
  "_locales/ta/messages.json",
  "_locales/te/messages.json",
  "_locales/th/messages.json",
  "_locales/tr/messages.json",
  "_locales/uk/messages.json",
  "_locales/vi/messages.json",
  "_locales/zh_CN/messages.json",
  "_locales/zh_TW/messages.json",

  # Pseudolocales
  "_locales/ar_XB/messages.json",
  "_locales/en_XA/messages.json",
]

#
# Animation Policy
#

group("animation") {
  deps = [
    ":animation_copy",
    ":animation_strings",
  ]
}

grit("animation_strings") {
  source = "strings/accessibility_extensions_strings.grd"
  outputs = locale_files
  output_dir = "$root_out_dir/animation"
  resource_ids = ""
}

animation_files = [
  "animation/animation.png",
  "animation/manifest.json",
  "animation/popup.html",
  "animation/popup.js",
]

copy("animation_copy") {
  sources = animation_files
  outputs = [ "$root_out_dir/{{source_target_relative}}" ]
}

#
# Color Enhancer
#

group("colorenhancer") {
  deps = [
    ":colorenhancer_copy",
    ":colorenhancer_strings",
  ]
}

grit("colorenhancer_strings") {
  source = "strings/accessibility_extensions_strings.grd"
  outputs = locale_files
  output_dir = "$root_out_dir/colorenhancer"
  resource_ids = ""
}

colorenhancer_files = [
  "colorenhancer/manifest.json",
  "colorenhancer/src/background.js",
  "colorenhancer/src/common.js",
  "colorenhancer/src/cvd.js",
  "colorenhancer/src/cvd_type.js",
  "colorenhancer/src/matrix.js",
  "colorenhancer/src/popup.html",
  "colorenhancer/src/popup.js",
  "colorenhancer/src/storage.js",
  "colorenhancer/res/cvd-128.png",
  "colorenhancer/res/cvd-16.png",
  "colorenhancer/res/cvd-19.png",
  "colorenhancer/res/cvd-38.png",
  "colorenhancer/res/cvd-48.png",
  "colorenhancer/res/setup.css",
]

copy("colorenhancer_copy") {
  sources = colorenhancer_files
  outputs = [ "$root_out_dir/{{source_target_relative}}" ]
}

if (is_chromeos_ash) {
  webui_test_deps = [ "//chrome/test:browser_tests_runner" ]

  test("colorenhancer_tests") {
    deps = [ ":colorenhancer_js_webui_tests" ]
    deps += webui_test_deps
    data = js2gtest_js_libraries
  }

  js2gtest("colorenhancer_js_webui_tests") {
    test_type = "webui"
    sources = [
      "colorenhancer/src/matrix_test.js",
      "colorenhancer/src/storage_test.js",
    ]
    gen_include_files = [
      "colorenhancer/src/cvd_type.js",
      "colorenhancer/src/matrix.js",
      "colorenhancer/src/storage.js",
      "webstore_extension_test_base.js",
      "//chrome/browser/resources/chromeos/accessibility/common/testing/mock_storage.js",
    ]
    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
  }
}

#
# High Contrast
#

group("highcontrast") {
  deps = [
    ":highcontrast_copy",
    ":highcontrast_strings",
  ]
}

grit("highcontrast_strings") {
  source = "strings/accessibility_extensions_strings.grd"
  outputs = locale_files
  output_dir = "$root_out_dir/highcontrast"
  resource_ids = ""
}

highcontrast_files = [
  "highcontrast/manifest.json",
  "highcontrast/background.js",
  "highcontrast/common.js",
  "highcontrast/highcontrast-16.png",
  "highcontrast/highcontrast-19.png",
  "highcontrast/highcontrast-48.png",
  "highcontrast/highcontrast-128.png",
  "highcontrast/highcontrast.js",
  "highcontrast/popup.html",
  "highcontrast/popup.js",
  "highcontrast/storage.js",
]

copy("highcontrast_copy") {
  sources = highcontrast_files
  outputs = [ "$root_out_dir/{{source_target_relative}}" ]
}

#
# Long Descriptions In Context Menu
#

group("longdesc") {
  deps = [
    ":longdesc_copy",
    ":longdesc_strings",
  ]
}

grit("longdesc_strings") {
  source = "strings/accessibility_extensions_strings.grd"
  outputs = locale_files
  output_dir = "$root_out_dir/longdesc"
  resource_ids = ""
}

longdesc_files = [
  "longdesc/background.js",
  "longdesc/border.css",
  "longdesc/icon-16.png",
  "longdesc/icon-48.png",
  "longdesc/icon-128.png",
  "longdesc/icon.png",
  "longdesc/lastRightClick.js",
  "longdesc/manifest.json",
  "longdesc/options.html",
  "longdesc/options.js",
]

copy("longdesc_copy") {
  sources = longdesc_files
  outputs = [ "$root_out_dir/{{source_target_relative}}" ]
}

#
# Caret Browsing
#

group("caretbrowsing") {
  deps = [
    ":caretbrowsing_copy",
    ":caretbrowsing_strings",
  ]
}

grit("caretbrowsing_strings") {
  source = "strings/accessibility_extensions_strings.grd"
  outputs = locale_files
  output_dir = "$root_out_dir/caretbrowsing"
  resource_ids = ""
}

caretbrowsing_files = [
  "caretbrowsing/background.js",
  "caretbrowsing/caret_128.png",
  "caretbrowsing/caret_16.png",
  "caretbrowsing/caret_19_on.png",
  "caretbrowsing/caret_19.png",
  "caretbrowsing/caret_48.png",
  "caretbrowsing/manifest.json",
]

copy("caretbrowsing_copy") {
  sources = caretbrowsing_files
  outputs = [ "$root_out_dir/caretbrowsing/{{source_file_part}}" ]
}

if (is_chromeos_ash) {
  test("highcontrast_tests") {
    deps = [ ":highcontrast_webui_js_tests" ]
    deps += webui_test_deps

    data = js2gtest_js_libraries
  }

  js2gtest("highcontrast_webui_js_tests") {
    test_type = "webui"
    sources = [ "highcontrast/storage_test.js" ]
    gen_include_files = [
      "highcontrast/storage.js",
      "testing/webstore_extension_test_base.js",
      "//chrome/browser/resources/chromeos/accessibility/common/testing/callback_helper.js",
      "//chrome/browser/resources/chromeos/accessibility/common/testing/mock_storage.js",
    ]

    defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
  }
}