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 RunSettingsRoboTests
Change-Id: I050db81a92decefea23314b5ec7a62f77ff4bb2b
This commit is contained in:
James Lemieux
2018-12-07 12:56:49 -08:00
committed by Fan Zhang
parent 1f5fab1480
commit f1dade40d2
1005 changed files with 3187 additions and 5478 deletions

View File

@@ -33,7 +33,6 @@ import androidx.preference.ListPreference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.After;
@@ -42,13 +41,14 @@ 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.annotation.Config;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
import org.robolectric.annotation.Resetter;
@RunWith(SettingsRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class AutofillLoggingLevelPreferenceControllerTest {
private static final int IDX_OFF = 0;
@@ -133,7 +133,7 @@ public class AutofillLoggingLevelPreferenceControllerTest {
}
@Test
public void onSettingsChange_off() throws Exception {
public void onSettingsChange_off() {
mHelper.setLoggingLevel(AutofillManager.NO_LOGGING);
mController.updateState(mPreference);
@@ -143,7 +143,7 @@ public class AutofillLoggingLevelPreferenceControllerTest {
}
@Test
public void onSettingsChange_debug() throws Exception {
public void onSettingsChange_debug() {
mHelper.setLoggingLevel(AutofillManager.FLAG_ADD_CLIENT_DEBUG);
mController.updateState(mPreference);
@@ -153,7 +153,7 @@ public class AutofillLoggingLevelPreferenceControllerTest {
}
@Test
public void onSettingsChange_verbose() throws Exception {
public void onSettingsChange_verbose() {
mHelper.setLoggingLevel(AutofillManager.FLAG_ADD_CLIENT_VERBOSE);
mController.updateState(mPreference);

View File

@@ -26,16 +26,15 @@ import android.view.autofill.AutofillManager;
import androidx.preference.PreferenceScreen;
import androidx.preference.SwitchPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
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;
@RunWith(SettingsRobolectricTestRunner.class)
@RunWith(RobolectricTestRunner.class)
public class AutofillResetOptionsPreferenceControllerTest {
@Mock
@@ -83,11 +82,9 @@ public class AutofillResetOptionsPreferenceControllerTest {
assertThat(mController.handlePreferenceTreeClick(mPreference)).isTrue();
assertThat(mHelper.getLoggingLevel())
.isEqualTo(AutofillManager.DEFAULT_LOGGING_LEVEL);
assertThat(mHelper.getLoggingLevel()).isEqualTo(AutofillManager.DEFAULT_LOGGING_LEVEL);
assertThat(mHelper.getMaxPartitionsSize())
.isEqualTo(AutofillManager.DEFAULT_MAX_PARTITIONS_SIZE);
assertThat(mHelper.getMaxVisibleDatasets())
.isEqualTo(0);
assertThat(mHelper.getMaxVisibleDatasets()).isEqualTo(0);
}
}