# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build/test.gni")
import("//foundation/aafwk/standard/aafwk.gni")
module_output_path = "ability_runtime/mt_dispatcher_test"

ohos_moduletest("GlobalTaskDispatcherModuleTest") {
  module_out_path = module_output_path
  sources = [
    "${dispatcher_path}/src/dispatcher/base_task_dispatcher.cpp",
    "${dispatcher_path}/src/dispatcher/global_task_dispatcher.cpp",
    "${dispatcher_path}/src/dispatcher/group_impl.cpp",
    "${dispatcher_path}/src/dispatcher/parallel_task_dispatcher.cpp",
    "${dispatcher_path}/src/dispatcher/parallel_task_dispatcher_base.cpp",
    "${dispatcher_path}/src/dispatcher/serial_task_dispatcher.cpp",
    "${dispatcher_path}/src/dispatcher/spec_task_dispatcher.cpp",
    "${dispatcher_path}/src/dispatcher/task_dispatcher_context.cpp",
    "${dispatcher_path}/src/task/barrier_handler.cpp",
    "${dispatcher_path}/src/task/sync_task.cpp",
    "${dispatcher_path}/src/task/task.cpp",
    "${dispatcher_path}/src/threading/default_thread_factory.cpp",
    "${dispatcher_path}/src/threading/default_worker_pool_config.cpp",
    "${dispatcher_path}/src/threading/task_executor.cpp",
    "${dispatcher_path}/src/threading/work_thread.cpp",
    "${dispatcher_path}/src/threading/worker_pool.cpp",
  ]
  sources += [ "global_task_dispatcher_module_test.cpp" ]
  configs = [ "${aafwk_path}/common/test/moduletest/task_dispatcher:dispatcher_mt_test_config" ]
  deps = [
    "${appexecfwk_path}/common:libappexecfwk_common",
    "${dispatcher_path}/test:dispatcher_test_source",
  ]
  external_deps = [ "hiviewdfx_hilog_native:libhilog" ]
}

group("moduletest") {
  testonly = true

  deps = [ ":GlobalTaskDispatcherModuleTest" ]
}
