1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
|
# Copyright 2020 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/features.gni")
import(
"//chrome/browser/resources/chromeos/accessibility/tools/run_jsbundler.gni")
import("//chrome/common/features.gni")
import("//chrome/test/base/ash/js2gtest.gni")
import("//testing/test.gni")
import("//tools/typescript/ts_library.gni")
assert(is_chromeos)
accessibility_common_out_dir =
"$root_out_dir/resources/chromeos/accessibility/common"
tsc_out_dir = "$target_gen_dir/tsc"
# Directory where typescript build will occur.
ts_build_staging_dir = "$target_gen_dir/ts_build_staging"
group("build") {
deps = [
":copied_files",
"tutorial:build",
]
}
js_sources = [
"gdocs_script.js",
"testing/accessibility_test_base.js",
"testing/test_node_generator.js",
]
# Add typescript files to compile here.
ts_modules = [
"action_fulfillment/context_checker.ts",
"action_fulfillment/input_controller.ts",
"action_fulfillment/macros/custom_callback_macro.ts",
"action_fulfillment/macros/delete_prev_sent_macro.ts",
"action_fulfillment/macros/input_text_view_macro.ts",
"action_fulfillment/macros/key_press_macro.ts",
"action_fulfillment/macros/macro.ts",
"action_fulfillment/macros/mouse_click_macro.ts",
"action_fulfillment/macros/nav_sent_macro.ts",
"action_fulfillment/macros/repeat_macro.ts",
"action_fulfillment/macros/repeatable_key_press_macro.ts",
"action_fulfillment/macros/smart_delete_phrase_macro.ts",
"action_fulfillment/macros/smart_insert_before_macro.ts",
"action_fulfillment/macros/smart_replace_phrase_macro.ts",
"action_fulfillment/macros/smart_select_between_macro.ts",
"action_fulfillment/macros/toggle_dictation_macro.ts",
"array_util.ts",
"async_util.ts",
"automation_predicate.ts",
"automation_util.ts",
"bridge_callback_manager.ts",
"bridge_helper.ts",
"browser_util.ts",
"chrome_event_handler.ts",
"constants.ts",
"cursors/cursor.ts",
"cursors/range.ts",
"cursors/recovery_strategy.ts",
"event_generator.ts",
"event_handler.ts",
"features.ts",
"flags.ts",
"mv2/instance_checker.ts",
"mv3/instance_checker.ts",
"keep_alive.ts",
"key_code.ts",
"local_storage.ts",
"node_navigation_utils.ts",
"node_utils.ts",
"paragraph_utils.ts",
"rect_util.ts",
"repeated_event_handler.ts",
"repeated_tree_change_handler.ts",
"sentence_utils.ts",
"settings.ts",
"string_util.ts",
"testing/test_import_manager.ts",
"tree_walker.ts",
"word_utils.ts",
]
# The relative path in the staging directory of TS modules that need to be copied from another directory.
copied_ts_modules = [ "action_fulfillment/macros/macro_names.ts" ]
ts_definitions = [
"../definitions/accessibility_private_mv2.d.ts",
"../definitions/automation.d.ts",
"../definitions/command_line_private.d.ts",
"../definitions/extensions.d.ts",
"../definitions/extension_types.d.ts",
"../definitions/i18n.d.ts",
"../definitions/runtime.d.ts",
"../definitions/settings_private_mv2.d.ts",
"../definitions/storage_mv2.d.ts",
"../definitions/tabs.d.ts",
"../definitions/tts.d.ts",
"../definitions/windows.d.ts",
"//tools/typescript/definitions/chrome_event.d.ts",
]
# Copy all JS and TS sources to a staging folder. All generated TS/JS files
# will also be copied into this folder, which will allow us to support a TS
# build that uses both checked-in and generated files.
copy("stage_ts_sources") {
sources = js_sources + ts_modules
outputs = [ "$ts_build_staging_dir/{{source_target_relative}}" ]
}
copy("copy_ash_common_macros") {
sources = [ "//ash/webui/common/resources/accessibility/macro_names.ts" ]
outputs = [ "$ts_build_staging_dir/action_fulfillment/macros/macro_names.ts" ]
}
ts_library("ts_build") {
root_dir = "$ts_build_staging_dir"
out_dir = tsc_out_dir
definitions = ts_definitions
composite = true
in_files = ts_modules + js_sources + copied_ts_modules
# Targets that need to run before running the TS build.
extra_deps = [
# copied files in staging directory.
":copy_ash_common_macros",
":stage_ts_sources",
]
tsconfig_base = "../tsconfig.base.json"
}
run_jsbundler("copied_files") {
mode = "copy"
dest_dir = accessibility_common_out_dir
deps = [ ":ts_build" ]
sources =
js_sources + filter_include(get_target_outputs(":ts_build"), [ "*.js" ])
rewrite_rules = [
rebase_path(tsc_out_dir, root_build_dir) + ":",
rebase_path(".", root_build_dir) + ":",
]
}
source_set("browser_tests") {
testonly = true
assert(enable_extensions)
deps = [ ":accessibility_tests" ]
# TODO(jamescook): Figure out which of these are really necessary.
data = [
"$root_out_dir/chrome_100_percent.pak",
"$root_out_dir/chrome_200_percent.pak",
"$root_out_dir/locales/en-US.pak",
"$root_out_dir/locales/fr.pak",
"$root_out_dir/resources.pak",
# The test uses data from the original location.
"//chrome/browser/resources/chromeos/accessibility/common/",
]
data += js2gtest_js_libraries
}
js2gtest("accessibility_tests") {
test_type = "extension"
sources = [
"array_util_test.js",
"automation_predicate_test.js",
"automation_util_test.js",
"cursors/cursors_test.js",
"cursors/recovery_strategy_test.js",
"event_generator_test.js",
"keep_alive_test.js",
"local_storage_test.js",
"paragraph_utils_overflow_test.js",
"rect_util_test.js",
"repeated_event_handler_test.js",
"repeated_tree_change_handler_test.js",
"string_util_test.js",
"tree_walker_test.js",
]
# These are unit tests run under an extension environment to get ES6 module support.
sources += [
"node_navigation_utils_unittest.js",
"node_utils_unittest.js",
"paragraph_utils_unittest.js",
"sentence_utils_unittest.js",
"word_utils_unittest.js",
]
gen_include_files = [
"testing/accessibility_test_base.js",
"testing/assert_additions.js",
"testing/callback_helper.js",
"testing/common_e2e_test_base.js",
"testing/doc_utils.js",
"testing/e2e_test_base.js",
"testing/mock_storage.js",
"testing/snippets.js",
]
# The test base classes generate C++ code with these deps.
deps = [
"//ash",
"//base",
"//chrome/browser/ash/accessibility",
"//chrome/browser/ash/system_web_apps",
"//chrome/common",
]
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
}
|