Search in sources :

Example 1 with WifiP2pGroupList

use of android.net.wifi.p2p.WifiP2pGroupList in project android_packages_apps_Settings by omnirom.

the class WifiP2pSettingsTest method persistentController_withOneGroup_shouldBeAvailable.

@Test
public void persistentController_withOneGroup_shouldBeAvailable() {
    final String fakeGroupName = new String("fakeGroupName");
    doReturn(fakeGroupName).when(mWifiP2pGroup).getNetworkName();
    final List<WifiP2pGroup> groupList = new ArrayList<>();
    groupList.add(mWifiP2pGroup);
    final WifiP2pGroupList wifiP2pGroupList = mock(WifiP2pGroupList.class);
    doReturn(groupList).when(wifiP2pGroupList).getGroupList();
    final Bundle bundle = new Bundle();
    bundle.putString(WifiP2pSettings.SAVE_SELECTED_GROUP, fakeGroupName);
    mFragment.onActivityCreated(bundle);
    mFragment.onPersistentGroupInfoAvailable(wifiP2pGroupList);
    assertThat(mFragment.mPersistentCategoryController.isAvailable()).isTrue();
}
Also used : WifiP2pGroupList(android.net.wifi.p2p.WifiP2pGroupList) WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup) Bundle(android.os.Bundle) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with WifiP2pGroupList

use of android.net.wifi.p2p.WifiP2pGroupList in project android_packages_apps_Settings by omnirom.

the class WifiP2pSettingsTest method persistentController_withNoGroup_shouldBeUnavailable.

@Test
public void persistentController_withNoGroup_shouldBeUnavailable() {
    final WifiP2pGroupList wifiP2pGroupList = mock(WifiP2pGroupList.class);
    final List<WifiP2pGroup> groupList = new ArrayList<>();
    doReturn(groupList).when(wifiP2pGroupList).getGroupList();
    mFragment.onPersistentGroupInfoAvailable(wifiP2pGroupList);
    assertThat(mFragment.mPersistentCategoryController.isAvailable()).isFalse();
}
Also used : WifiP2pGroupList(android.net.wifi.p2p.WifiP2pGroupList) WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

WifiP2pGroup (android.net.wifi.p2p.WifiP2pGroup)2 WifiP2pGroupList (android.net.wifi.p2p.WifiP2pGroupList)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Bundle (android.os.Bundle)1