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 e5e3987ae93076e734722e3b66bf21e26e88a27f..24b7bc5f1a8ccaebe52410c588e7018c0f048503 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 |
@@ -8,13 +8,12 @@ |
import android.content.Context; |
import org.chromium.base.ThreadUtils; |
-import org.chromium.chrome.browser.ChromeActivity; |
import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator; |
import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory; |
import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerator; |
import org.chromium.chrome.browser.signin.AccountIdProvider; |
import org.chromium.chrome.browser.signin.SigninManager; |
-import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
+import org.chromium.chrome.shell.ChromeShellTestBase; |
import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; |
import org.chromium.sync.AndroidSyncSettings; |
import org.chromium.sync.signin.AccountManagerHelper; |
@@ -27,7 +26,7 @@ |
/** |
* Base class for common functionality between sync tests. |
*/ |
-public class SyncTestBase extends ChromeActivityTestCaseBase<ChromeActivity> { |
+public class SyncTestBase extends ChromeShellTestBase { |
private static final String TAG = "SyncTestBase"; |
protected static final String CLIENT_ID = "Client_ID"; |
@@ -39,33 +38,21 @@ |
protected ProfileSyncService mProfileSyncService; |
protected MockSyncContentResolverDelegate mSyncContentResolver; |
- public SyncTestBase() { |
- super(ChromeActivity.class); |
- } |
- |
- @Override |
- public void startMainActivity() throws InterruptedException { |
- // Start the activity by opening about:blank. This URL is ideal because it is not synced as |
- // a typed URL. If another URL is used, it could interfere with test data. |
- startMainActivityOnBlankPage(); |
- } |
- |
@Override |
protected void setUp() throws Exception { |
- // This must be called before super.setUp() in order for test authentication to work |
- // properly. |
- mapAccountNamesToIds(); |
- |
super.setUp(); |
+ assertTrue("Clearing app data failed.", clearAppData()); |
Context targetContext = getInstrumentation().getTargetContext(); |
mContext = new SyncTestUtil.SyncTestContext(targetContext); |
+ mapAccountNamesToIds(); |
setUpMockAndroidSyncSettings(); |
setUpMockAccountManager(); |
// Initializes ChromeSigninController to use our test context. |
ChromeSigninController.get(mContext); |
+ startChromeBrowserProcessSync(targetContext); |
ThreadUtils.runOnUiThreadBlocking(new Runnable() { |
@Override |
public void run() { |
@@ -82,6 +69,13 @@ |
mProfileSyncService = ProfileSyncService.get(mContext); |
} |
}); |
+ |
+ // Start the activity by opening about:blank. This URL is ideal because it is not synced as |
+ // a typed URL. If another URL is used, it could interfere with test data. This call is in |
+ // this location so that it takes place before any other calls to getActivity(). If |
+ // getActivity() is called without any prior configuration, an undesired URL |
+ // (e.g., google.com) will be opened. |
+ launchChromeShellWithBlankPage(); |
} |
@Override |