# 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("//testing/test.gni") import("//chrome/test/base/js2gtest.gni") import("//chrome/browser/resources/chromeos/chromevox/run_jsbundler.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: 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 } test("select_to_speak_extension_tests") { sources = [ "//chrome/browser/extensions/browsertest_util.cc", "//chrome/browser/extensions/browsertest_util.h", "//chrome/browser/ui/webui/web_ui_test_handler.cc", "//chrome/browser/ui/webui/web_ui_test_handler.h", "//chrome/test/base/extension_js_browser_test.cc", "//chrome/test/base/extension_js_browser_test.h", "//chrome/test/base/extension_load_waiter_one_shot.cc", "//chrome/test/base/extension_load_waiter_one_shot.h", "//chrome/test/base/javascript_browser_test.cc", "//chrome/test/base/javascript_browser_test.h", "//chrome/test/base/test_chrome_web_ui_controller_factory.cc", "//chrome/test/base/test_chrome_web_ui_controller_factory.h", "//chrome/test/base/web_ui_browser_test.cc", "//chrome/test/base/web_ui_browser_test.h", ] deps = [ ":select_to_speak_extjs_tests", "//base", "//base/test:test_support", "//chrome:browser_tests_pak", "//chrome:packed_resources", "//chrome:resources", "//chrome/browser", "//chrome/renderer", "//chrome/test:browser_tests_runner", "//chrome/test:test_support", "//chrome/test:test_support_ui", "//content/test:test_support", "//testing/gmock", "//testing/gtest", ] 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_notifications.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", ] 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", ] } 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") { }