Make Settings robotest work with tot Robolectric

Bug: 116278591
Test: make -j RunSettingsRoboTests
Change-Id: I32cb2fcf6094675f79d2fc24702ef6298a9691e4
This commit is contained in:
Fan Zhang
2018-10-11 15:37:36 -07:00
parent dd3feeb155
commit cdf284b732
140 changed files with 706 additions and 823 deletions

View File

@@ -44,6 +44,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
@@ -67,7 +68,7 @@ public class DeviceNamePreferenceControllerTest {
MockitoAnnotations.initMocks(this);
ShadowApplication shadowApplication = ShadowApplication.getInstance();
shadowApplication.setSystemService(Context.WIFI_SERVICE, mWifiManager);
mContext = shadowApplication.getApplicationContext();
mContext = RuntimeEnvironment.application;
mPreference = new ValidatedEditTextPreference(mContext);
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
final WifiConfiguration configuration = new WifiConfiguration();