| # Copyright 2016 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/config/features.gni") |
| import("//chrome/browser/resources/chromeos/chromevox/run_jsbundler.gni") |
| import("//chrome/common/features.gni") |
| import("//chrome/test/base/js2gtest.gni") |
| import("//testing/test.gni") |
| import("//third_party/closure_compiler/compile_js.gni") |
| |
| assert(is_chromeos) |
| |
| select_to_speak_out_dir = "$root_out_dir/resources/chromeos/select_to_speak" |
| |
| group("build") { |
| deps = [ |
| ":select_to_speak_copied_files", |
| ":select_to_speak_guest_manifest", |
| ":select_to_speak_manifest", |
| "//chrome/browser/resources/chromeos/select_to_speak/strings:select_to_speak_strings", |
| ] |
| } |
| |
| # Instead of setting up one copy target for each subdirectory, use a script |
| # to copy all files. |
| run_jsbundler("select_to_speak_copied_files") { |
| mode = "copy" |
| dest_dir = select_to_speak_out_dir |
| sources = [ |
| "../chromevox/cvox2/background/automation_predicate.js", |
| "../chromevox/cvox2/background/automation_util.js", |
| "../chromevox/cvox2/background/constants.js", |
| "../chromevox/cvox2/background/tree_walker.js", |
| "checked.png", |
| "closure_shim.js", |
| "earcons/null_selection.ogg", |
| "input_handler.js", |
| "metrics_utils.js", |
| "node_utils.js", |
| "options.css", |
| "options.html", |
| "paragraph_utils.js", |
| "prefs_manager.js", |
| "rect_utils.js", |
| "select_to_speak-2x.svg", |
| "select_to_speak.js", |
| "select_to_speak_gdocs_script.js", |
| "select_to_speak_main.js", |
| "select_to_speak_options.js", |
| "unchecked.png", |
| "word_utils.js", |
| ] |
| rewrite_rules = [ |
| rebase_path(".", root_build_dir) + ":", |
| rebase_path(closure_library_dir, root_build_dir) + ":closure", |
| rebase_path("../chromevox/cvox2/background", root_build_dir) + ":", |
| ] |
| } |
| |
| # TODO(crbug/978200): refactor this into another file like generate_manifest.gni |
| # to share with other extensions. |
| template("manifest") { |
| version_file = "//chrome/VERSION" |
| version_script = "//build/util/version.py" |
| template_file = "manifest.json.jinja2" |
| output_file = invoker.output_file |
| key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAukZ6JJWr0jHmFTkn0pcigpjI+cP0FqTo8FRIcCwy2fPeM+Ymf+7C9MK642i+Nhdr2qSsRF26AMIKbBdSDUnh04bfg5J/rKa/VO88LvXENYQMGhTo1y9mVg2OsbQJtEL9aTLU2G0SoKcr3g/+lggBKR5ydW1Qa0WGGAM9XrLm8iu/wn2uF4mfcMii6KfyEsAwWalpr/Td5WbtIoNNDpNeKO4ZSZJis1n9PZXqaOKpW7PqFDpEHw2PnPATxkcqj/wIx+Shgada0fhrzMlhXLhhj7ThSSWbuTz5n5NebuQ49/Z2ATgpBCSzYBVXEXMDe6LBBtGiZ/QR9UkA8Lz8bP6xIQIDAQAB" |
| action(target_name) { |
| script = "//chrome/browser/resources/chromeos/chromevox/tools/generate_manifest.py" |
| inputs = [ |
| version_file, |
| version_script, |
| ] |
| sources = [ |
| template_file, |
| ] |
| outputs = [ |
| output_file, |
| ] |
| args = [ |
| "--key=$key", |
| "--version_file=" + rebase_path(version_file, root_build_dir), |
| "--output_manifest=" + rebase_path(output_file, root_build_dir), |
| ] |
| if (defined(invoker.is_guest_manifest) && invoker.is_guest_manifest) { |
| args += [ "--is_guest_manifest=1" ] |
| } |
| args += rebase_path(sources, root_build_dir) |
| } |
| } |
| |
| manifest("select_to_speak_manifest") { |
| output_file = "$select_to_speak_out_dir/manifest.json" |
| } |
| |
| manifest("select_to_speak_guest_manifest") { |
| output_file = "$select_to_speak_out_dir/manifest_guest.json" |
| is_guest_manifest = true |
| } |
| |
| source_set("browser_tests") { |
| testonly = true |
| assert(enable_extensions) |
| |
| deps = [ |
| ":select_to_speak_extjs_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/resources.pak", |
| "$root_out_dir/resources/chromeos/select_to_speak/", |
| "$root_out_dir/test_data/chrome/browser/resources/chromeos/select_to_speak/", |
| |
| # The test uses data from the original location, not the copied one. |
| "//chrome/browser/resources/chromeos/chromevox/", |
| "//chrome/browser/resources/chromeos/select_to_speak/", |
| "//chrome/test/data/webui/test_api.js", |
| "//chrome/third_party/mock4js/", |
| "//third_party/accessibility-audit/axs_testing.js", |
| "//third_party/chaijs/chai.js", |
| "//ui/webui/resources/js/cr.js", |
| ] |
| } |
| |
| js2gtest("select_to_speak_extjs_tests") { |
| test_type = "extension" |
| sources = [ |
| "select_to_speak_keystroke_selection_test.extjs", |
| "select_to_speak_mouse_selection_test.extjs", |
| "select_to_speak_prefs_test.extjs", |
| ] |
| gen_include_files = [ |
| "../chromevox/testing/callback_helper.js", |
| "mock_storage.js", |
| "mock_tts.js", |
| "select_to_speak_e2e_test_base.js", |
| "pipe.jpg", |
| ] |
| extra_js_files = [ |
| "//chrome/test/data/webui/settings/fake_settings_private.js", |
| "//chrome/test/data/webui/fake_chrome_event.js", |
| ] |
| |
| # The test base classes generate C++ code with these deps. |
| deps = [ |
| "//ash", |
| "//ash/keyboard/ui", |
| "//base", |
| "//chrome/browser/chromeos", |
| "//chrome/common", |
| ] |
| defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ] |
| } |
| |
| js_type_check("closure_compile") { |
| deps = [ |
| ":../chromevox/cvox2/background/automation_predicate", |
| ":../chromevox/cvox2/background/automation_util", |
| ":../chromevox/cvox2/background/constants", |
| ":../chromevox/cvox2/background/tree_walker", |
| ":closure_shim", |
| ":input_handler", |
| ":metrics_utils", |
| ":node_utils", |
| ":paragraph_utils", |
| ":prefs_manager", |
| ":rect_utils", |
| ":select_to_speak", |
| ":select_to_speak_options", |
| ":word_utils", |
| ] |
| } |
| |
| js_library("select_to_speak") { |
| deps = [ |
| ":../chromevox/cvox2/background/automation_util", |
| ":../chromevox/cvox2/background/constants", |
| ":input_handler", |
| ":metrics_utils", |
| ":node_utils", |
| ":paragraph_utils", |
| ":prefs_manager", |
| ":rect_utils", |
| ":word_utils", |
| ] |
| externs_list = [ |
| "$externs_path/accessibility_private.js", |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| "$externs_path/clipboard.js", |
| "$externs_path/command_line_private.js", |
| "$externs_path/pending.js", |
| ] |
| } |
| |
| js_library("select_to_speak_options") { |
| deps = [ |
| ":prefs_manager", |
| ] |
| externs_list = [ |
| "$externs_path/accessibility_private.js", |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| "$externs_path/metrics_private.js", |
| ] |
| } |
| |
| js_library("node_utils") { |
| deps = [ |
| ":paragraph_utils", |
| ":rect_utils", |
| ] |
| externs_list = [ "$externs_path/automation.js" ] |
| } |
| |
| js_library("word_utils") { |
| deps = [ |
| ":paragraph_utils", |
| ] |
| externs_list = [ "$externs_path/automation.js" ] |
| } |
| |
| js_library("paragraph_utils") { |
| externs_list = [ |
| "$externs_path/accessibility_private.js", |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| ] |
| } |
| |
| js_library("input_handler") { |
| deps = [ |
| ":rect_utils", |
| ] |
| } |
| |
| js_library("rect_utils") { |
| } |
| |
| js_library("prefs_manager") { |
| externs_list = [ "$externs_path/settings_private.js" ] |
| } |
| |
| js_library("metrics_utils") { |
| deps = [ |
| ":prefs_manager", |
| ] |
| externs_list = [ "$externs_path/metrics_private.js" ] |
| } |
| |
| js_library("../chromevox/cvox2/background/automation_util") { |
| deps = [ |
| ":../chromevox/cvox2/background/automation_predicate", |
| ":../chromevox/cvox2/background/constants", |
| ":../chromevox/cvox2/background/tree_walker", |
| ] |
| externs_list = [ |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| ] |
| } |
| |
| js_library("../chromevox/cvox2/background/tree_walker") { |
| deps = [ |
| ":../chromevox/cvox2/background/automation_predicate", |
| ":../chromevox/cvox2/background/constants", |
| ] |
| externs_list = [ |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| ] |
| } |
| |
| js_library("../chromevox/cvox2/background/automation_predicate") { |
| deps = [ |
| ":../chromevox/cvox2/background/constants", |
| ] |
| externs_list = [ |
| "$externs_path/automation.js", |
| "$externs_path/chrome_extensions.js", |
| ] |
| } |
| |
| js_library("../chromevox/cvox2/background/constants") { |
| } |
| |
| js_library("closure_shim") { |
| } |