blob: 832c128ceb2a57b02bc401ffec709394977012d1 [file] [log] [blame]
# Copyright 2018 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("//third_party/closure_compiler/compile_js.gni")
import("//third_party/closure_compiler/js_unit_tests.gni")
# TODO(tapted): This folder should be restricted to file_manager, but related
# apps currently depend on background_base, which depends on
# volume_manager_factory, and that pulls in nearly everything else. For now,
# document externally-exposed targets visible with this helper, and hide
# transitive dependencies (but note those transitive dependencies should move
# elsewhere too).
related_apps = [
"//ui/file_manager/audio_player/*",
"//ui/file_manager/file_manager/*",
"//ui/file_manager/gallery/*",
"//ui/file_manager/video_player/*",
]
group("closure_compile") {
testonly = true
deps = [
":closure_compile_module",
":test_support_type_check",
":unit_tests_type_check",
]
}
# Default to private.
visibility = [ ":*" ]
js_type_check("closure_compile_module") {
deps = [
":app_window_wrapper",
":app_windows",
":background",
":background_base",
":closure_compile_externs",
":crostini",
":device_handler",
":drive_sync_handler",
":duplicate_finder",
":entry_location_impl",
":file_operation_handler",
":file_operation_manager",
":file_operation_util",
":import_history",
":launcher",
":launcher_search",
":media_import_handler",
":media_scanner",
":metadata_proxy",
":mount_metrics",
":progress_center",
":runtime_loaded_test_util",
":task_queue",
":test_util_base",
":volume_info_impl",
":volume_info_list_impl",
":volume_manager_factory",
":volume_manager_impl",
":volume_manager_util",
]
}
js_type_check("test_support_type_check") {
testonly = true
deps = [
":mock_crostini",
":mock_drive_sync_handler",
":mock_file_operation_manager",
":mock_media_scanner",
":mock_progress_center",
":mock_volume_manager",
":test_import_history",
]
}
js_library("closure_compile_externs") {
sources = []
externs_list = [
"$externs_path/metrics_private.js",
"../../../externs/background/crostini.js",
"../../../externs/background/drive_sync_handler.js",
"../../../externs/background/file_browser_background.js",
"../../../externs/background/file_browser_background_full.js",
"../../../externs/background/file_operation_manager.js",
"../../../externs/background/import_history.js",
"../../../externs/background/import_runner.js",
"../../../externs/background/media_import_handler.js",
"../../../externs/background/media_scanner.js",
"../../../externs/background/progress_center.js",
"../../../externs/background_window.js",
"../../../externs/css_rule.js",
"../../../externs/file_operation_progress_event.js",
"../../../externs/launcher_search_provider.js",
"../../../externs/platform.js",
]
}
js_library("app_window_wrapper") {
visibility += related_apps
deps = [
":app_windows",
"../../common/js:async_util",
"//ui/file_manager/base/js:app_util",
]
}
js_library("app_windows") {
}
js_library("background") {
deps = [
":app_windows",
":background_base",
":crostini",
":device_handler",
":drive_sync_handler",
":duplicate_finder",
":file_operation_handler",
":file_operation_manager",
":import_history",
":launcher",
":launcher_search",
":media_import_handler",
":mount_metrics",
":progress_center",
"../../common/js:files_app_entry_types",
"../../common/js:metrics",
"../../common/js:util",
"//ui/file_manager/base/js:volume_manager_types",
]
}
js_library("background_base") {
visibility += related_apps
deps = [
":app_windows",
":volume_manager_factory",
"../../common/js:util",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:load_time_data",
]
}
js_library("crostini") {
deps = [
"../../common/js:metrics",
"//ui/file_manager/base/js:volume_manager_types",
"//ui/file_manager/externs:volume_manager",
]
externs_list = [ "//ui/file_manager/externs/background/crostini.js" ]
}
js_library("mock_crostini") {
testonly = true
deps = [
":crostini",
]
externs_list = [ "//ui/file_manager/externs/background/crostini.js" ]
visibility = []
visibility = [ "//ui/file_manager/file_manager/*" ]
}
js_unittest("crostini_unittest") {
deps = [
":mock_crostini",
"//ui/file_manager/file_manager/common/js:mock_entry",
"//ui/webui/resources/js:webui_resource_test",
]
}
js_library("device_handler") {
deps = [
":volume_manager_factory",
"../../common/js:async_util",
"../../common/js:importer_common",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js/cr:event_target",
]
}
js_unittest("device_handler_unittest") {
deps = [
":device_handler",
":mock_volume_manager",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/file_manager/common/js:test_importer_common",
]
}
js_library("mock_drive_sync_handler") {
testonly = true
deps = [
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "../../../externs/background/drive_sync_handler.js" ]
visibility = []
visibility = [ "//ui/file_manager/file_manager/*" ]
}
js_library("drive_sync_handler") {
deps = [
":progress_center",
"//ui/file_manager/file_manager/common/js:async_util",
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "../../../externs/background/drive_sync_handler.js" ]
}
js_unittest("drive_sync_handler_unittest") {
deps = [
":drive_sync_handler",
":mock_progress_center",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
]
}
js_library("duplicate_finder") {
deps = [
":import_history",
":volume_manager_factory",
"../../common/js:importer_common",
"../../common/js:lru_cache",
"../../common/js:metrics",
]
}
js_unittest("duplicate_finder_unittest") {
deps = [
":duplicate_finder",
":mock_volume_manager",
":test_import_history",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/file_manager/common/js:mock_entry",
"//ui/file_manager/file_manager/common/js:test_importer_common",
]
}
js_library("entry_location_impl") {
deps = [
"//ui/file_manager/base/js:volume_manager_types",
]
externs_list = [ "../../../externs/entry_location.js" ]
}
js_library("file_operation_handler") {
deps = [
":file_operation_manager",
":progress_center",
]
}
js_unittest("file_operation_handler_unittest") {
deps = [
":file_operation_handler",
":mock_file_operation_manager",
":mock_progress_center",
"//ui/file_manager/base/js:test_error_reporting",
]
}
js_library("mock_file_operation_manager") {
testonly = true
deps = [
":file_operation_manager",
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "../../../externs/background/file_operation_manager.js" ]
}
js_library("file_operation_manager") {
deps = [
":file_operation_util",
":volume_manager_factory",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "../../../externs/background/file_operation_manager.js" ]
}
js_unittest("file_operation_manager_unittest") {
deps = [
":file_operation_manager",
":metadata_proxy",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/file_manager/common/js:mock_entry",
]
}
js_library("file_operation_util") {
deps = [
":metadata_proxy",
"../../common/js:async_util",
"../../common/js:util",
]
externs_list =
[ "//ui/file_manager/externs/file_operation_progress_event.js" ]
}
js_library("metadata_proxy") {
deps = [
"../../common/js:lru_cache",
]
}
js_library("import_history") {
deps = [
":metadata_proxy",
"../../common/js:importer_common",
"../../common/js:util",
]
externs_list = [ "../../../externs/background/import_history.js" ]
}
js_unittest("import_history_unittest") {
deps = [
":import_history",
"//ui/file_manager/file_manager/common/js:mock_entry",
"//ui/file_manager/file_manager/common/js:test_importer_common",
]
}
js_library("launcher") {
deps = [
":app_window_wrapper",
":app_windows",
]
}
js_library("launcher_search") {
deps = [
":launcher",
":volume_manager_factory",
"../../common/js:file_type",
"../../common/js:util",
]
}
js_library("media_import_handler") {
deps = [
":drive_sync_handler",
":import_history",
":media_scanner",
":progress_center",
":task_queue",
"../../common/js:importer_common",
"../../common/js:metrics",
]
externs_list = [ "//ui/file_manager/externs/background/import_runner.js" ]
}
js_unittest("media_import_handler_unittest") {
deps = [
":media_import_handler",
":mock_drive_sync_handler",
":mock_media_scanner",
":mock_progress_center",
":mock_volume_manager",
":test_import_history",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/file_manager/common/js:mock_entry",
"//ui/file_manager/file_manager/common/js:test_importer_common",
]
}
js_library("mock_media_scanner") {
testonly = true
deps = [
":media_scanner",
":test_import_history",
]
externs_list = [ "../../../externs/background/media_scanner.js" ]
visibility = []
visibility = [ "//ui/file_manager/file_manager/*" ]
}
js_library("media_scanner") {
deps = [
":file_operation_util",
"../../common/js:importer_common",
]
externs_list = [ "../../../externs/background/media_scanner.js" ]
}
js_unittest("media_scanner_unittest") {
deps = [
":media_scanner",
":mock_media_scanner",
"//ui/file_manager/file_manager/common/js:test_importer_common",
]
}
js_library("mock_volume_manager") {
visibility += related_apps
deps = [
":volume_info_impl",
":volume_info_list_impl",
":volume_manager_factory",
":volume_manager_impl",
"//ui/file_manager/file_manager/common/js:mock_entry",
]
}
js_library("mock_progress_center") {
testonly = true
deps = [
":progress_center",
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "//ui/file_manager/externs/background/progress_center.js" ]
}
js_library("progress_center") {
deps = [
"../../common/js:async_util",
"../../common/js:progress_center_common",
"../../common/js:util",
"../../foreground/js/ui:progress_center_panel",
"//ui/webui/resources/js/cr:event_target",
]
externs_list = [ "//ui/file_manager/externs/background/progress_center.js" ]
}
js_library("task_queue") {
deps = [
":duplicate_finder",
"../../common/js:importer_common",
]
}
js_unittest("task_queue_unittest") {
deps = [
":task_queue",
"../../common/js:importer_common",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/base/js:volume_manager_types",
"//ui/webui/resources/js:assert",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js/cr:event_target",
]
}
js_library("test_util_base") {
}
js_library("test_import_history") {
testonly = true
deps = [
":import_history",
"//ui/webui/resources/js:webui_resource_test",
]
}
js_library("runtime_loaded_test_util") {
# TODO(tapted): Move this target to //ui/file_manager/base. It is used in the
# background page of all |related_apps|, but loaded at runtime by
# :test_util_base via extension messaging, so doesn't need to be depended on
# except by the closure compilation target. The exception is the "unpacked"
# test framework, which copies some testing functions into its test context.
visibility += [ "//ui/file_manager/file_manager/test/js:test_util" ]
deps = [
":app_windows",
":test_util_base",
"//ui/file_manager/base/js:error_counter",
]
externs_list = [ "$externs_path/webview_tag.js" ]
}
js_library("volume_info_impl") {
deps = [
"//ui/file_manager/base/js:volume_manager_types",
]
externs_list = [ "../../../externs/volume_info.js" ]
}
js_library("volume_info_list_impl") {
deps = [
".:volume_info_impl",
"../../common/js:util",
"//ui/webui/resources/js:cr",
"//ui/webui/resources/js/cr:ui",
"//ui/webui/resources/js/cr/ui:array_data_model",
]
externs_list = [ "../../../externs/volume_info_list.js" ]
}
js_library("mount_metrics") {
deps = [
"../../common/js:metrics",
]
}
js_unittest("mount_metrics_unittest") {
deps = [
":mount_metrics",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/base/js:volume_manager_types",
]
}
js_library("volume_manager_impl") {
deps = [
":entry_location_impl",
":volume_info_list_impl",
":volume_manager_util",
"../../common/js:async_util",
]
externs_list = [ "../../../externs/volume_manager.js" ]
}
js_library("volume_manager_factory") {
deps = [
":volume_manager_impl",
]
}
js_unittest("volume_manager_unittest") {
deps = [
":volume_manager_factory",
"//ui/file_manager/base/js:mock_chrome",
"//ui/file_manager/base/js:test_error_reporting",
"//ui/file_manager/file_manager/common/js:mock_entry",
]
}
js_library("volume_manager_util") {
deps = [
":volume_info_impl",
"../../common/js:metrics",
"../../common/js:util",
"//ui/file_manager/base/js:volume_manager_types",
]
}
js_unit_tests("unit_tests") {
deps = [
":crostini_unittest",
":device_handler_unittest",
":drive_sync_handler_unittest",
":duplicate_finder_unittest",
":file_operation_handler_unittest",
":file_operation_manager_unittest",
":import_history_unittest",
":media_import_handler_unittest",
":media_scanner_unittest",
":mount_metrics_unittest",
":task_queue_unittest",
":volume_manager_unittest",
]
}