Merge "Still check the visibility of view"

This commit is contained in:
Lei Yu
2018-10-04 17:08:58 +00:00
committed by Android (Google) Code Review
2 changed files with 21 additions and 5 deletions

View File

@@ -57,11 +57,10 @@ public class WifiConfigControllerTest {
@Mock
private Context mContext;
@Mock
private View mView;
@Mock
private AccessPoint mAccessPoint;
@Mock
private KeyStore mKeyStore;
private View mView;
private Spinner mHiddenSettingsSpinner;
public WifiConfigController mController;
@@ -74,6 +73,7 @@ public class WifiConfigControllerTest {
private static final String SHORT_PSK = "abcdefg";
// Valid PSK pass phrase
private static final String GOOD_PSK = "abcdefghijklmnopqrstuvwxyz";
private static final String GOOD_SSID = "abc";
private static final int DHCP = 0;
@Before
@@ -185,6 +185,9 @@ public class WifiConfigControllerTest {
@Test
public void isSubmittable_EapToPskWithValidPassword_shouldReturnTrue() {
mController = new TestWifiConfigController(mConfigUiBase, mView, null,
WifiConfigUiBase.MODE_CONNECT);
final TextView ssid = mView.findViewById(R.id.ssid);
final TextView password = mView.findViewById(R.id.password);
final Spinner securitySpinner = mView.findViewById(R.id.security);
assertThat(password).isNotNull();
@@ -195,6 +198,16 @@ public class WifiConfigControllerTest {
mController.onItemSelected(securitySpinner, null, AccessPoint.SECURITY_EAP, 0);
mController.onItemSelected(securitySpinner, null, AccessPoint.SECURITY_PSK, 0);
password.setText(GOOD_PSK);
ssid.setText(GOOD_SSID);
assertThat(mController.isSubmittable()).isTrue();
}
@Test
public void isSubmittable_EapWithAkaMethod_shouldReturnTrue() {
when(mAccessPoint.isSaved()).thenReturn(true);
mController.mAccessPointSecurity = AccessPoint.SECURITY_EAP;
mView.findViewById(R.id.l_ca_cert).setVisibility(View.GONE);
assertThat(mController.isSubmittable()).isTrue();
}