Merge changes Ie756b9aa,I38110f3a

* changes:
  [NS A19] Inline updateCapabilities in rematch.
  [NS A18] Reverse listens and request-availables
This commit is contained in:
Treehugger Robot
2019-12-04 02:07:45 +00:00
committed by Gerrit Code Review
2 changed files with 67 additions and 13 deletions

View File

@@ -3134,14 +3134,11 @@ public class ConnectivityServiceTest {
.addTransportType(TRANSPORT_CELLULAR).build();
final TestNetworkCallback cellCallback = new TestNetworkCallback();
mCm.requestNetwork(cellRequest, cellCallback);
// NOTE: This request causes the network's capabilities to change. This
// is currently delivered before the onAvailable() callbacks.
// TODO: Fix this.
cellCallback.expectCapabilitiesWith(NET_CAPABILITY_FOREGROUND, mCellNetworkAgent);
cellCallback.expectAvailableCallbacksValidated(mCellNetworkAgent);
fgCallback.expectAvailableCallbacksValidated(mCellNetworkAgent);
// Expect a network capabilities update with FOREGROUND, because the most recent
// request causes its state to change.
cellCallback.expectCapabilitiesWith(NET_CAPABILITY_FOREGROUND, mCellNetworkAgent);
callback.expectCapabilitiesWith(NET_CAPABILITY_FOREGROUND, mCellNetworkAgent);
assertTrue(isForegroundNetwork(mCellNetworkAgent));
assertTrue(isForegroundNetwork(mWiFiNetworkAgent));