summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-08-04 20:14:37 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-08-04 20:14:37 +0000
commitc5b54baefbe1a27de65f78eb3c0147b5a9aed077 (patch)
treebad216b3ab9869740230bddce4fb0f83a04095c5 /tests
parent6ac3793325c1e4255eac0ed4a922590ef3b34fa5 (diff)
parentabf203702036541f4a7704a630edf59d310dd2c3 (diff)
Merge "HalDeviceManager: Get IWifi proxy immediately" into oc-dr1-dev
am: abf2037020 Change-Id: Ic44883a039ae0e3cc7385739c61b097d081c8231
Diffstat (limited to 'tests')
-rw-r--r--tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java
index 3e203a666..54c67b222 100644
--- a/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/HalDeviceManagerTest.java
@@ -164,6 +164,22 @@ public class HalDeviceManagerTest {
}
/**
+ * Test the service manager notification coming in after
+ * {@link HalDeviceManager#initIWifiIfNecessary()} is already invoked as a part of
+ * {@link HalDeviceManager#initialize()}.
+ */
+ @Test
+ public void testServiceRegisterationAfterInitialize() throws Exception {
+ mInOrder = inOrder(mServiceManagerMock, mWifiMock, mManagerStatusListenerMock);
+ executeAndValidateInitializationSequence();
+
+ // This should now be ignored since IWifi is already non-null.
+ mServiceNotificationCaptor.getValue().onRegistration(IWifi.kInterfaceName, "", true);
+
+ verifyNoMoreInteractions(mManagerStatusListenerMock, mWifiMock, mServiceManagerMock);
+ }
+
+ /**
* Validate that multiple callback registrations are called and that duplicate ones are
* only called once.
*/
@@ -221,7 +237,7 @@ public class HalDeviceManagerTest {
// verify: service and callback calls
mInOrder.verify(mWifiMock).start();
- mInOrder.verify(mManagerStatusListenerMock, times(3)).onStatusChanged();
+ mInOrder.verify(mManagerStatusListenerMock, times(2)).onStatusChanged();
verifyNoMoreInteractions(mManagerStatusListenerMock);
}
@@ -1097,12 +1113,13 @@ public class HalDeviceManagerTest {
mInOrder.verify(mServiceManagerMock).registerForNotifications(eq(IWifi.kInterfaceName),
eq(""), mServiceNotificationCaptor.capture());
- // act: get the service started (which happens even when service was already up)
- mServiceNotificationCaptor.getValue().onRegistration(IWifi.kInterfaceName, "", true);
+ // The service should already be up at this point.
// verify: wifi initialization sequence
mInOrder.verify(mWifiMock).linkToDeath(mDeathRecipientCaptor.capture(), anyLong());
mInOrder.verify(mWifiMock).registerEventCallback(mWifiEventCallbackCaptor.capture());
+ // verify: onStop called as a part of initialize.
+ mInOrder.verify(mWifiMock).stop();
collector.checkThat("isReady is true", mDut.isReady(), equalTo(true));
}