Merge "Disable binder caches for unit tests" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9e92780857
@@ -35,6 +35,7 @@ import static org.junit.Assert.assertTrue;
|
|||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
|
import android.app.PropertyInvalidatedCache;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
@@ -91,6 +92,12 @@ public class PackageManagerSettingsTests {
|
|||||||
MockitoAnnotations.initMocks(this);
|
MockitoAnnotations.initMocks(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setup() {
|
||||||
|
// Disable binder caches in this process.
|
||||||
|
PropertyInvalidatedCache.disableForTestMode();
|
||||||
|
}
|
||||||
|
|
||||||
/** make sure our initialized KeySetManagerService metadata matches packages.xml */
|
/** make sure our initialized KeySetManagerService metadata matches packages.xml */
|
||||||
@Test
|
@Test
|
||||||
public void testReadKeySetSettings()
|
public void testReadKeySetSettings()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import static android.os.UserManager.USER_TYPE_PROFILE_MANAGED;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import android.app.PropertyInvalidatedCache;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.ServiceSpecificException;
|
import android.os.ServiceSpecificException;
|
||||||
@@ -60,6 +61,9 @@ public class UserManagerServiceCreateProfileTest {
|
|||||||
if (Looper.myLooper() == null) {
|
if (Looper.myLooper() == null) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
|
// Disable binder caches in this process.
|
||||||
|
PropertyInvalidatedCache.disableForTestMode();
|
||||||
|
|
||||||
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
||||||
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import android.app.PropertyInvalidatedCache;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.UserManagerInternal;
|
import android.os.UserManagerInternal;
|
||||||
@@ -57,6 +58,9 @@ public class UserManagerServiceIdRecyclingTest {
|
|||||||
if (Looper.myLooper() == null) {
|
if (Looper.myLooper() == null) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
|
// Disable binder caches in this process.
|
||||||
|
PropertyInvalidatedCache.disableForTestMode();
|
||||||
|
|
||||||
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
||||||
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
||||||
}
|
}
|
||||||
@@ -122,4 +126,3 @@ public class UserManagerServiceIdRecyclingTest {
|
|||||||
return new UserInfo(userId, "User " + userId, 0);
|
return new UserInfo(userId, "User " + userId, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import static org.junit.Assert.assertFalse;
|
|||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
|
import android.app.PropertyInvalidatedCache;
|
||||||
import android.content.pm.UserInfo;
|
import android.content.pm.UserInfo;
|
||||||
import android.content.pm.UserInfo.UserInfoFlag;
|
import android.content.pm.UserInfo.UserInfoFlag;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
@@ -78,6 +79,9 @@ public class UserManagerServiceUserInfoTest {
|
|||||||
if (Looper.myLooper() == null) {
|
if (Looper.myLooper() == null) {
|
||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
}
|
}
|
||||||
|
// Disable binder caches in this process.
|
||||||
|
PropertyInvalidatedCache.disableForTestMode();
|
||||||
|
|
||||||
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
LocalServices.removeServiceForTest(UserManagerInternal.class);
|
||||||
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
mUserManagerService = new UserManagerService(InstrumentationRegistry.getContext());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user