Commit 06132710 authored by Marc Treib's avatar Marc Treib Committed by Commit Bot

Deflake InvalidationPreferencesTest

These tests are based on SharedPreferences, which previously weren't
reset between tests, causing the tests to start with incorrect
assumptions. This CL adds a setUp() that clears the preferences, and
removes the FlakyTest annotations.

Bug: 905233
Change-Id: Ib66b506811ae38335605498d9eeef9be89d9ef08
Reviewed-on: https://chromium-review.googlesource.com/c/1340817Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Marc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609277}
parent e2bfbf32
...@@ -10,14 +10,15 @@ import android.support.test.filters.SmallTest; ...@@ -10,14 +10,15 @@ import android.support.test.filters.SmallTest;
import com.google.ipc.invalidation.external.client.types.ObjectId; import com.google.ipc.invalidation.external.client.types.ObjectId;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.CollectionUtil; import org.chromium.base.CollectionUtil;
import org.chromium.base.ContextUtils;
import org.chromium.base.test.BaseJUnit4ClassRunner; import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.FlakyTest;
import org.chromium.base.test.util.RetryOnFailure; import org.chromium.base.test.util.RetryOnFailure;
import java.util.Arrays; import java.util.Arrays;
...@@ -31,8 +32,13 @@ import java.util.Set; ...@@ -31,8 +32,13 @@ import java.util.Set;
@RunWith(BaseJUnit4ClassRunner.class) @RunWith(BaseJUnit4ClassRunner.class)
@RetryOnFailure @RetryOnFailure
public class InvalidationPreferencesTest { public class InvalidationPreferencesTest {
@Before
public void setUp() {
// Make sure the SharedPreferences start out empty.
ContextUtils.getAppSharedPreferences().edit().clear().apply();
}
@Test @Test
@FlakyTest(message = "https://crbug.com/905233")
@SmallTest @SmallTest
@Feature({"Sync"}) @Feature({"Sync"})
public void testReadMissingData() { public void testReadMissingData() {
...@@ -47,7 +53,6 @@ public class InvalidationPreferencesTest { ...@@ -47,7 +53,6 @@ public class InvalidationPreferencesTest {
} }
@Test @Test
@FlakyTest(message = "https://crbug.com/905233")
@SmallTest @SmallTest
@Feature({"Sync"}) @Feature({"Sync"})
public void testReadWriteAndReadData() { public void testReadWriteAndReadData() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment