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:
@@ -15,11 +15,8 @@
|
||||
*/
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
|
||||
import static com.android.settings.deviceinfo.DeviceModelPreferenceController.getDeviceModel;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -31,7 +28,6 @@ import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -44,7 +40,6 @@ import org.robolectric.RuntimeEnvironment;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
public class DeviceModelPreferenceControllerTest {
|
||||
|
||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||
@@ -54,7 +49,6 @@ public class DeviceModelPreferenceControllerTest {
|
||||
@Mock
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
|
||||
|
||||
private Context mContext;
|
||||
private DeviceModelPreferenceController mController;
|
||||
|
||||
@@ -64,7 +58,7 @@ public class DeviceModelPreferenceControllerTest {
|
||||
mContext = RuntimeEnvironment.application;
|
||||
mController = new DeviceModelPreferenceController(mContext, mFragment);
|
||||
when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
|
||||
.thenReturn(mPreference);
|
||||
.thenReturn(mPreference);
|
||||
when(mPreference.getKey()).thenReturn(mController.getPreferenceKey());
|
||||
}
|
||||
|
||||
@@ -83,14 +77,12 @@ public class DeviceModelPreferenceControllerTest {
|
||||
public void displayPref_shouldSetSummary() {
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
||||
verify(mPreference).setSummary(mContext.getResources().getString(R.string.model_summary,
|
||||
getDeviceModel()));
|
||||
verify(mPreference).setSummary(mContext.getString(R.string.model_summary, getDeviceModel()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clickPreference_shouldLaunchHardwareInfoDialog() {
|
||||
assertThat(mController.handlePreferenceTreeClick(mPreference))
|
||||
.isTrue();
|
||||
assertThat(mController.handlePreferenceTreeClick(mPreference)).isTrue();
|
||||
verify(mFragment).getFragmentManager();
|
||||
verify(mFragment.getFragmentManager().beginTransaction())
|
||||
.add(any(HardwareInfoDialogFragment.class), eq(HardwareInfoDialogFragment.TAG));
|
||||
|
||||
Reference in New Issue
Block a user