chromium/ios/chrome/test/swift_interop/BUILD.gn

# Copyright 2022 The Chromium Authors. All rights resAerved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/apple/swift_source_set.gni")
import("//build/config/ios/ios_test_runner_xcuitest.gni")
import("//build/config/ios/rules.gni")

source_set("objc_interop_tests") {
  testonly = true
  configs += [ "//build/config/ios:xctest_config" ]
  sources = [ "objc_xctest.mm" ]
  deps = [ "//base" ]
  frameworks = [ "Foundation.framework" ]
}

source_set("swift_interop_tests_support_files") {
  testonly = true
  sources = [
    "classes/inlined_class.h",
    "classes/outlined_class.h",
    "classes/outlined_impl.cc",
    "classes/polymorphism.h",
    "enum/enum.h",
    "namespace/namespace.h",
    "pointer/object_passing.h",
    "pointer/pointer_returner.cc",
    "pointer/pointer_returner.h",
    "pointer/unique_ptr.cc",
    "pointer/unique_ptr.h",
    "struct/struct.h",
  ]
}

swift_source_set("swift_interop_tests") {
  testonly = true
  configs += [ "//build/config/ios:enable_swift_cxx_interop" ]
  bridge_header = "swift_bridge.h"
  sources = [
    "classes/inlined_xctest.swift",
    "classes/outlined_xctest.swift",
    "classes/polymorphism_xctest.swift",
    "enum/enum_xctest.swift",
    "namespace/namespace_xctest.swift",
    "pointer/object_passing_xctest.swift",
    "pointer/pointer_xctest.swift",
    "pointer/unique_ptr_xctest.swift",
    "struct/struct_xctest.swift",
  ]
  frameworks = [ "UIKit.framework" ]
  deps = [
    "//base",
    "//build/config/ios:xctest",
  ]
}

ios_app_bundle("ios_swift_interop_xcuitests") {
  testonly = true
  info_plist = "host-Info.plist"
  sources = [ "test_host.mm" ]
  frameworks = [ "UIKit.framework" ]
}

ios_test_runner_xcuitest("ios_swift_interop_xcuitests_module") {
  xcode_test_application_name = "ios_swift_interop_xcuitests"
  deps = [
    ":objc_interop_tests",
    ":swift_interop_tests",
    ":swift_interop_tests_support_files",
  ]
  data_deps = [ ":ios_swift_interop_xcuitests" ]
}