Fix WifiTetherSettingsTest failed

- Use the same service name(Context.USER_SERVICE) to mock
UserManager.class

Bug: 183922231
Test: manual test
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherSettingsTest

Change-Id: Ifa9f3affbb969425acea335732ce977f18f82b49
This commit is contained in:
Weng Su
2021-03-30 04:02:24 +08:00
parent fe042ac08e
commit 416bdecfa4

View File

@@ -83,7 +83,7 @@ public class WifiTetherSettingsTest {
.when(mContext).getSystemService(ConnectivityManager.class);
doReturn(mTetheringManager).when(mContext).getSystemService(TetheringManager.class);
doReturn(WIFI_REGEXS).when(mTetheringManager).getTetherableWifiRegexs();
doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
mWifiTetherSettings = new WifiTetherSettings();
}
@@ -133,7 +133,7 @@ public class WifiTetherSettingsTest {
when(settings.getContext()).thenReturn(mContext);
final Resources.Theme theme = mContext.getTheme();
when(activity.getTheme()).thenReturn(theme);
when(activity.getSystemService(UserManager.class)).thenReturn(mUserManager);
when(activity.getSystemService(Context.USER_SERVICE)).thenReturn(mUserManager);
doNothing().when(settings)
.onCreatePreferences(any(Bundle.class), nullable(String.class));
final FakeFeatureFactory fakeFeatureFactory = FakeFeatureFactory.setupForTest();