[CM] Fix NPE due to unvalidated callback value

Fix flaky test resulting from the above fix.

Bug: 132950880
Test: atest ConnectivityServiceTest
Merged-In: Ia2cc04b42288ea987483e5ab0e0a10093dc49502
Change-Id: Ia2cc04b42288ea987483e5ab0e0a10093dc49502
(cherry picked from commit cc65a628eb1172dc7b942d7f51b702099c15c23b)
This commit is contained in:
Etan Cohen
2019-05-23 09:16:26 -07:00
parent 0da57a8b67
commit c8289e40a4

View File

@@ -3864,6 +3864,7 @@ public class ConnectivityServiceTest {
} }
} }
testFactory.expectRemoveRequests(1);
if (preUnregister) { if (preUnregister) {
mCm.unregisterNetworkCallback(networkCallback); mCm.unregisterNetworkCallback(networkCallback);
@@ -3873,7 +3874,6 @@ public class ConnectivityServiceTest {
testFactory.triggerUnfulfillable(requests.get(newRequestId)); testFactory.triggerUnfulfillable(requests.get(newRequestId));
} else { } else {
// Simulate the factory releasing the request as unfulfillable and expect onUnavailable! // Simulate the factory releasing the request as unfulfillable and expect onUnavailable!
testFactory.expectRemoveRequests(1);
testFactory.triggerUnfulfillable(requests.get(newRequestId)); testFactory.triggerUnfulfillable(requests.get(newRequestId));
networkCallback.expectCallback(CallbackState.UNAVAILABLE, null); networkCallback.expectCallback(CallbackState.UNAVAILABLE, null);