Search in sources :

Example 6 with TestAccessPointBuilder

use of com.android.settingslib.wifi.TestAccessPointBuilder in project platform_packages_apps_Settings by BlissRoms.

the class WifiSettingsUiTest method changingSecurityStateOnApShouldNotCauseMultipleListItems.

@Test
public void changingSecurityStateOnApShouldNotCauseMultipleListItems() {
    setWifiState(WifiManager.WIFI_STATE_ENABLED);
    TestAccessPointBuilder builder = new TestAccessPointBuilder(mContext).setSsid(TEST_SSID).setSecurity(AccessPoint.SECURITY_NONE).setRssi(TEST_RSSI);
    AccessPoint open = builder.build();
    builder.setSecurity(AccessPoint.SECURITY_EAP);
    AccessPoint eap = builder.build();
    builder.setSecurity(AccessPoint.SECURITY_WEP);
    AccessPoint wep = builder.build();
    // Return a different security state each time getAccessPoints is invoked
    when(mWifiTracker.getAccessPoints()).thenReturn(Lists.newArrayList(open)).thenReturn(Lists.newArrayList(eap)).thenReturn(Lists.newArrayList(wep));
    launchActivity();
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
    mWifiListener.onAccessPointsChanged();
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
    mWifiListener.onAccessPointsChanged();
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
}
Also used : AccessPoint(com.android.settingslib.wifi.AccessPoint) TestAccessPointBuilder(com.android.settingslib.wifi.TestAccessPointBuilder) Test(org.junit.Test)

Example 7 with TestAccessPointBuilder

use of com.android.settingslib.wifi.TestAccessPointBuilder in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiSettingsUiTest method changingSecurityStateOnApShouldNotCauseMultipleListItems.

@Test
public void changingSecurityStateOnApShouldNotCauseMultipleListItems() {
    setWifiState(WifiManager.WIFI_STATE_ENABLED);
    TestAccessPointBuilder builder = new TestAccessPointBuilder(mContext).setSsid(TEST_SSID).setSecurity(AccessPoint.SECURITY_NONE).setRssi(TEST_RSSI);
    AccessPoint open = builder.build();
    builder.setSecurity(AccessPoint.SECURITY_EAP);
    AccessPoint eap = builder.build();
    builder.setSecurity(AccessPoint.SECURITY_WEP);
    AccessPoint wep = builder.build();
    // Return a different security state each time getAccessPoints is invoked
    when(mWifiTracker.getAccessPoints()).thenReturn(Lists.newArrayList(open)).thenReturn(Lists.newArrayList(eap)).thenReturn(Lists.newArrayList(wep));
    launchActivity();
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
    ThreadUtils.postOnMainThread(() -> mWifiListener.onAccessPointsChanged());
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
    ThreadUtils.postOnMainThread(() -> mWifiListener.onAccessPointsChanged());
    onView(withText(TEST_SSID)).check(matches(isDisplayed()));
}
Also used : AccessPoint(com.android.settingslib.wifi.AccessPoint) TestAccessPointBuilder(com.android.settingslib.wifi.TestAccessPointBuilder) Test(org.junit.Test)

Aggregations

AccessPoint (com.android.settingslib.wifi.AccessPoint)7 TestAccessPointBuilder (com.android.settingslib.wifi.TestAccessPointBuilder)7 Test (org.junit.Test)7