From add9d4668ae3ec9116823bd518f3c12f75a42970 Mon Sep 17 00:00:00 2001 From: Rebecca Silberstein Date: Wed, 5 Apr 2017 10:01:12 -0700 Subject: WifiServiceImpl: fix failing test Fix failing unit test due to a change in the implementation of registerContentObserver. This method is final so our mock was not being called. The implementation change uses a static method, ultimately the source of the failure. Bug: 36919372 Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh Change-Id: I15d680fdf1211c1171708a3305bdcdcf4b916961 --- tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests') diff --git a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java index e5289ac32..5684ce6de 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiServiceImplTest.java @@ -149,10 +149,13 @@ public class WifiServiceImplTest { when(mWifiInjector.getWifiController()).thenReturn(mWifiController); when(mWifiInjector.getWifiMetrics()).thenReturn(mWifiMetrics); when(mWifiInjector.getWifiStateMachine()).thenReturn(mWifiStateMachine); + when(mWifiStateMachine.syncInitialize(any())).thenReturn(true); when(mWifiInjector.getWifiServiceHandlerThread()).thenReturn(mHandlerThread); when(mHandlerThread.getLooper()).thenReturn(mLooper.getLooper()); when(mContext.getResources()).thenReturn(mResources); when(mContext.getContentResolver()).thenReturn(mContentResolver); + doNothing().when(mFrameworkFacade).registerContentObserver(eq(mContext), any(), + anyBoolean(), any()); IPowerManager powerManagerService = mock(IPowerManager.class); mPowerManager = new PowerManager(mContext, powerManagerService, new Handler()); when(mContext.getSystemServiceName(PowerManager.class)).thenReturn(Context.POWER_SERVICE); -- cgit v1.2.3