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:
@@ -16,6 +16,9 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -24,21 +27,16 @@ import android.os.Vibrator;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.settings.TestConfig;
|
||||
|
||||
import org.junit.Before;
|
||||
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.RuntimeEnvironment;
|
||||
import org.robolectric.shadows.ShadowApplication;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class RingVolumePreferenceControllerTest {
|
||||
|
||||
@Mock
|
||||
@@ -65,7 +63,7 @@ public class RingVolumePreferenceControllerTest {
|
||||
shadowContext.setSystemService(Context.AUDIO_SERVICE, mAudioManager);
|
||||
shadowContext.setSystemService(Context.VIBRATOR_SERVICE, mVibrator);
|
||||
shadowContext.setSystemService(Context.NOTIFICATION_SERVICE, mNotificationManager);
|
||||
mContext = shadowContext.getApplicationContext();
|
||||
mContext = RuntimeEnvironment.application;
|
||||
when(mNotificationManager.getEffectsSuppressor()).thenReturn(mSuppressor);
|
||||
mController = new RingVolumePreferenceController(mContext, null, null, mHelper);
|
||||
}
|
||||
@@ -98,5 +96,4 @@ public class RingVolumePreferenceControllerTest {
|
||||
public void getAudioStream_shouldReturnRing() {
|
||||
assertThat(mController.getAudioStream()).isEqualTo(AudioManager.STREAM_RING);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user