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

@@ -17,15 +17,12 @@
package com.android.settings.notification;
import static android.app.NotificationManager.IMPORTANCE_NONE;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.app.Activity;
@@ -37,7 +34,6 @@ import android.os.UserManager;
import android.support.v14.preference.PreferenceFragment;
import android.view.View;
import com.android.settings.TestConfig;
import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.wrapper.NotificationChannelGroupWrapper;
@@ -47,11 +43,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class HeaderPreferenceControllerTest {
private Context mContext;
@@ -83,19 +77,19 @@ public class HeaderPreferenceControllerTest {
}
@Test
public void testNoCrashIfNoOnResume() throws Exception {
public void testNoCrashIfNoOnResume() {
mController.isAvailable();
mController.updateState(mock(LayoutPreference.class));
}
@Test
public void testIsAvailable_notIfNull() throws Exception {
public void testIsAvailable_notIfNull() {
mController.onResume(null, null, null, null);
assertFalse(mController.isAvailable());
}
@Test
public void testIsAvailable() throws Exception {
public void testIsAvailable() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.banned = true;
mController.onResume(appRow, null, null, null);
@@ -103,7 +97,7 @@ public class HeaderPreferenceControllerTest {
}
@Test
public void testGetLabel() throws Exception {
public void testGetLabel() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.label = "bananas";
mController.onResume(appRow, null, null, null);
@@ -120,7 +114,7 @@ public class HeaderPreferenceControllerTest {
}
@Test
public void testGetSummary() throws Exception {
public void testGetSummary() {
NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
appRow.label = "bananas";
mController.onResume(appRow, null, null, null);