Updating tests to honor per-app TRACK_DEFAULT

Per-app APIs in ConnectivityService will now have their fallback
request which tracks the system default be of type TRACK_DEFAULT
as opposed to REQUEST. Existing tests which expect this fallback request
to be sent to network factories need to be updated to validate this
change.

Bug: 180452284
Bug: 176494815
Test: atest FrameworksNetTests
Merged-In: I3c2563d4ae4e3715d0c6270344ba8f7ef067872f
Merged-In: I5125755b3ed1ec535494e2d7a48c0860710ed056
Change-Id: I5125755b3ed1ec535494e2d7a48c0860710ed056
  (cherry-picked from ag/14286730)
This commit is contained in:
James Mattis
2021-04-22 17:41:47 -07:00
committed by Junyu Lai
parent 0354d8c7e0
commit 5c3bb5b1ce

View File

@@ -11695,10 +11695,12 @@ public class ConnectivityServiceTest {
mServiceContext, "internetFactory", internetFilter, mCsHandlerThread);
internetFactory.setScoreFilter(40);
internetFactory.register();
// Default internet request & 3rd (fallback) request in OEM_PAID NRI. The unmetered request
// is never sent to factories (it's a LISTEN, not requestable) and the OEM_PAID request
// doesn't match the internetFactory filter.
internetFactory.expectRequestAdds(2);
// Default internet request only. The unmetered request is never sent to factories (it's a
// LISTEN, not requestable). The 3rd (fallback) request in OEM_PAID NRI is TRACK_DEFAULT
// which is also not sent to factories. Finally, the OEM_PAID request doesn't match the
// internetFactory filter.
internetFactory.expectRequestAdds(1);
internetFactory.assertRequestCountEquals(1);
NetworkCapabilities oemPaidFilter = new NetworkCapabilities()
.addCapability(NET_CAPABILITY_INTERNET)
@@ -11721,7 +11723,7 @@ public class ConnectivityServiceTest {
expectNoRequestChanged(oemPaidFactory);
oemPaidFactory.assertRequestCountEquals(1);
// The internet factory however is outscored, and should lose its requests.
internetFactory.expectRequestRemoves(2);
internetFactory.expectRequestRemove();
internetFactory.assertRequestCountEquals(0);
final NetworkCapabilities oemPaidNc = new NetworkCapabilities();