# 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")

module_output_path = "aafwk_standard/intent_test"

###############################################################################
config("module_private_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "//utils/native/base/include",
    "//sdk/appexecfwk/appexecfwk_base/include",
    "//foundation/aafwk/standard/interfaces/innerkits/want/include",
    "//foundation/aafwk/standard/interfaces/innerkits/intent/include",
    "//foundation/appexecfwk/standard/common/log/include",
  ]

  defines = [
    "APP_LOG_TAG = \"WantUnitTest\"",
    "LOG_DOMAIN = 0xD002210",
  ]
}

config("module_private_want_param_wrapper_config") {
  visibility = [ ":*" ]
  include_dirs = [
    "//utils/native/base/include",
    "//sdk/appexecfwk/appexecfwk_base/include",
    "//foundation/aafwk/standard/interfaces/innerkits/want/include",
    "//foundation/aafwk/standard/frameworks/kits/content/cpp/src",
  ]

  defines = [
    "APP_LOG_TAG = \"WantUnitTest\"",
    "LOG_DOMAIN = 0xD002210",
  ]
}

ohos_unittest("intent_parcelable_test") {
  module_out_path = module_output_path
  sources = []

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "ipc:ipc_core",
  ]
}

ohos_unittest("intent_base_test") {
  module_out_path = module_output_path
  sources = []

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "ipc:ipc_core",
  ]
}

ohos_unittest("intent_parse_to_uri_test") {
  module_out_path = module_output_path
  sources = []

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "ipc:ipc_core",
  ]
}

ohos_unittest("intent_parameters_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/intent.cpp",
    "../src/ohos/aafwk/content/intent_params.cpp",
    "unittest/common/intent_parameters_test.cpp",
  ]

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "ipc:ipc_core",
  ]
}

ohos_unittest("intent_params_test") {
  module_out_path = module_output_path
  sources = []

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "ipc:ipc_core",
  ]
}

ohos_unittest("intent_filter_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/intent.cpp",
    "../src/ohos/aafwk/content/intent_filter.cpp",
    "../src/ohos/aafwk/content/intent_params.cpp",
    "unittest/common/intent_filter_test.cpp",
  ]

  configs = [
    ":module_private_config",
    #"//foundation/aafwk/standard/interfaces/innerkits/intent:intent_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [ "appexecfwk_standard:appexecfwk_base" ]
}

ohos_unittest("operation_test") {
  module_out_path = module_output_path
  sources = [
    "//foundation/aafwk/standard/interfaces/innerkits/want/include/ohos/aafwk/content/operation_builder.h",
    "//foundation/distributedschedule/dmsfwk/services/dtbschedmgr/include/uri.h",
    "unittest/common/operation_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [ "appexecfwk_standard:appexecfwk_base" ]
}

ohos_unittest("patterns_matcher_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/patterns_matcher.cpp",
    "unittest/common/patterns_matcher_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

ohos_unittest("skills_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/skills.cpp",
    "unittest/common/skills_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

ohos_unittest("want_params_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/want_params.cpp",
    "../src/ohos/aafwk/content/want_params_wrapper.cpp",
    "unittest/common/want_params_test.cpp",
  ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

ohos_unittest("want_params_wrapper_test") {
  module_out_path = module_output_path
  sources = [
    "../src/ohos/aafwk/content/want_params.cpp",
    "../src/ohos/aafwk/content/want_params_wrapper.cpp",
    "unittest/common/want_params_wrapper_test.cpp",
  ]

  configs = [ ":module_private_want_param_wrapper_config" ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

ohos_unittest("want_test") {
  module_out_path = module_output_path
  sources = [ "unittest/common/want_test.cpp" ]

  configs = [
    ":module_private_config",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want_public_config",
  ]

  deps = [
    "//foundation/aafwk/standard/interfaces/innerkits/base:base",
    "//foundation/aafwk/standard/interfaces/innerkits/want:want",
    "//foundation/appexecfwk/standard/common:libappexecfwk_common",
    "//foundation/distributedschedule/dmsfwk/interfaces/innerkits/uri:zuri",
    "//third_party/googletest:gtest_main",
    "//utils/native/base:utils",
  ]

  external_deps = [
    "appexecfwk_standard:appexecfwk_base",
    "hiviewdfx_hilog_native:libhilog",
  ]
}

###############################################################################

group("unittest") {
  testonly = true
  deps = []

  deps += [
    ##    ":intent_params_test",
    ##    ":intent_parameters_test",
    ##    ":intent_parse_to_uri_test",
    ##    ":intent_base_test",
    ##    ":intent_filter_test",
    ":operation_test",
    ":patterns_matcher_test",
    ":skills_test",
    ":want_params_test",
    ":want_params_wrapper_test",
    ":want_test",
  ]
}
###############################################################################
