Merge "Set attributionTag for noteOp(WRITE_SETTINGS) calls" am: da8697a48b am: 7b3866f284
Change-Id: I099944752fc3006c1e98750dd46dbebf5e50789f
This commit is contained in:
committed by
Automerger Merge Worker
commit
84091e184a
@@ -36,6 +36,7 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.ArgumentMatchers.nullable;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.anyBoolean;
|
||||
import static org.mockito.Mockito.anyInt;
|
||||
@@ -213,7 +214,7 @@ public class ConnectivityManagerTest {
|
||||
|
||||
// register callback
|
||||
when(mService.requestNetwork(
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any()))
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
|
||||
.thenReturn(request);
|
||||
manager.requestNetwork(request, callback, handler);
|
||||
|
||||
@@ -242,7 +243,7 @@ public class ConnectivityManagerTest {
|
||||
|
||||
// register callback
|
||||
when(mService.requestNetwork(
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any()))
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
|
||||
.thenReturn(req1);
|
||||
manager.requestNetwork(req1, callback, handler);
|
||||
|
||||
@@ -261,7 +262,7 @@ public class ConnectivityManagerTest {
|
||||
|
||||
// callback can be registered again
|
||||
when(mService.requestNetwork(
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any()))
|
||||
any(), captor.capture(), anyInt(), any(), anyInt(), any(), nullable(String.class)))
|
||||
.thenReturn(req2);
|
||||
manager.requestNetwork(req2, callback, handler);
|
||||
|
||||
@@ -285,8 +286,8 @@ public class ConnectivityManagerTest {
|
||||
info.targetSdkVersion = VERSION_CODES.N_MR1 + 1;
|
||||
|
||||
when(mCtx.getApplicationInfo()).thenReturn(info);
|
||||
when(mService.requestNetwork(any(), any(), anyInt(), any(), anyInt(), any()))
|
||||
.thenReturn(request);
|
||||
when(mService.requestNetwork(any(), any(), anyInt(), any(), anyInt(), any(),
|
||||
nullable(String.class))).thenReturn(request);
|
||||
|
||||
Handler handler = new Handler(Looper.getMainLooper());
|
||||
manager.requestNetwork(request, callback, handler);
|
||||
|
||||
@@ -3049,6 +3049,13 @@ public class ConnectivityServiceTest {
|
||||
assertNoCallbacks(cEmpty1, cEmpty2, cEmpty3, cEmpty4, cFoo, cBar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the context's attribution tag
|
||||
*/
|
||||
private String getAttributionTag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInvalidNetworkSpecifier() {
|
||||
assertThrows(IllegalArgumentException.class, () -> {
|
||||
@@ -3061,7 +3068,8 @@ public class ConnectivityServiceTest {
|
||||
networkCapabilities.addTransportType(TRANSPORT_WIFI)
|
||||
.setNetworkSpecifier(new MatchAllNetworkSpecifier());
|
||||
mService.requestNetwork(networkCapabilities, null, 0, null,
|
||||
ConnectivityManager.TYPE_WIFI, mContext.getPackageName());
|
||||
ConnectivityManager.TYPE_WIFI, mContext.getPackageName(),
|
||||
getAttributionTag());
|
||||
});
|
||||
|
||||
class NonParcelableSpecifier extends NetworkSpecifier {
|
||||
|
||||
Reference in New Issue
Block a user