Files
app_Settings/tests/robotests/src/com/android/settings/wifi/ConfigureWifiSettingsTest.java
govenliu 228cf200ae [Wi-Fi] Wrong MAC address shown in Settings.
The MAC addresses in "About phone" and "Saved networks" may be different
because of new Randomized MAC mechanism.

1.Add new UIs to guide users to saved network and use different titles to
show different conditions.
2.Remove MAC address and IP fields in WifiPreference by new design.

Bug: 133466540
Test: add test case to check if the title changed according to the
privacy level.

Change-Id: Idb5972dc2565f6fe58a83f6aa7124abbc035888f
2019-10-03 19:36:58 +08:00

53 lines
1.6 KiB
Java

package com.android.settings.wifi;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.spy;
import android.content.Context;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import java.util.List;
@RunWith(RobolectricTestRunner.class)
public class ConfigureWifiSettingsTest {
private Context mContext;
@Before
public void setUp() {
mContext = spy(RuntimeEnvironment.application);
}
@Test
public void testNonIndexableKeys_existInXmlLayout() {
final List<String> niks =
ConfigureWifiSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
final int xmlId = new ConfigureWifiSettings().getPreferenceScreenResId();
final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(mContext, xmlId);
assertThat(keys).containsAllIn(niks);
}
@Test
@Config(qualifiers = "mcc999")
public void testNonIndexableKeys_ifPageDisabled_shouldNotIndexResource() {
final List<String> niks =
ConfigureWifiSettings.SEARCH_INDEX_DATA_PROVIDER.getNonIndexableKeys(mContext);
final int xmlId = new ConfigureWifiSettings().getPreferenceScreenResId();
final List<String> keys = XmlTestUtils.getKeysFromPreferenceXml(mContext, xmlId);
assertThat(keys).isNotNull();
assertThat(niks).containsAllIn(keys);
}
}