Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3395)

Unified Diff: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java

Issue 2833673003: 🔍 More consistent first run triggering (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
diff --git a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
index 917fe9487073ce3cdc6ef11355d865e1183feea1..6848a74eb67a15139efe85760ca9956ef3f6e7eb 100644
--- a/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
+++ b/chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/SyncTestBase.java
@@ -14,6 +14,7 @@ import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator;
import org.chromium.chrome.browser.signin.SigninManager;
import org.chromium.chrome.test.ChromeActivityTestCaseBase;
+import org.chromium.chrome.test.util.ApplicationTestUtils;
import org.chromium.chrome.test.util.browser.signin.SigninTestUtil;
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil;
import org.chromium.components.sync.AndroidSyncSettings;
@@ -84,6 +85,13 @@ public class SyncTestBase extends ChromeActivityTestCaseBase<ChromeActivity> {
@Override
protected void setUp() throws Exception {
+ // This must be called before doing anything with the SharedPreferences because
+ // super.setUp() normally wipes them clean between runs. Setting a SharedPreference here
+ // via the SigninTestUtil.setUpAuthForTest() call below causes Android to cache them before
+ // the files get cleared, meaning that a data clear is useless and test runs influence each
+ // other.
+ ApplicationTestUtils.clearAppData(getInstrumentation().getTargetContext());
+
// This must be called before super.setUp() in order for test authentication to work.
SigninTestUtil.setUpAuthForTest(getInstrumentation());
« no previous file with comments | « chrome/android/sync_shell/javatests/src/org/chromium/chrome/browser/sync/FirstRunTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698