Jason Monk | da68f59 | 2015-01-07 10:55:58 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 16 | |
| 17 | package com.android.systemui.statusbar.policy; |
| 18 | |
| 19 | import static org.mockito.Mockito.mock; |
| 20 | import static org.mockito.Mockito.when; |
| 21 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 22 | import android.content.Intent; |
| 23 | import android.net.ConnectivityManager; |
Jason Monk | d8e4bf4 | 2014-12-12 10:23:12 -0500 | [diff] [blame] | 24 | import android.net.NetworkCapabilities; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 25 | import android.net.wifi.WifiManager; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 26 | import android.telephony.PhoneStateListener; |
| 27 | import android.telephony.ServiceState; |
| 28 | import android.telephony.SignalStrength; |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 29 | import android.telephony.SubscriptionInfo; |
| 30 | import android.telephony.SubscriptionManager; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 31 | import android.telephony.TelephonyManager; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 32 | import android.util.Log; |
| 33 | |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 34 | import com.android.internal.telephony.IccCardConstants; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 35 | import com.android.internal.telephony.cdma.EriInfo; |
Chris Wren | 930ecca | 2014-11-12 17:43:41 -0500 | [diff] [blame] | 36 | import com.android.systemui.SysuiTestCase; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 37 | import com.android.systemui.statusbar.policy.NetworkController.NetworkSignalChangedCallback; |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 38 | import com.android.systemui.statusbar.policy.NetworkControllerImpl.Config; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 39 | import com.android.systemui.statusbar.policy.NetworkControllerImpl.SignalCluster; |
| 40 | |
Jason Monk | da68f59 | 2015-01-07 10:55:58 -0500 | [diff] [blame] | 41 | import org.mockito.ArgumentCaptor; |
| 42 | import org.mockito.Mockito; |
| 43 | |
| 44 | import java.io.PrintWriter; |
| 45 | import java.io.StringWriter; |
| 46 | import java.util.ArrayList; |
| 47 | import java.util.List; |
| 48 | |
Chris Wren | 930ecca | 2014-11-12 17:43:41 -0500 | [diff] [blame] | 49 | public class NetworkControllerBaseTest extends SysuiTestCase { |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 50 | private static final String TAG = "NetworkControllerBaseTest"; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 51 | protected static final int DEFAULT_LEVEL = 2; |
| 52 | protected static final int DEFAULT_SIGNAL_STRENGTH = |
| 53 | TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL]; |
| 54 | protected static final int DEFAULT_QS_SIGNAL_STRENGTH = |
| 55 | TelephonyIcons.QS_TELEPHONY_SIGNAL_STRENGTH[1][DEFAULT_LEVEL]; |
| 56 | protected static final int DEFAULT_ICON = TelephonyIcons.ICON_3G; |
| 57 | protected static final int DEFAULT_QS_ICON = TelephonyIcons.QS_ICON_3G; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 58 | |
| 59 | protected NetworkControllerImpl mNetworkController; |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 60 | protected MobileSignalController mMobileSignalController; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 61 | protected PhoneStateListener mPhoneStateListener; |
| 62 | protected SignalCluster mSignalCluster; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 63 | protected NetworkSignalChangedCallback mNetworkSignalChangedCallback; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 64 | private SignalStrength mSignalStrength; |
| 65 | private ServiceState mServiceState; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 66 | protected ConnectivityManager mMockCm; |
| 67 | protected WifiManager mMockWm; |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 68 | protected SubscriptionManager mMockSm; |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 69 | protected TelephonyManager mMockTm; |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 70 | protected Config mConfig; |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 71 | |
Jason Monk | 18985e0 | 2015-01-07 12:07:06 -0500 | [diff] [blame] | 72 | protected int mSubId; |
| 73 | |
Jason Monk | d8e4bf4 | 2014-12-12 10:23:12 -0500 | [diff] [blame] | 74 | private NetworkCapabilities mNetCapabilities; |
| 75 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 76 | @Override |
| 77 | protected void setUp() throws Exception { |
| 78 | super.setUp(); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 79 | |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 80 | mMockWm = mock(WifiManager.class); |
| 81 | mMockTm = mock(TelephonyManager.class); |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 82 | mMockSm = mock(SubscriptionManager.class); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 83 | mMockCm = mock(ConnectivityManager.class); |
Jason Monk | d8e4bf4 | 2014-12-12 10:23:12 -0500 | [diff] [blame] | 84 | mNetCapabilities = new NetworkCapabilities(); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 85 | when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(true); |
Jason Monk | d8e4bf4 | 2014-12-12 10:23:12 -0500 | [diff] [blame] | 86 | when(mMockCm.getDefaultNetworkCapabilitiesForUser(0)).thenReturn( |
| 87 | new NetworkCapabilities[] { mNetCapabilities }); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 88 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 89 | mSignalStrength = mock(SignalStrength.class); |
| 90 | mServiceState = mock(ServiceState.class); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 91 | |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 92 | mConfig = new Config(); |
| 93 | mConfig.hspaDataDistinguishable = true; |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 94 | mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm, |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 95 | mConfig, mock(AccessPointControllerImpl.class), |
| 96 | mock(MobileDataControllerImpl.class)); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 97 | setupNetworkController(); |
| 98 | } |
| 99 | |
| 100 | protected void setupNetworkController() { |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 101 | // For now just pretend to be the data sim, so we can test that too. |
Jason Monk | 18985e0 | 2015-01-07 12:07:06 -0500 | [diff] [blame] | 102 | mSubId = SubscriptionManager.getDefaultDataSubId(); |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 103 | SubscriptionInfo subscription = mock(SubscriptionInfo.class); |
| 104 | List<SubscriptionInfo> subs = new ArrayList<SubscriptionInfo>(); |
Jason Monk | 18985e0 | 2015-01-07 12:07:06 -0500 | [diff] [blame] | 105 | when(subscription.getSubscriptionId()).thenReturn(mSubId); |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 106 | subs.add(subscription); |
| 107 | mNetworkController.setCurrentSubscriptions(subs); |
Jason Monk | 18985e0 | 2015-01-07 12:07:06 -0500 | [diff] [blame] | 108 | mMobileSignalController = mNetworkController.mMobileSignalControllers.get(mSubId); |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 109 | mPhoneStateListener = mMobileSignalController.mPhoneStateListener; |
Jason Monk | d2263cd | 2014-11-10 14:22:56 -0500 | [diff] [blame] | 110 | mSignalCluster = mock(SignalCluster.class); |
| 111 | mNetworkSignalChangedCallback = mock(NetworkSignalChangedCallback.class); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 112 | mNetworkController.addSignalCluster(mSignalCluster); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 113 | mNetworkController.addNetworkSignalChangedCallback(mNetworkSignalChangedCallback); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 114 | } |
| 115 | |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 116 | protected NetworkControllerImpl setUpNoMobileData() { |
| 117 | when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false); |
| 118 | NetworkControllerImpl networkControllerNoMobile |
| 119 | = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm, |
| 120 | mConfig, mock(AccessPointControllerImpl.class), |
| 121 | mock(MobileDataControllerImpl.class)); |
| 122 | |
| 123 | setupNetworkController(); |
| 124 | |
| 125 | return networkControllerNoMobile; |
| 126 | |
| 127 | } |
| 128 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 129 | @Override |
| 130 | protected void tearDown() throws Exception { |
| 131 | StringWriter sw = new StringWriter(); |
| 132 | PrintWriter pw = new PrintWriter(sw); |
| 133 | mNetworkController.dump(null, pw, null); |
| 134 | pw.flush(); |
| 135 | Log.d(TAG, sw.toString()); |
| 136 | super.tearDown(); |
| 137 | } |
| 138 | |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 139 | // 2 Bars 3G GSM. |
| 140 | public void setupDefaultSignal() { |
| 141 | setIsGsm(true); |
| 142 | setVoiceRegState(ServiceState.STATE_IN_SERVICE); |
| 143 | setGsmRoaming(false); |
| 144 | setLevel(DEFAULT_LEVEL); |
| 145 | updateDataConnectionState(TelephonyManager.DATA_CONNECTED, |
| 146 | TelephonyManager.NETWORK_TYPE_UMTS); |
| 147 | setConnectivity(100, ConnectivityManager.TYPE_MOBILE, true); |
| 148 | } |
| 149 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 150 | public void setConnectivity(int inetCondition, int networkType, boolean isConnected) { |
| 151 | Intent i = new Intent(ConnectivityManager.INET_CONDITION_ACTION); |
Jason Monk | d8e4bf4 | 2014-12-12 10:23:12 -0500 | [diff] [blame] | 152 | // TODO: Separate out into several NetworkCapabilities. |
| 153 | if (isConnected) { |
| 154 | mNetCapabilities.addTransportType(networkType); |
| 155 | } else { |
| 156 | mNetCapabilities.removeTransportType(networkType); |
| 157 | } |
| 158 | if (inetCondition != 0) { |
| 159 | mNetCapabilities.addCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED); |
| 160 | } else { |
| 161 | mNetCapabilities.removeCapability(NetworkCapabilities.NET_CAPABILITY_VALIDATED); |
| 162 | } |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 163 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 164 | mNetworkController.onReceive(mContext, i); |
| 165 | } |
| 166 | |
| 167 | public void setGsmRoaming(boolean isRoaming) { |
| 168 | when(mServiceState.getRoaming()).thenReturn(isRoaming); |
| 169 | updateServiceState(); |
| 170 | } |
| 171 | |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 172 | public void setCdmaRoaming(boolean isRoaming) { |
| 173 | when(mServiceState.getCdmaEriIconIndex()).thenReturn(isRoaming ? |
| 174 | EriInfo.ROAMING_INDICATOR_ON : EriInfo.ROAMING_INDICATOR_OFF); |
| 175 | when(mServiceState.getCdmaEriIconMode()).thenReturn(isRoaming ? |
| 176 | EriInfo.ROAMING_ICON_MODE_NORMAL : -1); |
| 177 | updateServiceState(); |
| 178 | } |
| 179 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 180 | public void setVoiceRegState(int voiceRegState) { |
| 181 | when(mServiceState.getVoiceRegState()).thenReturn(voiceRegState); |
| 182 | updateServiceState(); |
| 183 | } |
| 184 | |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 185 | public void setDataRegState(int dataRegState) { |
| 186 | when(mServiceState.getDataRegState()).thenReturn(dataRegState); |
| 187 | updateServiceState(); |
| 188 | } |
| 189 | |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 190 | public void setIsEmergencyOnly(boolean isEmergency) { |
| 191 | when(mServiceState.isEmergencyOnly()).thenReturn(isEmergency); |
| 192 | updateServiceState(); |
| 193 | } |
| 194 | |
| 195 | public void setCdmaLevel(int level) { |
| 196 | when(mSignalStrength.getCdmaLevel()).thenReturn(level); |
| 197 | updateSignalStrength(); |
| 198 | } |
| 199 | |
| 200 | public void setLevel(int level) { |
| 201 | when(mSignalStrength.getLevel()).thenReturn(level); |
| 202 | updateSignalStrength(); |
| 203 | } |
| 204 | |
| 205 | public void setIsGsm(boolean gsm) { |
| 206 | when(mSignalStrength.isGsm()).thenReturn(gsm); |
| 207 | updateSignalStrength(); |
| 208 | } |
| 209 | |
| 210 | public void setCdmaEri(int index, int mode) { |
| 211 | // TODO: Figure this out. |
| 212 | } |
| 213 | |
| 214 | private void updateSignalStrength() { |
| 215 | Log.d(TAG, "Sending Signal Strength: " + mSignalStrength); |
| 216 | mPhoneStateListener.onSignalStrengthsChanged(mSignalStrength); |
| 217 | } |
| 218 | |
| 219 | private void updateServiceState() { |
| 220 | Log.d(TAG, "Sending Service State: " + mServiceState); |
| 221 | mPhoneStateListener.onServiceStateChanged(mServiceState); |
| 222 | } |
| 223 | |
| 224 | public void updateCallState(int state) { |
| 225 | // Inputs not currently used in NetworkControllerImpl. |
| 226 | mPhoneStateListener.onCallStateChanged(state, "0123456789"); |
| 227 | } |
| 228 | |
| 229 | public void updateDataConnectionState(int dataState, int dataNetType) { |
| 230 | mPhoneStateListener.onDataConnectionStateChanged(dataState, dataNetType); |
| 231 | } |
| 232 | |
| 233 | public void updateDataActivity(int dataActivity) { |
| 234 | mPhoneStateListener.onDataActivity(dataActivity); |
| 235 | } |
| 236 | |
Andrew Flynn | 5e75147 | 2015-05-01 11:50:07 -0400 | [diff] [blame^] | 237 | public void setCarrierNetworkChange(boolean enable) { |
| 238 | Log.d(TAG, "setCarrierNetworkChange(" + enable + ")"); |
| 239 | mPhoneStateListener.onCarrierNetworkChange(enable); |
| 240 | } |
| 241 | |
Jason Monk | 21d05a0 | 2014-12-02 12:46:58 -0500 | [diff] [blame] | 242 | protected void verifyHasNoSims(boolean hasNoSimsVisible) { |
| 243 | ArgumentCaptor<Boolean> hasNoSimsArg = ArgumentCaptor.forClass(Boolean.class); |
| 244 | |
| 245 | Mockito.verify(mSignalCluster, Mockito.atLeastOnce()).setNoSims(hasNoSimsArg.capture()); |
| 246 | assertEquals("No sims in status bar", hasNoSimsVisible, (boolean) hasNoSimsArg.getValue()); |
| 247 | |
| 248 | Mockito.verify(mNetworkSignalChangedCallback, Mockito.atLeastOnce()) |
| 249 | .onNoSimVisibleChanged(hasNoSimsArg.capture()); |
| 250 | assertEquals("No sims in quick settings", hasNoSimsVisible, |
| 251 | (boolean) hasNoSimsArg.getValue()); |
| 252 | } |
| 253 | |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 254 | protected void verifyLastQsMobileDataIndicators(boolean visible, int icon, int typeIcon, |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 255 | boolean dataIn, boolean dataOut) { |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 256 | ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 257 | ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class); |
| 258 | ArgumentCaptor<Boolean> visibleArg = ArgumentCaptor.forClass(Boolean.class); |
| 259 | ArgumentCaptor<Boolean> dataInArg = ArgumentCaptor.forClass(Boolean.class); |
| 260 | ArgumentCaptor<Boolean> dataOutArg = ArgumentCaptor.forClass(Boolean.class); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 261 | |
| 262 | Mockito.verify(mNetworkSignalChangedCallback, Mockito.atLeastOnce()) |
| 263 | .onMobileDataSignalChanged(visibleArg.capture(), iconArg.capture(), |
| 264 | ArgumentCaptor.forClass(String.class).capture(), |
| 265 | typeIconArg.capture(), |
| 266 | dataInArg.capture(), |
| 267 | dataOutArg.capture(), |
| 268 | ArgumentCaptor.forClass(String.class).capture(), |
| 269 | ArgumentCaptor.forClass(String.class).capture(), |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 270 | ArgumentCaptor.forClass(Boolean.class).capture()); |
| 271 | assertEquals("Visibility in, quick settings", visible, (boolean) visibleArg.getValue()); |
| 272 | assertEquals("Signal icon in, quick settings", icon, (int) iconArg.getValue()); |
| 273 | assertEquals("Data icon in, quick settings", typeIcon, (int) typeIconArg.getValue()); |
| 274 | assertEquals("Data direction in, in quick settings", dataIn, |
| 275 | (boolean) dataInArg.getValue()); |
| 276 | assertEquals("Data direction out, in quick settings", dataOut, |
| 277 | (boolean) dataOutArg.getValue()); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | protected void verifyLastMobileDataIndicators(boolean visible, int icon, int typeIcon) { |
Andrew Flynn | 5e75147 | 2015-05-01 11:50:07 -0400 | [diff] [blame^] | 281 | verifyLastMobileDataIndicators(visible, icon, icon, typeIcon); |
| 282 | } |
| 283 | |
| 284 | protected void verifyLastMobileDataIndicators(boolean visible, int strengthIcon, |
| 285 | int darkStrengthIcon, int typeIcon) { |
| 286 | ArgumentCaptor<Integer> strengthIconArg = ArgumentCaptor.forClass(Integer.class); |
| 287 | ArgumentCaptor<Integer> darkStrengthIconArg = ArgumentCaptor.forClass(Integer.class); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 288 | ArgumentCaptor<Integer> typeIconArg = ArgumentCaptor.forClass(Integer.class); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 289 | ArgumentCaptor<Boolean> visibleArg = ArgumentCaptor.forClass(Boolean.class); |
| 290 | |
| 291 | // TODO: Verify all fields. |
| 292 | Mockito.verify(mSignalCluster, Mockito.atLeastOnce()).setMobileDataIndicators( |
Andrew Flynn | 5e75147 | 2015-05-01 11:50:07 -0400 | [diff] [blame^] | 293 | visibleArg.capture(), strengthIconArg.capture(), darkStrengthIconArg.capture(), |
| 294 | typeIconArg.capture(), |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 295 | ArgumentCaptor.forClass(String.class).capture(), |
| 296 | ArgumentCaptor.forClass(String.class).capture(), |
Jason Monk | b574627 | 2014-11-12 16:50:31 -0500 | [diff] [blame] | 297 | ArgumentCaptor.forClass(Boolean.class).capture(), |
| 298 | ArgumentCaptor.forClass(Integer.class).capture()); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 299 | |
Andrew Flynn | 5e75147 | 2015-05-01 11:50:07 -0400 | [diff] [blame^] | 300 | assertEquals("Signal strength icon in status bar", strengthIcon, |
| 301 | (int) strengthIconArg.getValue()); |
| 302 | assertEquals("Signal strength icon (dark mode) in status bar", darkStrengthIcon, |
| 303 | (int) darkStrengthIconArg.getValue()); |
Jason Monk | f13b4b3 | 2014-11-07 16:39:34 -0500 | [diff] [blame] | 304 | assertEquals("Data icon in status bar", typeIcon, (int) typeIconArg.getValue()); |
| 305 | assertEquals("Visibility in status bar", visible, (boolean) visibleArg.getValue()); |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 306 | } |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 307 | |
Leigh Anne | d0a6279 | 2014-11-13 14:27:10 -0800 | [diff] [blame] | 308 | protected void assertNetworkNameEquals(String expected) { |
| 309 | assertEquals("Network name", expected, mNetworkController.getMobileNetworkName()); |
| 310 | } |
Jason Monk | e0cdb60 | 2014-11-05 12:39:45 -0500 | [diff] [blame] | 311 | } |