chromium/ios/web/favicon/BUILD.gn

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

import("//ios/build/config.gni")
import("//ios/web/public/js_messaging/compile_ts.gni")
import("//ios/web/public/js_messaging/optimize_js.gni")

source_set("favicon") {
  deps = [
    ":favicon_event_listeners_js",
    ":favicon_js",
    "//ios/web/public",
    "//ios/web/public/js_messaging",
    "//ios/web/web_state:web_state_impl_header",
  ]
  sources = [
    "favicon_java_script_feature.h",
    "favicon_java_script_feature.mm",
    "favicon_url.cc",
    "favicon_util.h",
    "favicon_util.mm",
  ]
}

compile_ts("compile_typescript") {
  sources = [
    "//ios/web/public/js_messaging/resources/utils.ts",
    "resources/favicon.ts",
    "resources/favicon_event_listeners.ts",
    "resources/favicon_utils.ts",
  ]
}

optimize_js("favicon_js") {
  visibility = [ ":favicon" ]

  _script = filter_include(get_target_outputs(":compile_typescript"),
                           [ "*favicon.js" ])
  primary_script = _script[0]
  sources = _script

  deps = [ ":compile_typescript" ]
}

optimize_js("favicon_event_listeners_js") {
  visibility = [ ":favicon" ]

  _script = filter_include(get_target_outputs(":compile_typescript"),
                           [ "*favicon_event_listeners.js" ])
  primary_script = _script[0]
  sources = _script

  deps = [ ":compile_typescript" ]
}

source_set("unittests") {
  testonly = true
  deps = [
    "//base",
    "//ios/web/favicon",
    "//ios/web/public/favicon",
    "//ios/web/public/test:test_fixture",
    "//testing/gtest",
  ]
  sources = [ "favicon_util_unittest.mm" ]
}

source_set("inttests") {
  testonly = true
  deps = [
    "//base",
    "//base/test:test_support",
    "//ios/web/public",
    "//ios/web/public:web_state_observer",
    "//ios/web/public/test",
    "//ios/web/public/test:test_fixture",
  ]
  sources = [ "favicon_callbacks_inttest.mm" ]
}