Fix robotests.
Couldn't find config_headlineFontFamily. Added some SettingsShadowResources.overrideResource calls. Change-Id: I13f5b5dd6b97057e7f77cc4d15abdb6451314b50 Fixes: 64024743 Test: robotests
This commit is contained in:
@@ -29,6 +29,7 @@ import com.android.settings.TestConfig;
|
|||||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settings.widget.DonutView;
|
import com.android.settings.widget.DonutView;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -56,6 +57,8 @@ public final class DataPlanSummaryPreferenceTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
SettingsShadowResources.overrideResource(
|
||||||
|
com.android.internal.R.string.config_headlineFontFamily, "");
|
||||||
Context context = RuntimeEnvironment.application;
|
Context context = RuntimeEnvironment.application;
|
||||||
mPreference = new DataPlanSummaryPreference(context);
|
mPreference = new DataPlanSummaryPreference(context);
|
||||||
LayoutInflater inflater = LayoutInflater.from(context);
|
LayoutInflater inflater = LayoutInflater.from(context);
|
||||||
@@ -64,6 +67,11 @@ public final class DataPlanSummaryPreferenceTest {
|
|||||||
mHolder = PreferenceViewHolder.createInstanceForTests(view);
|
mHolder = PreferenceViewHolder.createInstanceForTests(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SettingsShadowResources.reset();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void shouldRender_withoutData() {
|
public void shouldRender_withoutData() {
|
||||||
mPreference.onBindViewHolder(mHolder);
|
mPreference.onBindViewHolder(mHolder);
|
||||||
|
@@ -42,6 +42,7 @@ import com.android.settings.testutils.FakeFeatureFactory;
|
|||||||
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
import com.android.settings.testutils.shadow.SettingsShadowResources;
|
||||||
import com.android.settingslib.deviceinfo.StorageVolumeProvider;
|
import com.android.settingslib.deviceinfo.StorageVolumeProvider;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -70,6 +71,8 @@ public class StorageSummaryDonutPreferenceControllerTest {
|
|||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
SettingsShadowResources.overrideResource(
|
||||||
|
com.android.internal.R.string.config_headlineFontFamily, "");
|
||||||
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
|
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
|
||||||
FakeFeatureFactory.setupForTest(mContext);
|
FakeFeatureFactory.setupForTest(mContext);
|
||||||
mFakeFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
mFakeFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mContext);
|
||||||
@@ -84,6 +87,11 @@ public class StorageSummaryDonutPreferenceControllerTest {
|
|||||||
mHolder = PreferenceViewHolder.createInstanceForTests(view);
|
mHolder = PreferenceViewHolder.createInstanceForTests(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SettingsShadowResources.reset();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmpty() throws Exception {
|
public void testEmpty() throws Exception {
|
||||||
mController.updateBytes(0, 32 * GIGABYTE);
|
mController.updateBytes(0, 32 * GIGABYTE);
|
||||||
|
@@ -38,6 +38,8 @@ import com.android.settings.testutils.shadow.ShadowDynamicIndexableContentMonito
|
|||||||
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
|
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
|
||||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.robolectric.Robolectric;
|
import org.robolectric.Robolectric;
|
||||||
@@ -66,6 +68,17 @@ import java.util.List;
|
|||||||
})
|
})
|
||||||
public class SetupChooseLockPasswordTest {
|
public class SetupChooseLockPasswordTest {
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
SettingsShadowResources.overrideResource(
|
||||||
|
com.android.internal.R.string.config_headlineFontFamily, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
SettingsShadowResources.reset();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void createActivity_shouldNotCrash() {
|
public void createActivity_shouldNotCrash() {
|
||||||
// Basic sanity test for activity created without crashing
|
// Basic sanity test for activity created without crashing
|
||||||
|
Reference in New Issue
Block a user