chromium/ios/web/test/BUILD.gn

# Copyright 2016 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/web/public/js_messaging/optimize_ts.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")

mojom("mojo_bindings") {
  testonly = true
  sources = [ "mojo_test.mojom" ]
}

repack("packed_resources") {
  testonly = true
  sources = [
    "$root_gen_dir/ios/web/ios_web_resources.pak",
    "$root_gen_dir/ios/web/test/test_resources.pak",
    "$root_gen_dir/ui/resources/webui_resources.pak",
  ]
  deps = [
    ":resources",
    "//ios/web:resources",
    "//ui/resources",
  ]
  output = "$target_gen_dir/resources.pak"
  copy_data_to_bundle = true
}

grit("resources") {
  source = "test_resources.grd"

  inputs = [ "${root_gen_dir}/ios/web/test/mojo_test.mojom.js" ]
  deps = [ ":mojo_bindings_js" ]
  outputs = [
    "grit/test_resources.h",
    "test_resources.pak",
  ]
}

source_set("test_support") {
  testonly = true

  # This public_dep is a workaround because there is a circular dependency
  # (this target should public_dep on //ios/web/public/test).
  public_deps = [ "//testing/gtest" ]

  deps = [
    ":java_script_feature_test_inject_once_js",
    ":java_script_feature_test_reinject_js",
    ":test_constants",
    "//base",
    "//base/test:test_support",
    "//components/crash/core/common",
    "//ios/testing:verify_custom_webkit",
    "//ios/web:threads",
    "//ios/web/common:uikit",
    "//ios/web/common:web_view_creation_util",
    "//ios/web/js_messaging:java_script_feature_manager_header",
    "//ios/web/navigation:core",
    "//ios/web/public/test:test_fixture",
    "//ios/web/public/test:util",
    "//ios/web/public/test/fakes",
    "//ios/web/public/test/http_server",
    "//ios/web/test/fakes",
    "//ios/web/web_state:web_state_impl_header",
    "//ios/web/web_state/ui:web_controller_header",
    "//ios/web/web_state/ui:wk_web_view_configuration_provider_header",
    "//net",
    "//third_party/ocmock",
    "//ui/base",
    "//ui/display",
  ]

  sources = [
    "test_web_thread.cc",
    "url_test_util.mm",
    "web_int_test.h",
    "web_int_test.mm",
    "web_task_environment.cc",
    "web_test_suite.mm",
    "web_test_with_web_controller.h",
    "web_test_with_web_controller.mm",
    "wk_web_view_crash_utils.h",
    "wk_web_view_crash_utils.mm",
  ]
}

source_set("js_test_util_internal") {
  testonly = true

  deps = [ "//base/test:test_support" ]

  sources = [
    "js_test_util_internal.h",
    "js_test_util_internal.mm",
  ]
}

source_set("test_constants") {
  testonly = true
  sources = [
    "test_url_constants.cc",
    "test_url_constants.h",
  ]
}

optimize_ts("java_script_feature_test_inject_once_js") {
  testonly = true

  sources = [ "resources/java_script_feature_test_inject_once.ts" ]

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

optimize_ts("java_script_feature_test_reinject_js") {
  testonly = true

  sources = [ "resources/java_script_feature_test_reinject.ts" ]

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