chromium/ios/web/js_features/context_menu/BUILD.gn

# Copyright 2021 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/optimize_ts.gni")

source_set("context_menu") {
  deps = [
    ":context_menu_all_frames_ts",
    ":context_menu_main_frame_ts",
    "//base",
    "//components/url_formatter",
    "//ios/web/common",
    "//ios/web/public",
    "//ios/web/public/js_messaging",
  ]

  sources = [
    "context_menu_constants.h",
    "context_menu_constants.mm",
    "context_menu_java_script_feature.h",
    "context_menu_java_script_feature.mm",
    "context_menu_params.mm",
    "context_menu_params_utils.h",
    "context_menu_params_utils.mm",
  ]
}

compile_ts("compile_surrounding_text_ts") {
  sources = [ "resources/surrounding_text.ts" ]
  deps = [ "//ios/web/public/js_messaging:util_scripts" ]
}

optimize_ts("context_menu_all_frames_ts") {
  visibility = [ ":context_menu" ]

  sources = [ "resources/all_frames_context_menu.ts" ]

  deps = [
    ":compile_surrounding_text_ts",
    "//ios/web/public/js_messaging:gcrweb",
    "//ios/web/public/js_messaging:util_scripts",
  ]
}

optimize_ts("context_menu_main_frame_ts") {
  visibility = [ ":context_menu" ]

  sources = [ "resources/main_frame_context_menu.ts" ]

  deps = [ "//ios/web/public/js_messaging:gcrweb" ]
}

source_set("unittests") {
  testonly = true

  deps = [
    ":context_menu",
    "//base",
    "//base/test:test_support",
    "//components/url_formatter",
    "//ios/web/common",
    "//ios/web/common:web_view_creation_util",
    "//ios/web/js_messaging",
    "//ios/web/js_messaging:java_script_feature",
    "//ios/web/js_messaging:web_view_js_utils",
    "//ios/web/public/js_messaging:web_view_js_utils",
    "//ios/web/public/test",
    "//ios/web/public/test:javascript_test",
    "//ios/web/public/test:test_fixture",
    "//ios/web/test/fakes",
    "//testing/gtest",
  ]

  sources = [
    "context_menu_java_script_feature_unittest.mm",
    "context_menu_js_unittest.mm",
    "context_menu_params_utils_unittest.mm",
  ]
}