chromium/android_webview/test/embedded_test_server/BUILD.gn

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

import("//build/config/android/config.gni")
import("//build/config/android/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")

android_library("aw_net_java_test_support") {
  testonly = true
  srcjar_deps = [ ":aw_net_jni_headers" ]
  sources = [
    "java/src/org/chromium/android_webview/test/AwEmbeddedTestServer.java",
    "java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java",
    "java/src/org/chromium/android_webview/test/AwEmbeddedTestServerService.java",
  ]
  deps = [
    "//base:base_java_test_support",
    "//net/android:embedded_test_server_aidl_java",
    "//net/android:net_java",
    "//net/android:net_java_test_support",
    "//net/android:net_test_support_provider_java",
    "//third_party/jni_zero:jni_zero_java",
  ]
}

generate_jni("aw_net_jni_headers") {
  testonly = true
  sources = [
    "java/src/org/chromium/android_webview/test/AwEmbeddedTestServerImpl.java",
  ]
}

source_set("aw_java_test_native_support") {
  testonly = true
  sources = [
    "../../../net/test/embedded_test_server/android/embedded_test_server_android.cc",
    "../../../net/test/embedded_test_server/android/embedded_test_server_android.h",
    "aw_embedded_test_server.cc",
    "aw_test_entry_point.cc",
  ]
  deps = [
    "//net:test_support",
    "//services/network/public/cpp",
  ]
  public_deps = [
    ":aw_net_jni_headers",
    "//net/android:net_test_support_provider_jni",
  ]
}

shared_library_with_jni("aw_net_java_test_native_support") {
  testonly = true
  deps = [
    ":aw_java_test_native_support",
    "//net:test_support",
  ]
  configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  configs += [ "//build/config/android:hide_all_but_jni" ]
  java_targets = [ ":aw_net_test_support_apk" ]
}

android_apk("aw_net_test_support_apk") {
  testonly = true

  # Used as an additional_apk in test scripts.
  never_incremental = true

  deps = [ ":aw_net_java_test_support" ]
  android_manifest = "java/AndroidManifest.xml"
  apk_name = "ChromiumNetTestAwSupport"
  shared_libraries = [ ":aw_net_java_test_native_support" ]
  srcjar_deps = [ ":aw_net_java_test_native_support__jni_registration" ]
}