Commit 5714752d authored by Ben Joyce's avatar Ben Joyce Committed by Commit Bot

Use android_deps robolectric.

Switched robolectric to be located in android_deps. Local modifications
are handled by creating a local_robolectric_jar, and then having the
target depend on that, local_robolectric_jar while using a
jar_exclude_patterns to remove the original class (to avoid a duplicate
class issue.) See design doc:
https://docs.google.com/document/d/1fTW40HEoqKvVyuOTWqwhJDK8OL0zX0AHpN-oZ7Wi2GM/edit?usp=sharing

After this lands and doesn't cause any breakages, will remove the
unnecessary robolectric jars in third_'party/robolectric.

Bug: 1060721
Change-Id: I7ec486177795ac1b0bf8fad6a52e63b815a61dc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186743
Commit-Queue: benjamin joyce <bjoyce@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Auto-Submit: benjamin joyce <bjoyce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772071}
parent b35a963e
......@@ -3656,10 +3656,10 @@ if (is_android) {
"//testing/android/junit:junit_test_support",
"//third_party/android_deps:androidx_test_monitor_java",
"//third_party/android_deps:androidx_test_uiautomator_uiautomator_java",
"//third_party/android_deps:robolectric_all_java",
"//third_party/android_support_test_runner:runner_java",
"//third_party/hamcrest:hamcrest_java",
"//third_party/junit:junit",
"//third_party/robolectric:robolectric_all_java",
]
}
......
......@@ -1335,9 +1335,9 @@ if (enable_java_templates) {
_build_config_target_name = "$target_name$build_config_target_suffix"
_deps = [
"//testing/android/junit:junit_test_support",
"//third_party/android_deps:robolectric_all_java",
"//third_party/junit",
"//third_party/mockito:mockito_java",
"//third_party/robolectric:robolectric_all_java",
]
if (defined(invoker.deps)) {
_deps += invoker.deps
......
......@@ -11,7 +11,7 @@ java_library("junit_test_support") {
sources = [ "src/org/chromium/webapk/test/WebApkTestHelper.java" ]
deps = [
"//chrome/android/webapk/libs/common:common_java",
"//third_party/android_deps:robolectric_all_java",
"//third_party/mockito:mockito_java",
"//third_party/robolectric:robolectric_all_java",
]
}
......@@ -242,7 +242,7 @@ android_library("junit_test_support") {
sources = [ "junit/src/org/chromium/components/embedder_support/util/ShadowUrlUtilities.java" ]
deps = [
":util_java",
"//third_party/robolectric:robolectric_all_java",
"//third_party/android_deps:robolectric_all_java",
]
}
......
......@@ -18,7 +18,7 @@ import org.chromium.base.test.util.Feature;
* Unit tests for the {@link NfcBlocklist} class.
*/
@RunWith(BaseRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@Config(sdk = 21, manifest = Config.NONE)
public class NfcBlocklistTest {
// Static historical bytes
private static final byte[] YUBIKEY_NEO_HISTORICAL_BYTES = new byte[] {
......@@ -87,4 +87,4 @@ public class NfcBlocklistTest {
assertFalse(areHistoricalBytesBlocked(new byte[] {}));
assertFalse(areHistoricalBytesBlocked(new byte[] {0x01, 0x02, 0x03}));
}
}
\ No newline at end of file
}
......@@ -24,7 +24,7 @@ import org.chromium.skia.mojom.ImageInfo;
* Test suite for conversion-to-Frame utils.
*/
@RunWith(BaseRobolectricTestRunner.class)
@Config(manifest = Config.NONE)
@Config(sdk = 21, manifest = Config.NONE)
public class BitmapUtilsTest {
private static final int VALID_WIDTH = 1;
private static final int VALID_HEIGHT = 1;
......
......@@ -27,9 +27,9 @@ java_library("junit_test_support") {
"java/src/org/chromium/testing/local/TestDir.java",
]
deps = [
"//third_party/android_deps:robolectric_all_java",
"//third_party/junit",
"//third_party/mockito:mockito_java",
"//third_party/robolectric:robolectric_all_java",
]
}
......
......@@ -30,6 +30,32 @@ java_group("android_support_v7_appcompat_java") {
]
}
java_group("robolectric_all_java") {
testonly = true
deps = [
":org_robolectric_annotations_java",
":org_robolectric_junit_java",
":org_robolectric_pluginapi_java",
":org_robolectric_plugins_maven_dependency_resolver_java",
":org_robolectric_resources_java",
":org_robolectric_robolectric_java",
":org_robolectric_sandbox_java",
":org_robolectric_shadowapi_java",
":org_robolectric_shadows_framework_java",
":org_robolectric_shadows_multidex_java",
":org_robolectric_shadows_playservices_java",
":org_robolectric_utils_java",
":org_robolectric_utils_reflector_java",
"//third_party/robolectric:android-all-10-robolectric-5803371_java",
"//third_party/robolectric:android-all-4.4_r1-robolectric-r2_java",
"//third_party/robolectric:android-all-5.0.2_r3-robolectric-r0_java",
"//third_party/robolectric:android-all-7.1.0_r7-robolectric-r1_java",
"//third_party/robolectric:android-all-8.0.0_r4-robolectric-r1_java",
"//third_party/robolectric:android-all-8.1.0-robolectric-4611349_java",
"//third_party/robolectric:android-all-9-robolectric-4913185-2_java",
]
}
# The dependencies below are used by chromecast internal.
java_group("android_support_v7_preference_java") {
deps = [ ":androidx_preference_preference_java" ]
......@@ -1455,6 +1481,23 @@ java_prebuilt("org_robolectric_shadows_playservices_java") {
bypass_platform_checks = true
}
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("org_robolectric_utils_java") {
jar_path = "libs/org_robolectric_utils/utils-4.3.1.jar"
output_name = "org_robolectric_utils"
enable_bytecode_checks = false
testonly = true
deps = [
":com_google_auto_service_auto_service_java",
":javax_annotation_javax_annotation_api_java",
":javax_inject_javax_inject_java",
":org_robolectric_annotations_java",
":org_robolectric_pluginapi_java",
":org_robolectric_utils_reflector_java",
]
bypass_platform_checks = true
}
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("android_arch_core_common_java") {
jar_path = "libs/android_arch_core_common/common-1.1.1.jar"
......@@ -2978,27 +3021,6 @@ java_prebuilt("org_robolectric_shadows_framework_java") {
bypass_platform_checks = true
}
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("org_robolectric_utils_java") {
jar_path = "libs/org_robolectric_utils/utils-4.3.1.jar"
output_name = "org_robolectric_utils"
enable_bytecode_checks = false
# To remove visibility constraint, add this dependency to
# //third_party/android_deps/build.gradle.
visibility = [ ":*" ]
testonly = true
deps = [
":com_google_auto_service_auto_service_java",
":javax_annotation_javax_annotation_api_java",
":javax_inject_javax_inject_java",
":org_robolectric_annotations_java",
":org_robolectric_pluginapi_java",
":org_robolectric_utils_reflector_java",
]
bypass_platform_checks = true
}
# This is generated, do not edit. Update BuildConfigGenerator.groovy instead.
java_prebuilt("org_robolectric_utils_reflector_java") {
jar_path = "libs/org_robolectric_utils_reflector/utils-reflector-4.3.1.jar"
......
......@@ -171,6 +171,7 @@ dependencies {
testCompile "org.robolectric:robolectric:${robolectricVersion}"
testCompile "org.robolectric:shadows-multidex:${robolectricVersion}"
testCompile "org.robolectric:shadows-playservices:${robolectricVersion}"
testCompile "org.robolectric:utils:${robolectricVersion}"
}
task setUpRepository(type: BuildConfigGenerator) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment