diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2016-08-03 02:44:34 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2016-08-03 02:44:34 +0000 |
commit | a2a129cf524e3363d871cd1f4fbda19064af17b4 (patch) | |
tree | 936e7f73870bc270f1dd435b90f17f6207365125 /tests | |
parent | a078645184af3f8f2729df676b60c7b13b6b1b14 (diff) | |
parent | 63fad8b4722c94ce9107690b647cdbe7e8a1c4f9 (diff) |
Merge changes I46ebd8e7,Iee374b9e,I9e32eff0,Idd907c4b
* changes:
WifiDiagnostics: test a log call
move WifiDiagnostics creation from facade to injector
WifiDiagnostics: move to WifiLog API
WifiService: add WifiLog interface
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java | 17 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java | 3 |
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java index d954522a6..ce5ba7bf0 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiDiagnosticsTest.java @@ -26,6 +26,8 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.contains; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyObject; import static org.mockito.Mockito.eq; @@ -55,6 +57,8 @@ public class WifiDiagnosticsTest { @Mock WifiNative mWifiNative; @Mock BuildProperties mBuildProperties; @Mock Context mContext; + @Mock WifiInjector mWifiInjector; + @Mock WifiLog mLog; WifiDiagnostics mWifiDiagnostics; private static final String FAKE_RING_BUFFER_NAME = "fake-ring-buffer"; @@ -100,8 +104,10 @@ public class WifiDiagnosticsTest { resources.setInteger(R.integer.config_wifi_logger_ring_buffer_verbose_size_limit_kb, LARGE_RING_BUFFER_SIZE_KB); when(mContext.getResources()).thenReturn(resources); + when(mWifiInjector.makeLog(anyString())).thenReturn(mLog); - mWifiDiagnostics = new WifiDiagnostics(mContext, mWsm, mWifiNative, mBuildProperties); + mWifiDiagnostics = new WifiDiagnostics( + mContext, mWifiInjector, mWsm, mWifiNative, mBuildProperties); mWifiNative.enableVerboseLogging(0); } @@ -263,6 +269,15 @@ public class WifiDiagnosticsTest { verify(mWifiNative).startPktFateMonitoring(); } + // Verifies that startLogging() reports failure of startPktFateMonitoring(). + @Test + public void startLoggingReportsFailureOfStartPktFateMonitoring() { + final boolean verbosityToggle = true; + when(mWifiNative.startPktFateMonitoring()).thenReturn(false); + mWifiDiagnostics.startLogging(verbosityToggle); + verify(mLog).e(contains("Failed")); + } + /** * Verifies that, when verbose mode is not enabled, reportConnectionFailure() still * fetches packet fates. diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java index 491911702..0c258e989 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java @@ -158,7 +158,6 @@ public class WifiStateMachineTest { when(facade.makeWifiScanner(any(Context.class), any(Looper.class))) .thenReturn(mWifiScanner); - when(facade.makeBaseDiagnostics()).thenReturn(mock(BaseWifiDiagnostics.class)); when(facade.getService(Context.NETWORKMANAGEMENT_SERVICE)).thenReturn( mockWithInterfaces(IBinder.class, INetworkManagementService.class)); @@ -349,6 +348,8 @@ public class WifiStateMachineTest { when(mWifiInjector.getBuildProperties()).thenReturn(mBuildProperties); when(mWifiInjector.getKeyStore()).thenReturn(mock(KeyStore.class)); when(mWifiInjector.getWifiBackupRestore()).thenReturn(mock(WifiBackupRestore.class)); + when(mWifiInjector.makeWifiDiagnostics(anyObject())).thenReturn( + mock(BaseWifiDiagnostics.class)); FrameworkFacade factory = getFrameworkFacade(); Context context = getContext(); |