Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec3ad9eb authored by James Lemieux's avatar James Lemieux
Browse files

Use binary resource support in robolectric

The resources available to tests are now exactly the merged resources
located in the APK under test.

Bug: 74359828
Test: make -j56 RunSettingsLibRoboTests
Change-Id: I7d0bf6c67377d4e15104f6d1f9ff40bce83df878
parent cce6c22e
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -32,12 +32,13 @@ include frameworks/base/packages/SettingsLib/common.mk

include $(BUILD_PACKAGE)

#############################################
############################################################
# SettingsLib Robolectric test target.                     #
#############################################
############################################################
include $(CLEAR_VARS)

LOCAL_MODULE := SettingsLibRoboTests
LOCAL_MODULE_CLASS := JAVA_LIBRARIES

LOCAL_SRC_FILES := $(call all-java-files-under, src)

@@ -53,6 +54,9 @@ LOCAL_INSTRUMENTATION_FOR := SettingsLibShell

LOCAL_MODULE_TAGS := optional

# Generate test_config.properties
include external/robolectric-shadows/gen_test_config.mk

include $(BUILD_STATIC_JAVA_LIBRARY)

#############################################################
+0 −4
Original line number Diff line number Diff line
manifest=frameworks/base/packages/SettingsLib/tests/robotests/AndroidManifest.xml
sdk=NEWEST_SDK

shadows=\
   com.android.settingslib.testutils.shadow.ShadowXmlUtils
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -30,10 +30,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.util.ReflectionHelpers;

@RunWith(SettingsLibRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class CustomEditTextPreferenceComaptTest {

    @Mock
@@ -70,7 +71,7 @@ public class CustomEditTextPreferenceComaptTest {
    }

    private static class TestPreference extends CustomEditTextPreferenceCompat {
        public TestPreference(Context context) {
        private TestPreference(Context context) {
            super(context);
        }
    }
+3 −2
Original line number Diff line number Diff line
@@ -30,10 +30,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.util.ReflectionHelpers;

@RunWith(SettingsLibRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class CustomEditTextPreferenceTest {

    @Mock
@@ -70,7 +71,7 @@ public class CustomEditTextPreferenceTest {
    }

    private static class TestPreference extends CustomEditTextPreference {
        public TestPreference(Context context) {
        private TestPreference(Context context) {
            super(context);
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -24,9 +24,10 @@ import android.system.StructUtsname;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;

@RunWith(SettingsLibRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class DeviceInfoUtilsTest {

    private Context mContext;
Loading