Fix UnfinishedStubbingException when running testAutomotiveEthernetAllowedUids
Mocking the PackageManager while ConnectivityService is running could throw an UnfinishedStubbingException. This change splits the test into two distinct tests that don't need to change the mocking value for PackageManager during testing. Fix: 433600031 Test: atest ConnectivityServiceTest Flag: TEST_ONLY Change-Id: Ibcff2082d1e50e89c272573b4c719a7325c959fd
This commit is contained in:
parent
a383882f7c
commit
e4e65d7b48
1 changed files with 8 additions and 2 deletions
|
|
@ -17801,12 +17801,18 @@ public class ConnectivityServiceTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testAutomotiveEthernetAllowedUids() throws Exception {
|
||||
public void testAutomotiveEthernetAllowedUids_withAutoFeature() throws Exception {
|
||||
mServiceContext.setPermission(NETWORK_FACTORY, PERMISSION_GRANTED);
|
||||
mServiceContext.setPermission(MANAGE_TEST_NETWORKS, PERMISSION_GRANTED);
|
||||
|
||||
// Has automotive feature.
|
||||
validateAutomotiveEthernetAllowedUids(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutomotiveEthernetAllowedUids_withoutAutoFeature() throws Exception {
|
||||
mServiceContext.setPermission(NETWORK_FACTORY, PERMISSION_GRANTED);
|
||||
mServiceContext.setPermission(MANAGE_TEST_NETWORKS, PERMISSION_GRANTED);
|
||||
|
||||
// No automotive feature.
|
||||
validateAutomotiveEthernetAllowedUids(false);
|
||||
|
|
@ -19347,7 +19353,7 @@ public class ConnectivityServiceTest {
|
|||
verifyClatdStop(null /* inOrder */, MOBILE_IFNAME);
|
||||
}
|
||||
|
||||
private static final int EXPECTED_TEST_METHOD_COUNT = 332;
|
||||
private static final int EXPECTED_TEST_METHOD_COUNT = 333;
|
||||
|
||||
@Test
|
||||
public void testTestMethodCount() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue