Methods Summary |
---|
private void | setCdma()
setIsGsm(false);
updateDataConnectionState(TelephonyManager.DATA_CONNECTED,
TelephonyManager.NETWORK_TYPE_CDMA);
setCdmaRoaming(false);
|
public void | testCdmaQsSignalStrength()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setCdma();
setLevel(testStrength);
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
TelephonyIcons.QS_ICON_1X, false, false);
}
|
public void | testCdmaSignalRoaming()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setCdma();
setCdmaRoaming(true);
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
TelephonyIcons.ROAMING_ICON);
}
|
public void | testCdmaSignalStrength()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setCdma();
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
TelephonyIcons.DATA_1X[1][0 /* No direction */]);
}
|
public void | testHasCorrectMobileControllers()
int[] testSubscriptions = new int[] { 1, 5, 3 };
int notTestSubscription = 0;
MobileSignalController mobileSignalController = Mockito.mock(MobileSignalController.class);
mNetworkController.mMobileSignalControllers.clear();
List<SubscriptionInfo> subscriptions = new ArrayList<>();
for (int i = 0; i < testSubscriptions.length; i++) {
// Force the test controllers into NetworkController.
mNetworkController.mMobileSignalControllers.put(testSubscriptions[i],
mobileSignalController);
// Generate a list of subscriptions we will tell the NetworkController to use.
SubscriptionInfo mockSubInfo = Mockito.mock(SubscriptionInfo.class);
Mockito.when(mockSubInfo.getSubscriptionId()).thenReturn(testSubscriptions[i]);
subscriptions.add(mockSubInfo);
}
assertTrue(mNetworkController.hasCorrectMobileControllers(subscriptions));
// Add a subscription that the NetworkController doesn't know about.
SubscriptionInfo mockSubInfo = Mockito.mock(SubscriptionInfo.class);
Mockito.when(mockSubInfo.getSubscriptionId()).thenReturn(notTestSubscription);
subscriptions.add(mockSubInfo);
assertFalse(mNetworkController.hasCorrectMobileControllers(subscriptions));
|
public void | testNoIconWithoutMobile()
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// Create a new NetworkController as this is currently handled in constructor.
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, mock(AccessPointControllerImpl.class),
mock(MobileDataControllerImpl.class));
setupNetworkController();
verifyLastMobileDataIndicators(false, 0, 0);
|
public void | testNoRoamingWithoutSignal()
setupDefaultSignal();
setCdma();
setCdmaRoaming(true);
setVoiceRegState(ServiceState.STATE_OUT_OF_SERVICE);
setDataRegState(ServiceState.STATE_OUT_OF_SERVICE);
// This exposes the bug in b/18034542, and should be switched to the commented out
// verification below (and pass), once the bug is fixed.
verifyLastMobileDataIndicators(true, R.drawable.stat_sys_signal_null,
TelephonyIcons.ROAMING_ICON);
//verifyLastMobileDataIndicators(true, R.drawable.stat_sys_signal_null, 0 /* No Icon */);
|
public void | testNoSimlessIconWithoutMobile()
// Turn off mobile network support.
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
// Create a new NetworkController as this is currently handled in constructor.
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
mConfig, mock(AccessPointControllerImpl.class),
mock(MobileDataControllerImpl.class));
setupNetworkController();
// No Subscriptions.
mNetworkController.mMobileSignalControllers.clear();
mNetworkController.updateNoSims();
verifyHasNoSims(false);
|
public void | testNoSimsIconPresent()
// No Subscriptions.
mNetworkController.mMobileSignalControllers.clear();
mNetworkController.updateNoSims();
verifyHasNoSims(true);
|
public void | testQsSignalStrength()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setLevel(testStrength);
verifyLastQsMobileDataIndicators(true,
TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
DEFAULT_QS_ICON, false, false);
}
|
public void | testSetCurrentSubscriptions()
// We will not add one controller to make sure it gets created.
int indexToSkipController = 0;
// We will not add one subscription to make sure it's controller gets removed.
int indexToSkipSubscription = 1;
int[] testSubscriptions = new int[] { 1, 5, 3 };
MobileSignalController[] mobileSignalControllers = new MobileSignalController[] {
Mockito.mock(MobileSignalController.class),
Mockito.mock(MobileSignalController.class),
Mockito.mock(MobileSignalController.class),
};
mNetworkController.mMobileSignalControllers.clear();
List<SubscriptionInfo> subscriptions = new ArrayList<>();
for (int i = 0; i < testSubscriptions.length; i++) {
if (i != indexToSkipController) {
// Force the test controllers into NetworkController.
mNetworkController.mMobileSignalControllers.put(testSubscriptions[i],
mobileSignalControllers[i]);
}
if (i != indexToSkipSubscription) {
// Generate a list of subscriptions we will tell the NetworkController to use.
SubscriptionInfo mockSubInfo = Mockito.mock(SubscriptionInfo.class);
Mockito.when(mockSubInfo.getSubscriptionId()).thenReturn(testSubscriptions[i]);
Mockito.when(mockSubInfo.getSimSlotIndex()).thenReturn(testSubscriptions[i]);
subscriptions.add(mockSubInfo);
}
}
// We can only test whether unregister gets called if it thinks its in a listening
// state.
mNetworkController.mListening = true;
mNetworkController.setCurrentSubscriptions(subscriptions);
for (int i = 0; i < testSubscriptions.length; i++) {
if (i == indexToSkipController) {
// Make sure a controller was created despite us not adding one.
assertTrue(mNetworkController.mMobileSignalControllers.containsKey(
testSubscriptions[i]));
} else if (i == indexToSkipSubscription) {
// Make sure the controller that did exist was removed
assertFalse(mNetworkController.mMobileSignalControllers.containsKey(
testSubscriptions[i]));
} else {
// If a MobileSignalController is around it needs to not be unregistered.
Mockito.verify(mobileSignalControllers[i], Mockito.never())
.unregisterListener();
}
}
|
public void | testSignalRoaming()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setGsmRoaming(true);
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[1][testStrength],
TelephonyIcons.ROAMING_ICON);
}
|
public void | testSignalStrength()
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
setupDefaultSignal();
setLevel(testStrength);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][testStrength],
DEFAULT_ICON);
// Verify low inet number indexing.
setConnectivity(0, ConnectivityManager.TYPE_MOBILE, true);
verifyLastMobileDataIndicators(true,
TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[0][testStrength], 0);
}
|