Backport some helpers in ConnectivityServiceTest.
These were added in aosp/1527378, which is impractical to backport. Bug: 172870110 Test: test-only change Change-Id: Id3d12b23034b284c8f7dffb5167244e1e43987e2 Merged-In: I827543751dbf5e626a24ec02cd6f50b423f5f761 (cherry picked from commit 4c36cb764a6ffbc81acdbf2297cde010a7396f8b)
This commit is contained in:
committed by
android-build-team Robot
parent
e76c4083f9
commit
3536dc7df7
@@ -36,6 +36,7 @@ import static android.net.ConnectivityManager.TYPE_MOBILE;
|
||||
import static android.net.ConnectivityManager.TYPE_MOBILE_FOTA;
|
||||
import static android.net.ConnectivityManager.TYPE_MOBILE_MMS;
|
||||
import static android.net.ConnectivityManager.TYPE_MOBILE_SUPL;
|
||||
import static android.net.ConnectivityManager.TYPE_VPN;
|
||||
import static android.net.ConnectivityManager.TYPE_WIFI;
|
||||
import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_DNS;
|
||||
import static android.net.INetworkMonitor.NETWORK_VALIDATION_PROBE_FALLBACK;
|
||||
@@ -6289,6 +6290,19 @@ public class ConnectivityServiceTest {
|
||||
mCm.unregisterNetworkCallback(defaultCallback);
|
||||
}
|
||||
|
||||
private void checkNetworkInfo(NetworkInfo ni, int type, DetailedState state) {
|
||||
assertNotNull(ni);
|
||||
assertEquals(type, ni.getType());
|
||||
assertEquals(ConnectivityManager.getNetworkTypeName(type), state, ni.getDetailedState());
|
||||
}
|
||||
|
||||
private void assertActiveNetworkInfo(int type, DetailedState state) {
|
||||
checkNetworkInfo(mCm.getActiveNetworkInfo(), type, state);
|
||||
}
|
||||
private void assertNetworkInfo(int type, DetailedState state) {
|
||||
checkNetworkInfo(mCm.getNetworkInfo(type), type, state);
|
||||
}
|
||||
|
||||
@Test
|
||||
public final void testLoseTrusted() throws Exception {
|
||||
final NetworkRequest trustedRequest = new NetworkRequest.Builder()
|
||||
|
||||
Reference in New Issue
Block a user