Merge "Add a public test method to reset package version"
This commit is contained in:
commit
779cba3698
2 changed files with 6 additions and 2 deletions
|
|
@ -36,7 +36,11 @@ public final class DeviceConfigUtils {
|
|||
private static final String TAG = DeviceConfigUtils.class.getSimpleName();
|
||||
|
||||
@VisibleForTesting
|
||||
protected static volatile long sPackageVersion = -1;
|
||||
public static void resetPackageVersionCacheForTest() {
|
||||
sPackageVersion = -1;
|
||||
}
|
||||
|
||||
private static volatile long sPackageVersion = -1;
|
||||
private static long getPackageVersion(@NonNull final Context context)
|
||||
throws PackageManager.NameNotFoundException {
|
||||
// sPackageVersion may be set by another thread just after this check, but querying the
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class DeviceConfigUtilsTest {
|
|||
@After
|
||||
public void tearDown() {
|
||||
mSession.finishMocking();
|
||||
DeviceConfigUtils.sPackageVersion = -1L;
|
||||
DeviceConfigUtils.resetPackageVersionCacheForTest();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
Loading…
Reference in a new issue