# Copyright 2014 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/rules.gni")
import("//third_party/jni_zero/jni_zero.gni")
group("system") {
testonly = true
deps = [
":mojo_javatests",
":mojo_test_apk",
":system_impl_java",
]
}
generate_jni("system_impl_java_jni_headers") {
sources = [
"src/org/chromium/mojo/system/impl/BaseRunLoop.java",
"src/org/chromium/mojo/system/impl/CoreImpl.java",
"src/org/chromium/mojo/system/impl/WatcherImpl.java",
]
}
source_set("native_support") {
sources = [
"base_run_loop.cc",
"core_impl.cc",
"watcher_impl.cc",
]
deps = [
":system_impl_java_jni_headers",
"//base",
"//mojo/public/c/system",
"//mojo/public/cpp/system",
]
}
android_library("system_impl_java") {
sources = [
"src/org/chromium/mojo/system/impl/BaseRunLoop.java",
"src/org/chromium/mojo/system/impl/CoreImpl.java",
"src/org/chromium/mojo/system/impl/DataPipeConsumerHandleImpl.java",
"src/org/chromium/mojo/system/impl/DataPipeProducerHandleImpl.java",
"src/org/chromium/mojo/system/impl/HandleBase.java",
"src/org/chromium/mojo/system/impl/MessagePipeHandleImpl.java",
"src/org/chromium/mojo/system/impl/SharedBufferHandleImpl.java",
"src/org/chromium/mojo/system/impl/UntypedHandleImpl.java",
"src/org/chromium/mojo/system/impl/WatcherImpl.java",
]
srcjar_deps = [ ":system_impl_java_jni_headers" ]
deps = [
"//base:base_java",
"//build/android:build_java",
"//mojo/public/java:system_java",
"//third_party/jni_zero:jni_zero_java",
]
}
generate_jni("test_support_jni") {
testonly = true
sources = [ "javatests/src/org/chromium/mojo/MojoTestRule.java" ]
}
# Targets should also depend on :test_support for the native side.
android_library("test_support_java") {
testonly = true
sources = [ "javatests/src/org/chromium/mojo/MojoTestRule.java" ]
srcjar_deps = [ ":test_support_jni" ]
deps = [
"//base:base_java",
"//third_party/androidx:androidx_annotation_annotation_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit",
]
}
source_set("test_support") {
testonly = true
sources = [ "javatests/mojo_test_rule.cc" ]
deps = [
":test_support_jni",
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
]
defines = [ "UNIT_TEST" ]
}
generate_jni("mojo_javatests_jni") {
testonly = true
sources = [
"javatests/src/org/chromium/mojo/bindings/NullableValueTypesTestUtil.java",
"javatests/src/org/chromium/mojo/bindings/ValidationTestUtil.java",
]
}
android_library("mojo_javatests") {
testonly = true
sources = [
"javatests/src/org/chromium/mojo/HandleMock.java",
"javatests/src/org/chromium/mojo/TestUtils.java",
"javatests/src/org/chromium/mojo/bindings/BindingsHelperTest.java",
"javatests/src/org/chromium/mojo/bindings/BindingsTest.java",
"javatests/src/org/chromium/mojo/bindings/BindingsTestUtils.java",
"javatests/src/org/chromium/mojo/bindings/BindingsVersioningTest.java",
"javatests/src/org/chromium/mojo/bindings/ConnectorTest.java",
"javatests/src/org/chromium/mojo/bindings/ExecutorFactoryTest.java",
"javatests/src/org/chromium/mojo/bindings/InterfacesTest.java",
"javatests/src/org/chromium/mojo/bindings/MessageHeaderTest.java",
"javatests/src/org/chromium/mojo/bindings/NameGeneratorTest.java",
"javatests/src/org/chromium/mojo/bindings/NullableValueTypesTest.java",
"javatests/src/org/chromium/mojo/bindings/NullableValueTypesTestUtil.java",
"javatests/src/org/chromium/mojo/bindings/ReadAndDispatchMessageTest.java",
"javatests/src/org/chromium/mojo/bindings/RouterTest.java",
"javatests/src/org/chromium/mojo/bindings/SerializationTest.java",
"javatests/src/org/chromium/mojo/bindings/ValidationTest.java",
"javatests/src/org/chromium/mojo/bindings/ValidationTestUtil.java",
"javatests/src/org/chromium/mojo/bindings/ValidationTestUtilTest.java",
"javatests/src/org/chromium/mojo/bindings/test/mojom/mojo/IntegrationTestInterfaceTestHelper.java",
"javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java",
"javatests/src/org/chromium/mojo/system/impl/WatcherImplTest.java",
]
srcjar_deps = [ ":mojo_javatests_jni" ]
deps = [
":system_impl_java",
":test_support_java",
"//base:base_java_test_support",
"//mojo/public/interfaces/bindings/tests:test_interfaces_java",
"//mojo/public/interfaces/bindings/tests:test_mojom_import2_java",
"//mojo/public/interfaces/bindings/tests:test_mojom_import_java",
"//mojo/public/java:bindings_java",
"//mojo/public/java:system_java",
"//third_party/androidx:androidx_test_runner_java",
"//third_party/jni_zero:jni_zero_java",
"//third_party/junit",
]
data = [ "//mojo/public/interfaces/bindings/tests/data/validation/" ]
}
shared_library_with_jni("mojo_java_unittests") {
testonly = true
sources = [
"javatests/init_library.cc",
"javatests/nullable_value_types_test_util.cc",
"javatests/validation_test_util.cc",
]
deps = [
":mojo_javatests_jni",
":native_support",
":test_support",
"//base",
"//base/test:test_support",
"//mojo/core/embedder",
"//mojo/public/cpp/bindings/tests:mojo_public_bindings_test_utils",
"//mojo/public/cpp/bindings/tests:test_types",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
]
defines = [ "UNIT_TEST" ]
configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
configs += [ "//build/config/android:hide_all_but_jni" ]
java_targets = [ ":mojo_test_apk__test_apk" ]
}
instrumentation_test_apk("mojo_test_apk") {
apk_name = "MojoTest"
android_manifest = "javatests/AndroidManifest.xml"
deps = [
":mojo_javatests",
":system_impl_java",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
"//mojo/public/java:bindings_java",
]
shared_libraries = [ ":mojo_java_unittests" ]
srcjar_deps = [ ":mojo_java_unittests__jni_registration" ]
}