use of android.net.wifi.p2p.WifiP2pDeviceList in project android_packages_apps_Settings by omnirom.
the class WifiP2pSettingsTest method peersCategoryController_withOnePeerDevice_shouldBeAvailable.
@Test
public void peersCategoryController_withOnePeerDevice_shouldBeAvailable() {
final WifiP2pDevice wifiP2pDevice = mock(WifiP2pDevice.class);
final ArrayList<WifiP2pDevice> deviceList = new ArrayList<>();
deviceList.add(wifiP2pDevice);
final WifiP2pDeviceList peers = mock(WifiP2pDeviceList.class);
doReturn(deviceList).when(peers).getDeviceList();
mFragment.onPeersAvailable(peers);
assertThat(mFragment.mPeerCategoryController.isAvailable()).isTrue();
}
use of android.net.wifi.p2p.WifiP2pDeviceList in project android_packages_apps_Settings by omnirom.
the class WifiP2pSettingsTest method peersCategoryController_withNoPeerDevice_shouldBeUnavailable.
@Test
public void peersCategoryController_withNoPeerDevice_shouldBeUnavailable() {
final ArrayList<WifiP2pDevice> deviceList = new ArrayList<>();
final WifiP2pDeviceList peers = mock(WifiP2pDeviceList.class);
doReturn(deviceList).when(peers).getDeviceList();
mFragment.onPeersAvailable(peers);
assertThat(mFragment.mPeerCategoryController.isAvailable()).isFalse();
}
use of android.net.wifi.p2p.WifiP2pDeviceList in project android_packages_apps_Settings by omnirom.
the class WifiP2pSettingsTest method withEmptyP2pDeviceList_getP2pPeerChangeIntent_connectedDevicesShouldBeZero.
@Test
public void withEmptyP2pDeviceList_getP2pPeerChangeIntent_connectedDevicesShouldBeZero() {
final WifiP2pDeviceList peers = new WifiP2pDeviceList();
final Bundle bundle = new Bundle();
final Intent intent = new Intent(WifiP2pManager.WIFI_P2P_PEERS_CHANGED_ACTION);
bundle.putParcelable(WifiP2pManager.EXTRA_P2P_DEVICE_LIST, peers);
intent.putExtras(bundle);
mFragment.mReceiver.onReceive(mContext, intent);
assertThat(mFragment.mConnectedDevices).isEqualTo(0);
}
Aggregations