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
Change-Id: I5125755b3ed1ec535494e2d7a48c0860710ed056
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index 1aa2ed2..a92973f 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -11693,10 +11693,12 @@
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)
@@ -11719,7 +11721,7 @@
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();