diff options
author | pkotwicz <pkotwicz@chromium.org> | 2015-11-11 09:55:07 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-11 17:56:14 +0000 |
commit | 93fa232bbc3784aea624d2a554d558cb6ad21ca0 (patch) | |
tree | c1ab711d44e98977023930b086782384cf087a50 | |
parent | 720163fc735ca812ef0aa2d7ca46dc0a5d407257 (diff) | |
download | chromium_src-93fa232bbc3784aea624d2a554d558cb6ad21ca0.zip chromium_src-93fa232bbc3784aea624d2a554d558cb6ad21ca0.tar.gz chromium_src-93fa232bbc3784aea624d2a554d558cb6ad21ca0.tar.bz2 |
Make components_browsertests work in GN
BUG=510485
Review URL: https://codereview.chromium.org/1408353012
Cr-Commit-Position: refs/heads/master@{#359111}
-rw-r--r-- | build/config/android/rules.gni | 17 | ||||
-rw-r--r-- | components/BUILD.gn | 55 | ||||
-rw-r--r-- | components/components_browsertests.isolate | 12 | ||||
-rw-r--r-- | components/components_tests.gyp | 2 | ||||
-rw-r--r-- | content/content_tests.gypi | 1 | ||||
-rw-r--r-- | content/shell/android/BUILD.gn | 13 | ||||
-rw-r--r-- | content/test/BUILD.gn | 2 | ||||
-rw-r--r-- | testing/android/native_test.gyp | 1 | ||||
-rw-r--r-- | testing/android/native_test/BUILD.gn | 13 | ||||
-rw-r--r-- | testing/test.gni | 6 |
10 files changed, 102 insertions, 20 deletions
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index 39dab60..d28d5a7 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni @@ -1813,6 +1813,8 @@ template("instrumentation_test_apk") { # support executables. # apk_name: The name of the produced apk. If unspecified, it uses the name # of the unittests_dep target postfixed with "_apk" +# use_default_launcher: Whether the default activity (NativeUnitTestActivity) +# should be used for launching tests. # # Example # unittest_apk("foo_unittests_apk") { @@ -1850,12 +1852,15 @@ template("unittest_apk") { "android_manifest", ]) final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" - java_files = [ - "//testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java", - "//testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java", - "//testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java", - "//testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java", - ] + + if (!defined(invoker.use_default_launcher) || invoker.use_default_launcher) { + java_files = [ + "//testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java", + "//testing/android/native_test/java/src/org/chromium/native_test/NativeTestActivity.java", + "//testing/android/native_test/java/src/org/chromium/native_test/NativeUnitTestActivity.java", + "//testing/android/native_test/java/src/org/chromium/native_test/NativeTestInstrumentationTestRunner.java", + ] + } if (!defined(invoker.android_manifest)) { android_manifest = "//testing/android/native_test/java/AndroidManifest.xml" diff --git a/components/BUILD.gn b/components/BUILD.gn index 6acbea7..5f68cdd 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -7,6 +7,10 @@ import("//build/config/ui.gni") import("//testing/test.gni") import("//tools/grit/repack.gni") +if (is_android) { + import("//build/config/android/rules.gni") +} + # Collection of all components. You wouldn't link to this, but this is rather # to reference the files so they can be compiled by the build system. group("all_components") { @@ -516,6 +520,48 @@ repack("components_tests_pak") { ] } +if (is_android) { + android_assets("components_browsertests_assets") { + testonly = true + sources = [ + "$root_out_dir/components_tests_resources.pak", + "$root_out_dir/content_shell.pak", + ] + deps = [ + ":components_tests_pak", + "//content/shell:pak", + "//third_party/icu:icu_assets", + "//v8:v8_external_startup_data_assets", + ] + } + + android_library("components_browsertests_java") { + testonly = true + deps = [ + ":components_browsertests_resources", + "//base:base_java", + "//content/public/test/android:content_java_test_support", + "//content/shell/android:content_shell_browsertests_java", + "//testing/android/native_test:native_test_java", + ] + DEPRECATED_java_in_dir = "//components/test/android/browsertests_apk/src" + } + + jinja_template("components_browsertests_manifest") { + testonly = true + input = + "//components/test/android/browsertests_apk/AndroidManifest.xml.jinja2" + output = + "${target_gen_dir}/components_browsertests_manifest/AndroidManifest.xml" + } + + android_resources("components_browsertests_resources") { + testonly = true + resource_dirs = [ "//components/test/android/browsertests_apk/res" ] + custom_package = "org.chromium.components_browsertests_apk" + } +} + # TODO(GYP): Delete this after we've converted everything to GN. # The _run targets exist only for compatibility w/ GYP. group("components_browsertests_run") { @@ -590,8 +636,15 @@ test("components_browsertests") { sources += [ "test/android/browsertests_apk/components_browser_tests_jni_onload.cc" ] sources -= [ "autofill/content/browser/risk/fingerprint_browsertest.cc" ] deps += [ "//testing/android/native_test:native_test_support" ] - use_launcher = false + use_default_launcher = false isolate_file = "components_browsertests.isolate" + android_manifest = + "${target_gen_dir}/components_browsertests_manifest/AndroidManifest.xml" + apk_deps = [ + ":components_browsertests_assets", + ":components_browsertests_java", + ":components_browsertests_manifest", + ] } if (is_linux) { diff --git a/components/components_browsertests.isolate b/components/components_browsertests.isolate index c3ed0b4..c3a8b56 100644 --- a/components/components_browsertests.isolate +++ b/components/components_browsertests.isolate @@ -34,20 +34,10 @@ ], }, }], - ['OS=="android"', { - 'variables': { - 'files': [ - '<(PRODUCT_DIR)/components_browsertests_apk_shell/assets/components_tests_resources.pak', - '<(PRODUCT_DIR)/components_browsertests_apk_shell/assets/content_shell.pak', - ], - }, - }], ['OS=="linux" or OS=="mac" or OS=="win"', { 'variables': { 'files': [ '../testing/test_env.py', - '<(PRODUCT_DIR)/components_tests_resources.pak', - '<(PRODUCT_DIR)/content_shell.pak', ], }, }], @@ -57,6 +47,8 @@ 'test/data/', 'dom_distiller/core/javascript/', '../third_party/dom_distiller_js/dist/test/data/', + '<(PRODUCT_DIR)/components_tests_resources.pak', + '<(PRODUCT_DIR)/content_shell.pak', ], }, }], diff --git a/components/components_tests.gyp b/components/components_tests.gyp index 437bf940..8187a69 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -1519,7 +1519,7 @@ 'includes': [ '../build/android/jinja_template.gypi' ], }, { - # TODO(GN) + # GN: //components:components_browsertests_apk 'target_name': 'components_browsertests_apk', 'type': 'none', 'dependencies': [ diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 2eb0e09..7a72fdb 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -1893,6 +1893,7 @@ ], }, { + # GN: //content/shell/android:content_shell_browsertests_java 'target_name': 'content_shell_browsertests_java', 'type': 'none', 'dependencies': [ diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index ae88a8c..e51f9eb 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn @@ -224,3 +224,16 @@ if (current_cpu != "x64") { ] } } + +# GYP: //content/content_tests.gypi:content_shell_browsertests_java" +android_library("content_shell_browsertests_java") { + testonly = true + deps = [ + ":content_shell_java", + "//base:base_java", + "//content/public/android:content_java", + "//testing/android/native_test:native_test_java", + "//ui/android:ui_java", + ] + DEPRECATED_java_in_dir = "browsertests/src" +} diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 2e0102e..5a35915 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn @@ -418,7 +418,7 @@ test("content_browsertests") { "//testing/android/native_test:native_test_support", ] - use_launcher = false + use_default_launcher = false } if (is_mac) { diff --git a/testing/android/native_test.gyp b/testing/android/native_test.gyp index 5c30a50..b6fed86 100644 --- a/testing/android/native_test.gyp +++ b/testing/android/native_test.gyp @@ -51,6 +51,7 @@ ], }, { + # GN: //testing/android/native_test:native_test_java 'target_name': 'native_test_java', 'type': 'none', 'dependencies': [ diff --git a/testing/android/native_test/BUILD.gn b/testing/android/native_test/BUILD.gn index 0e8ffcb..34c5906 100644 --- a/testing/android/native_test/BUILD.gn +++ b/testing/android/native_test/BUILD.gn @@ -35,6 +35,19 @@ source_set("native_test_native_code") { ] } +# GYP: //testing/android/native_test.gyp:native_test_java +android_library("native_test_java") { + testonly = true + deps = [ + "//base:base_java", + "//testing/android/appurify_support:appurify_support_java", + "//testing/android/reporter:reporter_java", + ] + srcjar_deps = [ "//base:base_native_libraries_gen" ] + DEPRECATED_java_in_dir = "java/src" + jar_excluded_patterns = [ "*/NativeLibraries.class" ] +} + # GYP: //testing/android/native_test.gyp:native_test_jni_headers generate_jni("native_test_jni_headers") { sources = [ diff --git a/testing/test.gni b/testing/test.gni index 449abd8..a6daf7e 100644 --- a/testing/test.gni +++ b/testing/test.gni @@ -54,7 +54,8 @@ template("test") { ]) deps = [] - if (!defined(invoker.use_launcher) || invoker.use_launcher) { + if (!defined(invoker.use_default_launcher) || + invoker.use_default_launcher) { deps += [ "//testing/android/native_test:native_test_native_code" ] } if (defined(invoker.deps)) { @@ -81,6 +82,9 @@ template("test") { if (defined(invoker.android_manifest)) { android_manifest = invoker.android_manifest } + if (defined(invoker.use_default_launcher)) { + use_default_launcher = invoker.use_default_launcher + } } _test_name = main_target_name |