Use external/robolectric-shadows/run_robotests.mk

This allows Settings to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Bug: 73173204
Bug: 73892008
Test: make -j56 RunSettingsRoboTests
Change-Id: I3135b4fa5f095ba79b282a76f45dd9baa2584bc7
This commit is contained in:
James Lemieux
2018-02-26 00:51:42 -08:00
parent 229a6a2bc4
commit 22a39c2b93
752 changed files with 5096 additions and 9182 deletions

View File

@@ -18,9 +18,7 @@
package com.android.settings.fuelgauge;
import static android.arch.lifecycle.Lifecycle.Event.ON_START;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.eq;
@@ -40,7 +38,6 @@ import android.support.v7.widget.RecyclerView;
import android.widget.TextView;
import com.android.settings.R;
import com.android.settings.TestConfig;
import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
@@ -59,15 +56,14 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
sdk = TestConfig.SDK_VERSION,
shadows = {
@Config(shadows = {
SettingsShadowResources.class,
SettingsShadowResourcesImpl.class,
SettingsShadowResources.SettingsShadowTheme.class,
ShadowEntityHeaderController.class
})
public class BatteryHeaderPreferenceControllerTest {
private static final int BATTERY_LEVEL = 60;
private static final String TIME_LEFT = "2h30min";
private static final String BATTERY_STATUS = "Charging";
@@ -113,8 +109,8 @@ public class BatteryHeaderPreferenceControllerTest {
doReturn(mBatteryIntent).when(mContext).registerReceiver(any(), any());
mBatteryLayoutPref = new LayoutPreference(mContext, R.layout.battery_header);
doReturn(mBatteryLayoutPref).when(mPreferenceScreen).findPreference(
BatteryHeaderPreferenceController.KEY_BATTERY_HEADER);
doReturn(mBatteryLayoutPref).when(mPreferenceScreen)
.findPreference(BatteryHeaderPreferenceController.KEY_BATTERY_HEADER);
mBatteryInfo.batteryLevel = BATTERY_LEVEL;
@@ -137,8 +133,8 @@ public class BatteryHeaderPreferenceControllerTest {
assertThat(((BatteryMeterView) mBatteryLayoutPref.findViewById(
R.id.battery_header_icon)).getBatteryLevel()).isEqualTo(BATTERY_LEVEL);
assertThat(((TextView) mBatteryLayoutPref.findViewById(
R.id.battery_percent)).getText()).isEqualTo("60%");
assertThat(((TextView) mBatteryLayoutPref.findViewById(R.id.battery_percent)).getText())
.isEqualTo("60%");
}
@Test