Loading src/com/android/settings/wifi/WifiConfigController.java +5 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,11 @@ public class WifiConfigController implements TextWatcher, group.addView(row); } private String getSignalString() { @VisibleForTesting String getSignalString() { if (!mAccessPoint.isReachable()) { return null; } final int level = mAccessPoint.getLevel(); return (level > -1 && level < mLevels.length) ? mLevels[level] : null; Loading tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java +11 −4 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package com.android.settings.wifi; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; import android.content.Context; import android.view.LayoutInflater; import android.view.View; Loading @@ -40,6 +36,9 @@ import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; @RunWith(SettingsRobolectricTestRunner.class) @Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = ShadowConnectivityManager.class) Loading Loading @@ -109,6 +108,7 @@ public class WifiConfigControllerTest { when(mAccessPoint.isSaved()).thenReturn(true); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_nullAccessPoint_noException() { mController = new TestWifiConfigController(mConfigUiBase, mView, null, Loading @@ -116,6 +116,13 @@ public class WifiConfigControllerTest { mController.isSubmittable(); } @Test public void getSignalString_notReachable_shouldHaveNoSignalString() { when(mAccessPoint.isReachable()).thenReturn(false); assertThat(mController.getSignalString()).isNull(); } public class TestWifiConfigController extends WifiConfigController { public TestWifiConfigController(WifiConfigUiBase parent, View view, Loading Loading
src/com/android/settings/wifi/WifiConfigController.java +5 −1 Original line number Diff line number Diff line Loading @@ -372,7 +372,11 @@ public class WifiConfigController implements TextWatcher, group.addView(row); } private String getSignalString() { @VisibleForTesting String getSignalString() { if (!mAccessPoint.isReachable()) { return null; } final int level = mAccessPoint.getLevel(); return (level > -1 && level < mLevels.length) ? mLevels[level] : null; Loading
tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java +11 −4 Original line number Diff line number Diff line Loading @@ -16,10 +16,6 @@ package com.android.settings.wifi; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; import android.content.Context; import android.view.LayoutInflater; import android.view.View; Loading @@ -40,6 +36,9 @@ import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Mockito.when; @RunWith(SettingsRobolectricTestRunner.class) @Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = ShadowConnectivityManager.class) Loading Loading @@ -109,6 +108,7 @@ public class WifiConfigControllerTest { when(mAccessPoint.isSaved()).thenReturn(true); assertThat(mController.isSubmittable()).isTrue(); } @Test public void isSubmittable_nullAccessPoint_noException() { mController = new TestWifiConfigController(mConfigUiBase, mView, null, Loading @@ -116,6 +116,13 @@ public class WifiConfigControllerTest { mController.isSubmittable(); } @Test public void getSignalString_notReachable_shouldHaveNoSignalString() { when(mAccessPoint.isReachable()).thenReturn(false); assertThat(mController.getSignalString()).isNull(); } public class TestWifiConfigController extends WifiConfigController { public TestWifiConfigController(WifiConfigUiBase parent, View view, Loading