Loading packages/SettingsLib/tests/robotests/Android.bp +33 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,10 @@ android_robolectric_test { name: "SettingsLibRoboTests", srcs: ["src/**/*.java"], static_libs: [ "Settings_robolectric_meta_service_file", "Robolectric_shadows_androidx_fragment_upstream", "SettingsLib-robo-testutils", "androidx.fragment_fragment", "androidx.test.core", "androidx.core_core", "testng", // TODO: remove once JUnit on Android provides assertThrows Loading @@ -53,6 +56,20 @@ android_robolectric_test { test_options: { timeout: 36000, }, upstream: true, } java_genrule { name: "Settings_robolectric_meta_service_file", out: ["robolectric_meta_service_file.jar"], tools: ["soong_zip"], cmd: "mkdir -p $(genDir)/META-INF/services/ && touch $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" + "echo -e 'org.robolectric.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'org.robolectric.shadows.multidex.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'org.robolectric.shadows.httpclient.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + //"echo -e 'com.android.settings.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'com.android.settingslib.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/", } java_library { Loading @@ -60,9 +77,23 @@ java_library { srcs: [ "testutils/com/android/settingslib/testutils/**/*.java", ], javacflags: [ "-Aorg.robolectric.annotation.processing.shadowPackage=com.android.settingslib.testutils.shadow", "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR", // Uncomment the below to debug annotation processors not firing. //"-verbose", //"-XprintRounds", //"-XprintProcessorInfo", //"-Xlint", //"-J-verbose", ], plugins: [ "auto_value_plugin_1.9", "auto_value_builder_plugin_1.9", "Robolectric_processor_upstream", ], libs: [ "Robolectric_all-target", "Robolectric_all-target_upstream", "mockito-robolectric-prebuilt", "truth-prebuilt", ], Loading packages/SettingsLib/tests/robotests/config/robolectric.properties +1 −0 Original line number Diff line number Diff line sdk=NEWEST_SDK instrumentedPackages=androidx.preference packages/SettingsLib/tests/robotests/fragment/Android.bp 0 → 100644 +40 −0 Original line number Diff line number Diff line //############################################# // Compile Robolectric shadows framework misapplied to androidx //############################################# package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "frameworks_base_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["frameworks_base_license"], } java_library { name: "Robolectric_shadows_androidx_fragment_upstream", srcs: [ "src/main/java/**/*.java", "src/main/java/**/*.kt", ], javacflags: [ "-Aorg.robolectric.annotation.processing.shadowPackage=org.robolectric.shadows.androidx.fragment", "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR", // Uncomment the below to debug annotation processors not firing. //"-verbose", //"-XprintRounds", //"-XprintProcessorInfo", //"-Xlint", //"-J-verbose", ], libs: [ "Robolectric_all-target_upstream", "androidx.fragment_fragment", ], plugins: [ "auto_value_plugin_1.9", "auto_value_builder_plugin_1.9", "Robolectric_processor_upstream", ], } packages/SettingsLib/tests/robotests/fragment/BUILD 0 → 100644 +69 −0 Original line number Diff line number Diff line load("//third_party/java/android/android_sdk_linux/extras/android/compatibility/jetify:jetify.bzl", "jetify_android_library", "jetify_android_local_test") package( default_applicable_licenses = ["//third_party/java_src/robolectric:license"], default_visibility = ["//third_party/java_src/robolectric:__subpackages__"], ) licenses(["notice"]) #============================================================================== # Test resources library #============================================================================== jetify_android_library( name = "test_resources", custom_package = "org.robolectric.shadows.androidx.fragment", manifest = "src/test/AndroidManifest.xml", resource_files = glob( ["src/test/resources/**/*"], ), ) #============================================================================== # AndroidX fragment module library #============================================================================== jetify_android_library( name = "androidx_fragment", testonly = 1, srcs = glob( ["src/main/java/**"], ), custom_package = "org.robolectric.shadows.androidx.fragment", javacopts = [ "-Aorg.robolectric.annotation.processing.shadowPackage=org.robolectric.shadows.androidx.fragment", ], jetify_sources = True, plugins = [ "//java/com/google/thirdparty/robolectric/processor", ], deps = [ "//third_party/java/androidx/core", "//third_party/java/androidx/fragment", "//third_party/java/androidx/lifecycle", "//third_party/java_src/robolectric/shadowapi", "//third_party/java_src/robolectric/shadows/framework", ], ) [ jetify_android_local_test( name = "test_" + src.rstrip(".java"), size = "small", srcs = glob( ["src/test/java/**/*.java"], ), jetify_sources = True, deps = [ ":androidx_fragment", ":test_resources", "//third_party/java/androidx/fragment", "//third_party/java/androidx/loader", "//third_party/java/mockito", "//third_party/java/robolectric", "//third_party/java/truth", ], ) for src in glob( ["src/test/java/**/*Test.java"], ) ] packages/SettingsLib/tests/robotests/fragment/build.gradle 0 → 100644 +48 −0 Original line number Diff line number Diff line plugins { id "net.ltgt.errorprone" version "0.0.13" } apply plugin: 'com.android.library' android { compileSdkVersion 28 android { sourceSets { main { res.srcDirs = ['src/test/resources/res'] } } testOptions { unitTests { includeAndroidResources = true } } } } dependencies { // Project dependencies compileOnly project(":robolectric") // Compile dependencies compileOnly AndroidSdk.MAX_SDK.coordinates compileOnly "androidx.core:core:1.0.0-rc02" compileOnly 'androidx.fragment:fragment:1.0.0-rc02' compileOnly "androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01" compileOnly "androidx.lifecycle:lifecycle-common:2.0.0-beta01" // Testing dependencies testImplementation "com.google.truth:truth:0.44" testImplementation "org.mockito:mockito-core:2.5.4" testImplementation "androidx.arch.core:core-common:2.0.0-beta01" testImplementation "androidx.arch.core:core-runtime:2.0.0-rc01" testImplementation "androidx.collection:collection:1.0.0-rc01" testImplementation "androidx.core:core:1.0.0-rc02" testImplementation 'androidx.fragment:fragment:1.0.0-rc02' testImplementation "androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01" testImplementation "androidx.lifecycle:lifecycle-common:2.0.0-beta01" testImplementation "androidx.lifecycle:lifecycle-runtime:2.0.0-rc01" testImplementation "androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01" testImplementation "androidx.loader:loader:1.0.0-rc02" } Loading
packages/SettingsLib/tests/robotests/Android.bp +33 −2 Original line number Diff line number Diff line Loading @@ -42,7 +42,10 @@ android_robolectric_test { name: "SettingsLibRoboTests", srcs: ["src/**/*.java"], static_libs: [ "Settings_robolectric_meta_service_file", "Robolectric_shadows_androidx_fragment_upstream", "SettingsLib-robo-testutils", "androidx.fragment_fragment", "androidx.test.core", "androidx.core_core", "testng", // TODO: remove once JUnit on Android provides assertThrows Loading @@ -53,6 +56,20 @@ android_robolectric_test { test_options: { timeout: 36000, }, upstream: true, } java_genrule { name: "Settings_robolectric_meta_service_file", out: ["robolectric_meta_service_file.jar"], tools: ["soong_zip"], cmd: "mkdir -p $(genDir)/META-INF/services/ && touch $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider &&" + "echo -e 'org.robolectric.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'org.robolectric.shadows.multidex.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'org.robolectric.shadows.httpclient.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + //"echo -e 'com.android.settings.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "echo -e 'com.android.settingslib.testutils.shadow.Shadows' >> $(genDir)/META-INF/services/org.robolectric.internal.ShadowProvider && " + "$(location soong_zip) -o $(out) -C $(genDir) -D $(genDir)/META-INF/services/", } java_library { Loading @@ -60,9 +77,23 @@ java_library { srcs: [ "testutils/com/android/settingslib/testutils/**/*.java", ], javacflags: [ "-Aorg.robolectric.annotation.processing.shadowPackage=com.android.settingslib.testutils.shadow", "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR", // Uncomment the below to debug annotation processors not firing. //"-verbose", //"-XprintRounds", //"-XprintProcessorInfo", //"-Xlint", //"-J-verbose", ], plugins: [ "auto_value_plugin_1.9", "auto_value_builder_plugin_1.9", "Robolectric_processor_upstream", ], libs: [ "Robolectric_all-target", "Robolectric_all-target_upstream", "mockito-robolectric-prebuilt", "truth-prebuilt", ], Loading
packages/SettingsLib/tests/robotests/config/robolectric.properties +1 −0 Original line number Diff line number Diff line sdk=NEWEST_SDK instrumentedPackages=androidx.preference
packages/SettingsLib/tests/robotests/fragment/Android.bp 0 → 100644 +40 −0 Original line number Diff line number Diff line //############################################# // Compile Robolectric shadows framework misapplied to androidx //############################################# package { // See: http://go/android-license-faq // A large-scale-change added 'default_applicable_licenses' to import // all of the 'license_kinds' from "frameworks_base_license" // to get the below license kinds: // SPDX-license-identifier-Apache-2.0 default_applicable_licenses: ["frameworks_base_license"], } java_library { name: "Robolectric_shadows_androidx_fragment_upstream", srcs: [ "src/main/java/**/*.java", "src/main/java/**/*.kt", ], javacflags: [ "-Aorg.robolectric.annotation.processing.shadowPackage=org.robolectric.shadows.androidx.fragment", "-Aorg.robolectric.annotation.processing.sdkCheckMode=ERROR", // Uncomment the below to debug annotation processors not firing. //"-verbose", //"-XprintRounds", //"-XprintProcessorInfo", //"-Xlint", //"-J-verbose", ], libs: [ "Robolectric_all-target_upstream", "androidx.fragment_fragment", ], plugins: [ "auto_value_plugin_1.9", "auto_value_builder_plugin_1.9", "Robolectric_processor_upstream", ], }
packages/SettingsLib/tests/robotests/fragment/BUILD 0 → 100644 +69 −0 Original line number Diff line number Diff line load("//third_party/java/android/android_sdk_linux/extras/android/compatibility/jetify:jetify.bzl", "jetify_android_library", "jetify_android_local_test") package( default_applicable_licenses = ["//third_party/java_src/robolectric:license"], default_visibility = ["//third_party/java_src/robolectric:__subpackages__"], ) licenses(["notice"]) #============================================================================== # Test resources library #============================================================================== jetify_android_library( name = "test_resources", custom_package = "org.robolectric.shadows.androidx.fragment", manifest = "src/test/AndroidManifest.xml", resource_files = glob( ["src/test/resources/**/*"], ), ) #============================================================================== # AndroidX fragment module library #============================================================================== jetify_android_library( name = "androidx_fragment", testonly = 1, srcs = glob( ["src/main/java/**"], ), custom_package = "org.robolectric.shadows.androidx.fragment", javacopts = [ "-Aorg.robolectric.annotation.processing.shadowPackage=org.robolectric.shadows.androidx.fragment", ], jetify_sources = True, plugins = [ "//java/com/google/thirdparty/robolectric/processor", ], deps = [ "//third_party/java/androidx/core", "//third_party/java/androidx/fragment", "//third_party/java/androidx/lifecycle", "//third_party/java_src/robolectric/shadowapi", "//third_party/java_src/robolectric/shadows/framework", ], ) [ jetify_android_local_test( name = "test_" + src.rstrip(".java"), size = "small", srcs = glob( ["src/test/java/**/*.java"], ), jetify_sources = True, deps = [ ":androidx_fragment", ":test_resources", "//third_party/java/androidx/fragment", "//third_party/java/androidx/loader", "//third_party/java/mockito", "//third_party/java/robolectric", "//third_party/java/truth", ], ) for src in glob( ["src/test/java/**/*Test.java"], ) ]
packages/SettingsLib/tests/robotests/fragment/build.gradle 0 → 100644 +48 −0 Original line number Diff line number Diff line plugins { id "net.ltgt.errorprone" version "0.0.13" } apply plugin: 'com.android.library' android { compileSdkVersion 28 android { sourceSets { main { res.srcDirs = ['src/test/resources/res'] } } testOptions { unitTests { includeAndroidResources = true } } } } dependencies { // Project dependencies compileOnly project(":robolectric") // Compile dependencies compileOnly AndroidSdk.MAX_SDK.coordinates compileOnly "androidx.core:core:1.0.0-rc02" compileOnly 'androidx.fragment:fragment:1.0.0-rc02' compileOnly "androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01" compileOnly "androidx.lifecycle:lifecycle-common:2.0.0-beta01" // Testing dependencies testImplementation "com.google.truth:truth:0.44" testImplementation "org.mockito:mockito-core:2.5.4" testImplementation "androidx.arch.core:core-common:2.0.0-beta01" testImplementation "androidx.arch.core:core-runtime:2.0.0-rc01" testImplementation "androidx.collection:collection:1.0.0-rc01" testImplementation "androidx.core:core:1.0.0-rc02" testImplementation 'androidx.fragment:fragment:1.0.0-rc02' testImplementation "androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01" testImplementation "androidx.lifecycle:lifecycle-common:2.0.0-beta01" testImplementation "androidx.lifecycle:lifecycle-runtime:2.0.0-rc01" testImplementation "androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01" testImplementation "androidx.loader:loader:1.0.0-rc02" }