Merge "[Wi-Fi] Refine code for saved AccessPoints"
This commit is contained in:
committed by
Android (Google) Code Review
commit
fd747e663c
@@ -98,7 +98,7 @@ public class SavedAccessPointsPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowAccessPoint.class)
|
||||
public void refreshSavedAccessPoints_shouldListNonSubscribedAPs() {
|
||||
public void displayPreference_oneAccessPoint_shouldListNonSubscribedAPs() {
|
||||
final WifiConfiguration config = new WifiConfiguration();
|
||||
config.SSID = "SSID";
|
||||
config.BSSID = "BSSID";
|
||||
@@ -117,7 +117,7 @@ public class SavedAccessPointsPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowAccessPoint.class)
|
||||
public void refreshSavedAccessPoints_shouldNotListSubscribedAPs() {
|
||||
public void displayPreference_onePasspoint_shouldNotListSubscribedAPs() {
|
||||
mWifiManager.addOrUpdatePasspointConfiguration(
|
||||
SubscribedAccessPointsPreferenceControllerTest.createMockPasspointConfiguration());
|
||||
|
||||
|
@@ -16,9 +16,6 @@
|
||||
|
||||
package com.android.settings.wifi.savedaccesspoints;
|
||||
|
||||
import static com.android.settings.core.BasePreferenceController.AVAILABLE;
|
||||
import static com.android.settings.core.BasePreferenceController.CONDITIONALLY_UNAVAILABLE;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -32,7 +29,6 @@ import android.net.wifi.WifiConfiguration;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.net.wifi.hotspot2.PasspointConfiguration;
|
||||
import android.net.wifi.hotspot2.pps.HomeSp;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.PreferenceCategory;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -42,9 +38,6 @@ import com.android.settings.testutils.shadow.ShadowWifiManager;
|
||||
import com.android.settingslib.wifi.AccessPoint;
|
||||
import com.android.settingslib.wifi.AccessPointPreference;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -83,24 +76,9 @@ public class SubscribedAccessPointsPreferenceControllerTest {
|
||||
when(mPreferenceCategory.getContext()).thenReturn(mContext);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailability_noSavedAccessPoint_shouldNotAvailable() {
|
||||
mController.mAccessPoints = new ArrayList<>();
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(CONDITIONALLY_UNAVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getAvailability_oneSavedAccessPoint_shouldAvailable() {
|
||||
final AccessPoint accessPoint = new AccessPoint(mContext, new Bundle() /* savedState */);
|
||||
mController.mAccessPoints = new ArrayList<AccessPoint>(Arrays.asList(accessPoint));
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowAccessPoint.class)
|
||||
public void refreshSubscribedAccessPoints_shouldNotListNonSubscribedAPs() {
|
||||
public void displayPreference_oneAccessPoint_shouldNotListNonSubscribedAPs() {
|
||||
final WifiConfiguration config = new WifiConfiguration();
|
||||
config.SSID = "SSID";
|
||||
config.BSSID = "BSSID";
|
||||
@@ -114,7 +92,7 @@ public class SubscribedAccessPointsPreferenceControllerTest {
|
||||
|
||||
@Test
|
||||
@Config(shadows = ShadowAccessPoint.class)
|
||||
public void refreshSubscribedAccessPoints_shouldListSubscribedAPs() {
|
||||
public void displayPreference_onePasspoint_shouldListSubscribedAPs() {
|
||||
mWifiManager.addOrUpdatePasspointConfiguration(createMockPasspointConfiguration());
|
||||
|
||||
mController.displayPreference(mPreferenceScreen);
|
||||
|
Reference in New Issue
Block a user