summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Pape <mpape@google.com> 2019-10-28 09:25:17 -0700
committer Matt Pape <mpape@google.com> 2019-10-28 09:27:39 -0700
commitfe3a9024e28b355a8cf7cc6aa0c3089b1fac7d4b (patch)
treeb818532ed026a4f665a973d2566169ea2769b829
parent245edfe76d482fc1f82d0e6465c74bdf96a9a472 (diff)
Temporarily disable DeviceConfigTest.testOnPropertiesChangedListener
This test is flaky in presubmit. Suppress until the root cause is fixed. Test: atest SettingsProviderTest:DeviceConfigServiceTest Bug: 142727848 Change-Id: I6cdf9a7a62bc2ed55639d12632a0981eb1378fcd
-rw-r--r--core/tests/coretests/src/android/provider/DeviceConfigTest.java52
1 files changed, 24 insertions, 28 deletions
diff --git a/core/tests/coretests/src/android/provider/DeviceConfigTest.java b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
index 77b7f2a3ce6c..1f2dfe0fa01c 100644
--- a/core/tests/coretests/src/android/provider/DeviceConfigTest.java
+++ b/core/tests/coretests/src/android/provider/DeviceConfigTest.java
@@ -16,12 +16,10 @@
package android.provider;
-import static android.provider.DeviceConfig.OnPropertiesChangedListener;
import static android.provider.DeviceConfig.Properties;
import static com.google.common.truth.Truth.assertThat;
-import android.app.ActivityThread;
import android.content.ContentResolver;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
@@ -35,9 +33,6 @@ import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/** Tests that ensure appropriate settings are backed up. */
@Presubmit
@RunWith(AndroidJUnit4.class)
@@ -482,29 +477,30 @@ public class DeviceConfigTest {
assertThat(properties.getString(KEY3, DEFAULT_VALUE)).isEqualTo(DEFAULT_VALUE);
}
- @Test
- public void testOnPropertiesChangedListener() throws InterruptedException {
- final CountDownLatch countDownLatch = new CountDownLatch(1);
-
- OnPropertiesChangedListener changeListener = (properties) -> {
- assertThat(properties.getNamespace()).isEqualTo(NAMESPACE);
- assertThat(properties.getKeyset()).contains(KEY);
- assertThat(properties.getString(KEY, "default_value")).isEqualTo(VALUE);
- countDownLatch.countDown();
- };
-
- try {
- DeviceConfig.addOnPropertiesChangedListener(NAMESPACE,
- ActivityThread.currentApplication().getMainExecutor(), changeListener);
- DeviceConfig.setProperty(NAMESPACE, KEY, VALUE, false);
- assertThat(countDownLatch.await(
- WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
- } catch (InterruptedException e) {
- Assert.fail(e.getMessage());
- } finally {
- DeviceConfig.removeOnPropertiesChangedListener(changeListener);
- }
- }
+ // TODO(mpape): resolve b/142727848 and re-enable this test
+// @Test
+// public void testOnPropertiesChangedListener() throws InterruptedException {
+// final CountDownLatch countDownLatch = new CountDownLatch(1);
+//
+// OnPropertiesChangedListener changeListener = (properties) -> {
+// assertThat(properties.getNamespace()).isEqualTo(NAMESPACE);
+// assertThat(properties.getKeyset()).contains(KEY);
+// assertThat(properties.getString(KEY, "default_value")).isEqualTo(VALUE);
+// countDownLatch.countDown();
+// };
+//
+// try {
+// DeviceConfig.addOnPropertiesChangedListener(NAMESPACE,
+// ActivityThread.currentApplication().getMainExecutor(), changeListener);
+// DeviceConfig.setProperty(NAMESPACE, KEY, VALUE, false);
+// assertThat(countDownLatch.await(
+// WAIT_FOR_PROPERTY_CHANGE_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS)).isTrue();
+// } catch (InterruptedException e) {
+// Assert.fail(e.getMessage());
+// } finally {
+// DeviceConfig.removeOnPropertiesChangedListener(changeListener);
+// }
+// }
private static boolean deleteViaContentProvider(String namespace, String key) {
ContentResolver resolver = InstrumentationRegistry.getContext().getContentResolver();