| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.FlakyTest; | |
| 10 import android.util.Log; | 9 import android.util.Log; |
| 11 | 10 |
| 12 import org.chromium.base.ThreadUtils; | 11 import org.chromium.base.ThreadUtils; |
| 13 import org.chromium.base.test.util.HostDrivenTest; | 12 import org.chromium.base.test.util.HostDrivenTest; |
| 14 import org.chromium.base.test.util.DisabledTest; | 13 import org.chromium.base.test.util.DisabledTest; |
| 15 import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator; | 14 import org.chromium.chrome.browser.identity.UniqueIdentificationGenerator; |
| 16 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory
; | 15 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory
; |
| 17 import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerat
or; | 16 import org.chromium.chrome.browser.identity.UuidBasedUniqueIdentificationGenerat
or; |
| 18 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; | 17 import org.chromium.chrome.test.util.browser.sync.SyncTestUtil; |
| 19 import org.chromium.chrome.testshell.ChromiumTestShellActivity; | 18 import org.chromium.chrome.testshell.ChromiumTestShellActivity; |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 } | 131 } |
| 133 | 132 |
| 134 }; | 133 }; |
| 135 boolean hadExpectedStatus = CriteriaHelper.pollForCriteria( | 134 boolean hadExpectedStatus = CriteriaHelper.pollForCriteria( |
| 136 checker, SyncTestUtil.UI_TIMEOUT_MS, SyncTestUtil.CHECK_INTERVAL
_MS); | 135 checker, SyncTestUtil.UI_TIMEOUT_MS, SyncTestUtil.CHECK_INTERVAL
_MS); |
| 137 assertTrue("Sync status not present on about sync page: " + expectedSync
Summary, | 136 assertTrue("Sync status not present on about sync page: " + expectedSync
Summary, |
| 138 hadExpectedStatus); | 137 hadExpectedStatus); |
| 139 } | 138 } |
| 140 | 139 |
| 141 @HostDrivenTest | 140 @HostDrivenTest |
| 142 /* http://crbug.com/311091 */ | |
| 143 @FlakyTest | |
| 144 public void testDisableAndEnableSync() throws InterruptedException { | 141 public void testDisableAndEnableSync() throws InterruptedException { |
| 145 setupTestAccountAndSignInToSync(FOREIGN_SESSION_TEST_MACHINE_ID); | 142 setupTestAccountAndSignInToSync(FOREIGN_SESSION_TEST_MACHINE_ID); |
| 146 Account account = | 143 Account account = |
| 147 AccountManagerHelper.createAccountFromName(SyncTestUtil.DEFAULT_
TEST_ACCOUNT); | 144 AccountManagerHelper.createAccountFromName(SyncTestUtil.DEFAULT_
TEST_ACCOUNT); |
| 148 | 145 |
| 149 // Disabling Android sync should turn Chrome sync engine off. | 146 // Disabling Android sync should turn Chrome sync engine off. |
| 150 SyncStatusHelper.get(mContext).disableAndroidSync(account); | 147 SyncStatusHelper.get(mContext).disableAndroidSync(account); |
| 151 SyncTestUtil.verifySyncIsDisabled(mContext, account); | 148 SyncTestUtil.verifySyncIsDisabled(mContext, account); |
| 152 | 149 |
| 153 // Enabling Android sync should turn Chrome sync engine on. | 150 // Enabling Android sync should turn Chrome sync engine on. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 assertTrue("Sync everything should be enabled", | 183 assertTrue("Sync everything should be enabled", |
| 187 SyncTestUtil.isSyncEverythingEnabled(mContext)); | 184 SyncTestUtil.isSyncEverythingEnabled(mContext)); |
| 188 } | 185 } |
| 189 | 186 |
| 190 private static ContentViewCore getContentViewCore(ChromiumTestShellActivity
activity) { | 187 private static ContentViewCore getContentViewCore(ChromiumTestShellActivity
activity) { |
| 191 ContentView contentView = activity.getActiveContentView(); | 188 ContentView contentView = activity.getActiveContentView(); |
| 192 if (contentView == null) return null; | 189 if (contentView == null) return null; |
| 193 return contentView.getContentViewCore(); | 190 return contentView.getContentViewCore(); |
| 194 } | 191 } |
| 195 } | 192 } |
| OLD | NEW |