[Wi-Fi] WiFi Settings inclusive language fix plan phase 1

Replace WiFi related terms which contain Master wording.
Goal: Create a fixit for Android Platform to reduce the use of non-inclusive language for all code.

Bug: 161425297
Test: make RunSettingsRoboTests -j or
make RunSettingsRoboTests ROBOTEST_FILTER=DashboardFragmentTest
make RunSettingsRoboTests ROBOTEST_FILTER=WirelessDebuggingPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AutomaticStorageManagementSwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=AllInOneTetherPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=TopLevelNetworkEntryPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=PrimarySwitchPreferenceTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiPrimarySwitchPreferenceControllerTest
make RunSettingsRoboTests ROBOTEST_FILTER=WifiTetherPreferenceControllerTest

Change-Id: I9395c50e092e124016609f88f7c8151554a0d874
This commit is contained in:
govenliu
2020-07-16 17:09:03 +08:00
parent 670d37c44e
commit b70ddb9df7
29 changed files with 119 additions and 108 deletions

View File

@@ -38,7 +38,7 @@ import androidx.preference.PreferenceScreen;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.testutils.shadow.ShadowRestrictedLockUtilsInternal;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
import org.junit.Before;
@@ -52,21 +52,21 @@ import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
@Config(shadows = ShadowRestrictedLockUtilsInternal.class)
public class WifiMasterSwitchPreferenceControllerTest {
public class WifiPrimarySwitchPreferenceControllerTest {
@Mock
private WifiManager mWifiManager;
@Mock
private PreferenceScreen mScreen;
@Mock
private MasterSwitchPreference mPreference;
private PrimarySwitchPreference mPreference;
@Mock
private ConnectivityManager mConnectivityManager;
@Mock
private NetworkScoreManager mNetworkScoreManager;
private Context mContext;
private WifiMasterSwitchPreferenceController mController;
private WifiPrimarySwitchPreferenceController mController;
private MetricsFeatureProvider mMetricsFeatureProvider;
@Before
@@ -76,20 +76,20 @@ public class WifiMasterSwitchPreferenceControllerTest {
mContext = spy(RuntimeEnvironment.application.getApplicationContext());
when(mContext.getSystemService(ConnectivityManager.class)).thenReturn(mConnectivityManager);
when(mContext.getSystemService(NetworkScoreManager.class)).thenReturn(mNetworkScoreManager);
mController = new WifiMasterSwitchPreferenceController(mContext, mMetricsFeatureProvider);
mController = new WifiPrimarySwitchPreferenceController(mContext, mMetricsFeatureProvider);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(mWifiManager.getWifiState()).thenReturn(WifiManager.WIFI_STATE_DISABLED);
}
@Test
public void testWifiMasterSwitch_byDefault_shouldBeShown() {
public void testWifiPrimarySwitch_byDefault_shouldBeShown() {
assertThat(mController.isAvailable()).isTrue();
}
@Test
@Config(qualifiers = "mcc999")
public void testWifiMasterSwitch_ifDisabled_shouldNotBeShown() {
public void testWifiPrimarySwitch_ifDisabled_shouldNotBeShown() {
assertThat(mController.isAvailable()).isFalse();
}

View File

@@ -31,7 +31,7 @@ import androidx.lifecycle.LifecycleOwner;
import androidx.preference.PreferenceScreen;
import com.android.settings.testutils.FakeFeatureFactory;
import com.android.settings.widget.MasterSwitchPreference;
import com.android.settings.widget.PrimarySwitchPreference;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
@@ -66,7 +66,7 @@ public class WifiTetherPreferenceControllerTest {
private WifiTetherPreferenceController mController;
private Lifecycle mLifecycle;
private LifecycleOwner mLifecycleOwner;
private MasterSwitchPreference mPreference;
private PrimarySwitchPreference mPreference;
@Before
public void setUp() {
@@ -76,7 +76,7 @@ public class WifiTetherPreferenceControllerTest {
mLifecycleOwner = () -> mLifecycle;
mLifecycle = new Lifecycle(mLifecycleOwner);
FakeFeatureFactory.setupForTest();
mPreference = new MasterSwitchPreference(RuntimeEnvironment.application);
mPreference = new PrimarySwitchPreference(RuntimeEnvironment.application);
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE))
.thenReturn(mConnectivityManager);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);