| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.sync; | 5 package org.chromium.chrome.browser.sync; |
| 6 | 6 |
| 7 import android.accounts.Account; | 7 import android.accounts.Account; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.test.suitebuilder.annotation.LargeTest; | 9 import android.test.suitebuilder.annotation.LargeTest; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| 11 | 11 |
| 12 import org.chromium.base.ActivityState; | 12 import org.chromium.base.ActivityState; |
| 13 import org.chromium.base.ApplicationStatus; | 13 import org.chromium.base.ApplicationStatus; |
| 14 import org.chromium.base.test.util.Feature; | 14 import org.chromium.base.test.util.Feature; |
| 15 import org.chromium.chrome.shell.ChromeShellActivity; | 15 import org.chromium.chrome.browser.ChromeActivity; |
| 16 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; | 16 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; |
| 17 import org.chromium.content.browser.ContentViewCore; | 17 import org.chromium.content.browser.ContentViewCore; |
| 18 import org.chromium.content.browser.test.util.Criteria; | 18 import org.chromium.content.browser.test.util.Criteria; |
| 19 import org.chromium.content.browser.test.util.CriteriaHelper; | 19 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 20 import org.chromium.content.browser.test.util.JavaScriptUtils; | 20 import org.chromium.content.browser.test.util.JavaScriptUtils; |
| 21 import org.chromium.sync.AndroidSyncSettings; | 21 import org.chromium.sync.AndroidSyncSettings; |
| 22 import org.chromium.sync.signin.AccountManagerHelper; | 22 import org.chromium.sync.signin.AccountManagerHelper; |
| 23 import org.chromium.sync.signin.ChromeSigninController; | 23 import org.chromium.sync.signin.ChromeSigninController; |
| 24 | 24 |
| 25 import java.util.concurrent.TimeoutException; | 25 import java.util.concurrent.TimeoutException; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 }); | 73 }); |
| 74 | 74 |
| 75 // TODO(pvalenzuela): When available, check that sync is still functiona
l. | 75 // TODO(pvalenzuela): When available, check that sync is still functiona
l. |
| 76 } | 76 } |
| 77 | 77 |
| 78 @LargeTest | 78 @LargeTest |
| 79 @Feature({"Sync"}) | 79 @Feature({"Sync"}) |
| 80 public void testAboutSyncPageDisplaysCurrentSyncStatus() throws InterruptedE
xception { | 80 public void testAboutSyncPageDisplaysCurrentSyncStatus() throws InterruptedE
xception { |
| 81 setupTestAccountAndSignInToSync(CLIENT_ID); | 81 setupTestAccountAndSignInToSync(CLIENT_ID); |
| 82 | 82 |
| 83 loadUrlWithSanitization("chrome://sync"); | 83 loadUrl("chrome://sync"); |
| 84 SyncTestUtil.AboutSyncInfoGetter aboutInfoGetter = | 84 SyncTestUtil.AboutSyncInfoGetter aboutInfoGetter = |
| 85 new SyncTestUtil.AboutSyncInfoGetter(getActivity()); | 85 new SyncTestUtil.AboutSyncInfoGetter(getActivity()); |
| 86 try { | 86 try { |
| 87 runTestOnUiThread(aboutInfoGetter); | 87 runTestOnUiThread(aboutInfoGetter); |
| 88 } catch (Throwable t) { | 88 } catch (Throwable t) { |
| 89 Log.w(TAG, | 89 Log.w(TAG, |
| 90 "Exception while trying to fetch about sync info from Profil
eSyncService.", t); | 90 "Exception while trying to fetch about sync info from Profil
eSyncService.", t); |
| 91 fail("Unable to fetch sync info from ProfileSyncService."); | 91 fail("Unable to fetch sync info from ProfileSyncService."); |
| 92 } | 92 } |
| 93 assertFalse("About sync info should not be empty.", | 93 assertFalse("About sync info should not be empty.", |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 162 |
| 163 // Disabling Android sync should turn Chrome sync engine off. | 163 // Disabling Android sync should turn Chrome sync engine off. |
| 164 mSyncContentResolver.setSyncAutomatically(account, authority, false); | 164 mSyncContentResolver.setSyncAutomatically(account, authority, false); |
| 165 SyncTestUtil.verifySyncIsDisabled(mContext, account); | 165 SyncTestUtil.verifySyncIsDisabled(mContext, account); |
| 166 | 166 |
| 167 // Enabling Android sync should turn Chrome sync engine on. | 167 // Enabling Android sync should turn Chrome sync engine on. |
| 168 mSyncContentResolver.setSyncAutomatically(account, authority, true); | 168 mSyncContentResolver.setSyncAutomatically(account, authority, true); |
| 169 SyncTestUtil.verifySyncIsActiveForAccount(mContext, account); | 169 SyncTestUtil.verifySyncIsActiveForAccount(mContext, account); |
| 170 } | 170 } |
| 171 | 171 |
| 172 private static ContentViewCore getContentViewCore(ChromeShellActivity activi
ty) { | 172 private static ContentViewCore getContentViewCore(ChromeActivity activity) { |
| 173 return activity.getActiveContentViewCore(); | 173 return activity.getActivityTab().getContentViewCore(); |
| 174 } | 174 } |
| 175 } | 175 } |
| OLD | NEW |