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

@@ -26,7 +26,6 @@ import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
import com.android.settings.testutils.shadow.SettingsShadowBluetoothDevice;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -36,34 +35,13 @@ import org.junit.runner.RunWith;
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
shadows=SettingsShadowBluetoothDevice.class)
@Config(shadows = SettingsShadowBluetoothDevice.class)
public class BluetoothDetailsControllerEventsTest extends BluetoothDetailsControllerTestBase {
static class TestController extends BluetoothDetailsController {
public TestController(Context context, PreferenceFragment fragment,
CachedBluetoothDevice device,
Lifecycle lifecycle) {
super(context, fragment, device, lifecycle);
}
@Override
public String getPreferenceKey() {
return null;
}
@Override
protected void init(PreferenceScreen screen) {}
@Override
protected void refresh() {}
}
@Test
public void pauseResumeEvents() {
TestController controller = spy(new TestController(mContext, mFragment, mCachedDevice,
mLifecycle));
TestController controller =
spy(new TestController(mContext, mFragment, mCachedDevice, mLifecycle));
verify(mLifecycle).addObserver(any(BluetoothDetailsController.class));
showScreen(controller);
@@ -81,4 +59,22 @@ public class BluetoothDetailsControllerEventsTest extends BluetoothDetailsContro
// The init function should only have been called once
verify(controller, times(1)).init(mScreen);
}
private static class TestController extends BluetoothDetailsController {
private TestController(Context context, PreferenceFragment fragment,
CachedBluetoothDevice device, Lifecycle lifecycle) {
super(context, fragment, device, lifecycle);
}
@Override
public String getPreferenceKey() {
return null;
}
@Override
protected void init(PreferenceScreen screen) {}
@Override
protected void refresh() {}
}
}