diff options
author | Jason Monk <jmonk@google.com> | 2015-01-07 12:07:06 -0500 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2015-01-29 15:58:23 +0000 |
commit | 18985e08ebd1c04e3160262925be995cf7c82001 (patch) | |
tree | 12e3030fc0cc2fb910f1225189b4eb85575639b8 /packages/SystemUI | |
parent | ef15d3cf32965aa8965d0168db06446fdf3d60a2 (diff) | |
download | frameworks_base-18985e08ebd1c04e3160262925be995cf7c82001.zip frameworks_base-18985e08ebd1c04e3160262925be995cf7c82001.tar.gz frameworks_base-18985e08ebd1c04e3160262925be995cf7c82001.tar.bz2 |
Fix SysUI tests to pass.
Most were fixed by including the correct subscription id in the
broadcast.
The last was testing based on SIM card state which is not something
the MobileSignalControllers track anymore so I just pulled it out
completely.
Change-Id: Ie52068a3c8f8652f1b0641e6376696aeddda26a2
Diffstat (limited to 'packages/SystemUI')
3 files changed, 7 insertions, 23 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java index af92423..e8023bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/MobileSignalController.java @@ -57,7 +57,6 @@ public class MobileSignalController extends SignalController< // Since some pieces of the phone state are interdependent we store it locally, // this could potentially become part of MobileState for simplification/complication // of code. - private IccCardConstants.State mSimState = IccCardConstants.State.READY; private int mDataNetType = TelephonyManager.NETWORK_TYPE_UNKNOWN; private int mDataState = TelephonyManager.DATA_DISCONNECTED; private ServiceState mServiceState; @@ -146,11 +145,6 @@ public class MobileSignalController extends SignalController< return getIcons().mDataContentDescription; } - @VisibleForTesting - protected IccCardConstants.State getSimState() { - return mSimState; - } - public void setAirplaneMode(boolean airplaneMode) { mCurrentState.airplaneMode = airplaneMode; notifyListenersIfNecessary(); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java index 9b95d5c..260dea0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerBaseTest.java @@ -69,6 +69,8 @@ public class NetworkControllerBaseTest extends AndroidTestCase { protected TelephonyManager mMockTm; protected Config mConfig; + protected int mSubId; + private NetworkCapabilities mNetCapabilities; @Override @@ -100,13 +102,13 @@ public class NetworkControllerBaseTest extends AndroidTestCase { protected void setupNetworkController() { // For now just pretend to be the data sim, so we can test that too. - final int subId = SubscriptionManager.getDefaultDataSubId(); + mSubId = SubscriptionManager.getDefaultDataSubId(); SubscriptionInfo subscription = mock(SubscriptionInfo.class); List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>(); - when(subscription.getSubscriptionId()).thenReturn(subId); + when(subscription.getSubscriptionId()).thenReturn(mSubId); subs.add(subscription); mNetworkController.setCurrentSubscriptions(subs); - mMobileSignalController = mNetworkController.mMobileSignalControllers.get(subId); + mMobileSignalController = mNetworkController.mMobileSignalControllers.get(mSubId); mPhoneStateListener = mMobileSignalController.mPhoneStateListener; mSignalCluster = mock(SignalCluster.class); mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class); @@ -291,10 +293,6 @@ public class NetworkControllerBaseTest extends AndroidTestCase { assertEquals("Visibility in status bar", visible, (boolean) visibleArg.getValue()); } - protected void assertSimStateEquals(IccCardConstants.State expected) { - assertEquals("Sim state", expected, mMobileSignalController.getSimState()); - } - protected void assertNetworkNameEquals(String expected) { assertEquals("Network name", expected, mNetworkController.getMobileNetworkName()); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java index 65b0971..7fa3f68 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerSignalTest.java @@ -25,6 +25,7 @@ import android.telephony.SubscriptionInfo; import android.telephony.TelephonyManager; import com.android.internal.telephony.IccCardConstants; +import com.android.internal.telephony.PhoneConstants; import com.android.internal.telephony.TelephonyIntents; import com.android.systemui.R; @@ -254,16 +255,6 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest { setCdmaRoaming(false); } - public void testOnReceive_updateSimState_noSim() { - Intent intent = new Intent(); - intent.setAction(TelephonyIntents.ACTION_SIM_STATE_CHANGED); - intent.putExtra(IccCardConstants.INTENT_KEY_ICC_STATE, IccCardConstants.INTENT_VALUE_ICC_ABSENT); - - mNetworkController.onReceive(mContext, intent); - - assertSimStateEquals(IccCardConstants.State.ABSENT); - } - public void testOnReceive_stringsUpdatedAction_spn() { String expectedMNetworkName = "Test"; Intent intent = createStringsUpdatedIntent(true /* showSpn */, @@ -344,6 +335,7 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest { intent.putExtra(TelephonyIntents.EXTRA_SHOW_PLMN, showPlmn); intent.putExtra(TelephonyIntents.EXTRA_PLMN, plmn); + intent.putExtra(PhoneConstants.SUBSCRIPTION_KEY, mSubId); return intent; } |