diff options
author | Rebecca Silberstein <silberst@google.com> | 2017-03-29 13:20:38 -0700 |
---|---|---|
committer | Rebecca Silberstein <silberst@google.com> | 2017-04-28 22:24:14 -0700 |
commit | aaa03cbbf831e3518d849d0742539fdf39f0627c (patch) | |
tree | 76f9346b760cb76234923192ff825bda498f8730 /tests/wifitests/src/com | |
parent | 768b7a7cb87525e92eb1a59a7a3e0c98b9f6f238 (diff) | |
download | android_frameworks_opt_net_wifi-aaa03cbbf831e3518d849d0742539fdf39f0627c.tar.gz android_frameworks_opt_net_wifi-aaa03cbbf831e3518d849d0742539fdf39f0627c.tar.bz2 android_frameworks_opt_net_wifi-aaa03cbbf831e3518d849d0742539fdf39f0627c.zip |
WifiServiceImpl: add empty calls for LOHS
Add new calls to start/stopLocalOnlyHotspot and start/stop observing
hotspot updates. The calls will be exposed in a later CL. The calls
throw the UnsupportedOperationException until the implementation is
complete.
Also added tests to verify the exceptions are thrown.
Bug: 36704763
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: frameworks/base/wifi/tests/runtests.sh
Change-Id: If6895534ecd1db5fafb3a451b26e2d3018cd60df
Diffstat (limited to 'tests/wifitests/src/com')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 54 |
1 files changed, 48 insertions, 6 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index 77b64ae14..b73aa299c 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -40,6 +40,7 @@ import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiManager; import android.os.Handler; import android.os.HandlerThread; +import android.os.IBinder; import android.os.IPowerManager; import android.os.Looper; import android.os.Message; @@ -83,16 +84,19 @@ public class WifiServiceImplTest { private static final String SETTINGS_PACKAGE_NAME = "com.android.settings"; private static final String SYSUI_PACKAGE_NAME = "com.android.systemui"; + private WifiServiceImpl mWifiServiceImpl; + private TestLooper mLooper; + private PowerManager mPowerManager; + private Handler mHandler; + private Messenger mAppMessenger; + @Mock Context mContext; @Mock WifiInjector mWifiInjector; @Mock Clock mClock; - WifiServiceImpl mWifiServiceImpl; - @Mock WifiController mWifiController; @Mock WifiTrafficPoller mWifiTrafficPoller; @Mock WifiStateMachine mWifiStateMachine; @Mock HandlerThread mHandlerThread; - TestLooper mLooper; @Mock AsyncChannel mAsyncChannel; @Mock Resources mResources; @Mock FrameworkFacade mFrameworkFacade; @@ -101,7 +105,6 @@ public class WifiServiceImplTest { @Mock WifiLastResortWatchdog mWifiLastResortWatchdog; @Mock WifiBackupRestore mWifiBackupRestore; @Mock WifiMetrics mWifiMetrics; - @Spy FakeWifiLog mLog; @Mock WifiPermissionsUtil mWifiPermissionsUtil; @Mock WifiSettingsStore mSettingsStore; @Mock ContentResolver mContentResolver; @@ -109,7 +112,9 @@ public class WifiServiceImplTest { @Mock WifiConfiguration mApConfig; @Mock ActivityManager mActivityManager; @Mock AppOpsManager mAppOpsManager; - PowerManager mPowerManager; + @Mock IBinder mAppBinder; + + @Spy FakeWifiLog mLog; private class WifiAsyncChannelTester { private static final String TAG = "WifiAsyncChannelTester"; @@ -167,6 +172,8 @@ public class WifiServiceImplTest { @Before public void setUp() { MockitoAnnotations.initMocks(this); mLooper = new TestLooper(); + mHandler = new Handler(mLooper.getLooper()); + mAppMessenger = new Messenger(mHandler); when(mWifiInjector.getUserManager()).thenReturn(mUserManager); when(mWifiInjector.getWifiController()).thenReturn(mWifiController); @@ -646,7 +653,6 @@ public class WifiServiceImplTest { /** * Ensure background apps can do wifi scan when the throttle interval reached. */ - @Test public void testWifiScanBackgroundNotThrottled() { when(mActivityManager.getPackageImportance(SCAN_PACKAGE_NAME)).thenReturn( @@ -683,4 +689,40 @@ public class WifiServiceImplTest { verify(mWifiStateMachine, times(2)).startScan( anyInt(), anyInt(), (ScanSettings) eq(null), any(WorkSource.class)); } + + /** + * Verify that the call to startLocalOnlyHotspot throws the UnsupportedOperationException + * until the implementation is complete. + */ + @Test(expected = UnsupportedOperationException.class) + public void testStartLocalOnlyHotspotNotSupported() { + mWifiServiceImpl.startLocalOnlyHotspot(mAppMessenger, mAppBinder); + } + + /** + * Verify that the call to stopLocalOnlyHotspot throws the UnsupportedOperationException until + * the implementation is complete. + */ + @Test(expected = UnsupportedOperationException.class) + public void testStopLocalOnlyHotspotNotSupported() { + mWifiServiceImpl.stopLocalOnlyHotspot(); + } + + /** + * Verify that the call to startWatchLocalOnlyHotspot throws the UnsupportedOperationException + * until the implementation is complete. + */ + @Test(expected = UnsupportedOperationException.class) + public void testStartWatchLocalOnlyHotspotNotSupported() { + mWifiServiceImpl.startWatchLocalOnlyHotspot(mAppMessenger, mAppBinder); + } + + /** + * Verify that the call to stopWatchLocalOnlyHotspot throws the UnsupportedOperationException + * until the implementation is complete. + */ + @Test(expected = UnsupportedOperationException.class) + public void testStopWatchLocalOnlyHotspotNotSupported() { + mWifiServiceImpl.stopWatchLocalOnlyHotspot(); + } } |