diff options
author | Rebecca Silberstein <silberst@google.com> | 2016-09-19 11:24:30 -0700 |
---|---|---|
committer | Rebecca Silberstein <silberst@google.com> | 2016-09-22 16:31:23 +0000 |
commit | 22f57da33e6b132a0e7e4bd6d986f74b53d19527 (patch) | |
tree | 4128add40ed3aa6fbce33e328f7557c79fdeea80 /tests | |
parent | a049f83a308e7753b68c1a5036ab67d9806807ec (diff) |
WifiNotificationController: use WifiScanner
Update WifiNotificiationController to use
WifiScanner.getSingleScanResults() instead of WifiStateMachine. This
involves plumbing WifiInjector to retrieve WifiScanner. Also updated
the test to mock the getSingleScanResults call instead of the
WifiStateMachine.syncGetScanResultsAsList call.
BUG: 31504903
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: manual testing looking for notification and reported dump values
Change-Id: I6449e953c4fd35941096586383252e7c24c504db
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiNotificationControllerTest.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiNotificationControllerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiNotificationControllerTest.java index c3fcc96d3..cc59ee4bd 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiNotificationControllerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiNotificationControllerTest.java @@ -33,6 +33,7 @@ import android.content.res.Resources; import android.net.NetworkInfo; import android.net.wifi.ScanResult; import android.net.wifi.WifiManager; +import android.net.wifi.WifiScanner; import android.os.UserHandle; import android.os.test.TestLooper; import android.provider.Settings; @@ -58,6 +59,8 @@ public class WifiNotificationControllerTest { @Mock private WifiStateMachine mWifiStateMachine; @Mock private FrameworkFacade mFrameworkFacade; @Mock private NotificationManager mNotificationManager; + @Mock private WifiInjector mWifiInjector; + @Mock private WifiScanner mWifiScanner; WifiNotificationController mWifiNotificationController; /** @@ -80,10 +83,12 @@ public class WifiNotificationControllerTest { when(mFrameworkFacade.getIntegerSetting(mContext, Settings.Global.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 1)).thenReturn(1); + when(mWifiInjector.getWifiScanner()).thenReturn(mWifiScanner); + TestLooper mock_looper = new TestLooper(); mWifiNotificationController = new WifiNotificationController( mContext, mock_looper.getLooper(), mWifiStateMachine, mFrameworkFacade, - mock(Notification.Builder.class)); + mock(Notification.Builder.class), mWifiInjector); ArgumentCaptor<BroadcastReceiver> broadcastReceiverCaptor = ArgumentCaptor.forClass(BroadcastReceiver.class); @@ -97,7 +102,7 @@ public class WifiNotificationControllerTest { ScanResult scanResult = new ScanResult(); scanResult.capabilities = "[ESS]"; scanResults.add(scanResult); - when(mWifiStateMachine.syncGetScanResultsList()).thenReturn(scanResults); + when(mWifiScanner.getSingleScanResults()).thenReturn(scanResults); } /** Verifies that a notification is displayed (and retracted) given system events. */ |