Commit e5553504 authored by Marc Treib's avatar Marc Treib Committed by Chromium LUCI CQ

Rename isSyncActive to isSyncFeatureActive in ProfileSyncService.java

This aligns the name with the native SyncService.

Also rename SyncTestUtil.isSyncActive()/waitForSyncActive() to
isSyncFeatureActive()/waitForSyncFeatureActive() for consistency.

Bug: 985290
Change-Id: I6383e8bd6bdf3b0767fdd7f5e3c3c4b49292d82d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2644938
Commit-Queue: Marc Treib <treib@chromium.org>
Reviewed-by: default avatarVictor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/master@{#846133}
parent cfedc527
...@@ -163,8 +163,8 @@ public class ProfileSyncService { ...@@ -163,8 +163,8 @@ public class ProfileSyncService {
* *
* @return true if Sync is active, false otherwise. * @return true if Sync is active, false otherwise.
*/ */
public boolean isSyncActive() { public boolean isSyncFeatureActive() {
return ProfileSyncServiceJni.get().isSyncActive( return ProfileSyncServiceJni.get().isSyncFeatureActive(
mNativeProfileSyncServiceAndroid, ProfileSyncService.this); mNativeProfileSyncServiceAndroid, ProfileSyncService.this);
} }
...@@ -729,7 +729,8 @@ public class ProfileSyncService { ...@@ -729,7 +729,8 @@ public class ProfileSyncService {
boolean isSyncRequested(long nativeProfileSyncServiceAndroid, ProfileSyncService caller); boolean isSyncRequested(long nativeProfileSyncServiceAndroid, ProfileSyncService caller);
boolean canSyncFeatureStart( boolean canSyncFeatureStart(
long nativeProfileSyncServiceAndroid, ProfileSyncService caller); long nativeProfileSyncServiceAndroid, ProfileSyncService caller);
boolean isSyncActive(long nativeProfileSyncServiceAndroid, ProfileSyncService caller); boolean isSyncFeatureActive(
long nativeProfileSyncServiceAndroid, ProfileSyncService caller);
boolean isSyncDisabledByEnterprisePolicy( boolean isSyncDisabledByEnterprisePolicy(
long nativeProfileSyncServiceAndroid, ProfileSyncService caller); long nativeProfileSyncServiceAndroid, ProfileSyncService caller);
boolean hasKeepEverythingSynced( boolean hasKeepEverythingSynced(
......
...@@ -233,7 +233,7 @@ public class SyncSettingsUtils { ...@@ -233,7 +233,7 @@ public class SyncSettingsUtils {
: context.getString(R.string.sync_is_disabled); : context.getString(R.string.sync_is_disabled);
} }
if (!profileSyncService.isSyncActive()) { if (!profileSyncService.isSyncFeatureActive()) {
return context.getString(R.string.sync_setup_progress); return context.getString(R.string.sync_setup_progress);
} }
......
...@@ -108,7 +108,7 @@ import java.io.IOException; ...@@ -108,7 +108,7 @@ import java.io.IOException;
Assert.assertEquals("InfoBar should not be shown before signing in", 0, Assert.assertEquals("InfoBar should not be shown before signing in", 0,
mSyncTestRule.getInfoBars().size()); mSyncTestRule.getInfoBars().size());
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
mFakeProfileSyncService.setEngineInitialized(true); mFakeProfileSyncService.setEngineInitialized(true);
mFakeProfileSyncService.setAuthError(GoogleServiceAuthError.State.NONE); mFakeProfileSyncService.setAuthError(GoogleServiceAuthError.State.NONE);
mFakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(false); mFakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(false);
......
...@@ -186,7 +186,7 @@ public class MainSettingsFragmentTest { ...@@ -186,7 +186,7 @@ public class MainSettingsFragmentTest {
// Sign in and render changes. // Sign in and render changes.
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
mRenderTestRule.render(view, "main_settings_signed_in"); mRenderTestRule.render(view, "main_settings_signed_in");
} }
...@@ -214,7 +214,7 @@ public class MainSettingsFragmentTest { ...@@ -214,7 +214,7 @@ public class MainSettingsFragmentTest {
// Sign in and render changes. // Sign in and render changes.
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
mRenderTestRule.render(view, "main_settings_signed_in_mobile_identity_consistency"); mRenderTestRule.render(view, "main_settings_signed_in_mobile_identity_consistency");
} }
...@@ -234,7 +234,7 @@ public class MainSettingsFragmentTest { ...@@ -234,7 +234,7 @@ public class MainSettingsFragmentTest {
// Sign in and render changes. // Sign in and render changes.
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
mRenderTestRule.render(view, "main_settings_signed_in_safety_check"); mRenderTestRule.render(view, "main_settings_signed_in_safety_check");
} }
...@@ -264,7 +264,7 @@ public class MainSettingsFragmentTest { ...@@ -264,7 +264,7 @@ public class MainSettingsFragmentTest {
// Sign in and render changes. // Sign in and render changes.
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
mRenderTestRule.render( mRenderTestRule.render(
view, "main_settings_signed_in_safety_check_mobile_identity_consistency"); view, "main_settings_signed_in_safety_check_mobile_identity_consistency");
} }
...@@ -456,7 +456,7 @@ public class MainSettingsFragmentTest { ...@@ -456,7 +456,7 @@ public class MainSettingsFragmentTest {
// SignIn to see the changes // SignIn to see the changes
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SignInPreference signInPreference = SignInPreference signInPreference =
(SignInPreference) assertSettingsExists(MainSettings.PREF_SIGN_IN, null); (SignInPreference) assertSettingsExists(MainSettings.PREF_SIGN_IN, null);
Assert.assertEquals("SignInPreference should be at the signed in state. ", Assert.assertEquals("SignInPreference should be at the signed in state. ",
...@@ -487,7 +487,7 @@ public class MainSettingsFragmentTest { ...@@ -487,7 +487,7 @@ public class MainSettingsFragmentTest {
// SignIn to see the changes // SignIn to see the changes
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SignInPreference signInPreference = SignInPreference signInPreference =
(SignInPreference) assertSettingsExists(MainSettings.PREF_SIGN_IN, null); (SignInPreference) assertSettingsExists(MainSettings.PREF_SIGN_IN, null);
Assert.assertEquals("SignInPreference should be at the signed in state. ", Assert.assertEquals("SignInPreference should be at the signed in state. ",
......
...@@ -146,7 +146,7 @@ public class FirstRunTest { ...@@ -146,7 +146,7 @@ public class FirstRunTest {
processFirstRun(testAccountInfo.getEmail(), false /* ShowSettings */); processFirstRun(testAccountInfo.getEmail(), false /* ShowSettings */);
Assert.assertEquals(testAccountInfo, mSyncTestRule.getCurrentSignedInAccount()); Assert.assertEquals(testAccountInfo, mSyncTestRule.getCurrentSignedInAccount());
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
// Test that signing in and opening settings through FirstRun signs in and doesn't fully start // Test that signing in and opening settings through FirstRun signs in and doesn't fully start
...@@ -166,7 +166,7 @@ public class FirstRunTest { ...@@ -166,7 +166,7 @@ public class FirstRunTest {
// become fully active until the settings page is closed. // become fully active until the settings page is closed.
Assert.assertEquals(testAccountInfo, mSyncTestRule.getCurrentSignedInAccount()); Assert.assertEquals(testAccountInfo, mSyncTestRule.getCurrentSignedInAccount());
SyncTestUtil.waitForEngineInitialized(); SyncTestUtil.waitForEngineInitialized();
Assert.assertFalse(SyncTestUtil.isSyncActive()); Assert.assertFalse(SyncTestUtil.isSyncFeatureActive());
// Close the settings fragment. // Close the settings fragment.
AccountManagementFragment fragment = AccountManagementFragment fragment =
...@@ -175,7 +175,7 @@ public class FirstRunTest { ...@@ -175,7 +175,7 @@ public class FirstRunTest {
settingsActivity.getSupportFragmentManager().beginTransaction().remove(fragment).commit(); settingsActivity.getSupportFragmentManager().beginTransaction().remove(fragment).commit();
// Sync should immediately become active. // Sync should immediately become active.
Assert.assertTrue(SyncTestUtil.isSyncActive()); Assert.assertTrue(SyncTestUtil.isSyncFeatureActive());
} }
// Test that not signing in through FirstRun does not sign in sync. // Test that not signing in through FirstRun does not sign in sync.
......
...@@ -109,7 +109,7 @@ public class ManageSyncSettingsTest { ...@@ -109,7 +109,7 @@ public class ManageSyncSettingsTest {
@Feature({"Sync"}) @Feature({"Sync"})
public void testSyncEverythingAndDataTypes() { public void testSyncEverythingAndDataTypes() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
ManageSyncSettings fragment = startManageSyncPreferences(); ManageSyncSettings fragment = startManageSyncPreferences();
ChromeSwitchPreference syncEverything = getSyncEverything(fragment); ChromeSwitchPreference syncEverything = getSyncEverything(fragment);
Collection<CheckBoxPreference> dataTypes = getDataTypes(fragment).values(); Collection<CheckBoxPreference> dataTypes = getDataTypes(fragment).values();
...@@ -129,7 +129,7 @@ public class ManageSyncSettingsTest { ...@@ -129,7 +129,7 @@ public class ManageSyncSettingsTest {
@Feature({"Sync"}) @Feature({"Sync"})
public void testSettingDataTypes() { public void testSettingDataTypes() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
ManageSyncSettings fragment = startManageSyncPreferences(); ManageSyncSettings fragment = startManageSyncPreferences();
ChromeSwitchPreference syncEverything = getSyncEverything(fragment); ChromeSwitchPreference syncEverything = getSyncEverything(fragment);
Map<Integer, CheckBoxPreference> dataTypes = getDataTypes(fragment); Map<Integer, CheckBoxPreference> dataTypes = getDataTypes(fragment);
...@@ -162,7 +162,7 @@ public class ManageSyncSettingsTest { ...@@ -162,7 +162,7 @@ public class ManageSyncSettingsTest {
@Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
public void testUnsettingAllDataTypesStopsSync() { public void testUnsettingAllDataTypesStopsSync() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
ManageSyncSettings fragment = startManageSyncPreferences(); ManageSyncSettings fragment = startManageSyncPreferences();
assertSyncOnState(fragment); assertSyncOnState(fragment);
...@@ -418,7 +418,7 @@ public class ManageSyncSettingsTest { ...@@ -418,7 +418,7 @@ public class ManageSyncSettingsTest {
@Feature({"Sync"}) @Feature({"Sync"})
public void testChoosePassphraseTypeWhenSyncIsOff() { public void testChoosePassphraseTypeWhenSyncIsOff() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
ManageSyncSettings fragment = startManageSyncPreferences(); ManageSyncSettings fragment = startManageSyncPreferences();
Preference encryption = getEncryption(fragment); Preference encryption = getEncryption(fragment);
clickPreference(encryption); clickPreference(encryption);
...@@ -439,7 +439,7 @@ public class ManageSyncSettingsTest { ...@@ -439,7 +439,7 @@ public class ManageSyncSettingsTest {
@Feature({"Sync"}) @Feature({"Sync"})
public void testEnterPassphraseWhenSyncIsOff() { public void testEnterPassphraseWhenSyncIsOff() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
final ManageSyncSettings fragment = startManageSyncPreferences(); final ManageSyncSettings fragment = startManageSyncPreferences();
mSyncTestRule.stopSync(); mSyncTestRule.stopSync();
TestThreadUtils.runOnUiThreadBlockingNoException( TestThreadUtils.runOnUiThreadBlockingNoException(
...@@ -452,7 +452,7 @@ public class ManageSyncSettingsTest { ...@@ -452,7 +452,7 @@ public class ManageSyncSettingsTest {
@Feature({"Sync"}) @Feature({"Sync"})
public void testPassphraseCreation() { public void testPassphraseCreation() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
final ManageSyncSettings fragment = startManageSyncPreferences(); final ManageSyncSettings fragment = startManageSyncPreferences();
TestThreadUtils.runOnUiThreadBlocking( TestThreadUtils.runOnUiThreadBlocking(
() -> fragment.onPassphraseTypeSelected(PassphraseType.CUSTOM_PASSPHRASE)); () -> fragment.onPassphraseTypeSelected(PassphraseType.CUSTOM_PASSPHRASE));
...@@ -551,7 +551,7 @@ public class ManageSyncSettingsTest { ...@@ -551,7 +551,7 @@ public class ManageSyncSettingsTest {
@Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
public void testAdvancedSyncFlowPreferencesAndBottomBarShown() { public void testAdvancedSyncFlowPreferencesAndBottomBarShown() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow(); final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow();
Assert.assertTrue( Assert.assertTrue(
fragment.findPreference(ManageSyncSettings.PREF_SYNCING_CATEGORY).isVisible()); fragment.findPreference(ManageSyncSettings.PREF_SYNCING_CATEGORY).isVisible());
...@@ -568,7 +568,7 @@ public class ManageSyncSettingsTest { ...@@ -568,7 +568,7 @@ public class ManageSyncSettingsTest {
@Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
public void testAdvancedSyncFlowTopView() throws Exception { public void testAdvancedSyncFlowTopView() throws Exception {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow(); final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow();
InstrumentationRegistry.getInstrumentation().waitForIdleSync(); InstrumentationRegistry.getInstrumentation().waitForIdleSync();
mRenderTestRule.render(fragment.getView(), "advanced_sync_flow_top_view"); mRenderTestRule.render(fragment.getView(), "advanced_sync_flow_top_view");
...@@ -580,7 +580,7 @@ public class ManageSyncSettingsTest { ...@@ -580,7 +580,7 @@ public class ManageSyncSettingsTest {
@Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)
public void testAdvancedSyncFlowBottomView() throws Exception { public void testAdvancedSyncFlowBottomView() throws Exception {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow(); final ManageSyncSettings fragment = startManageSyncPreferencesFromSyncConsentFlow();
TestThreadUtils.runOnUiThreadBlocking(() -> { TestThreadUtils.runOnUiThreadBlocking(() -> {
RecyclerView recyclerView = fragment.getView().findViewById(R.id.recycler_view); RecyclerView recyclerView = fragment.getView().findViewById(R.id.recycler_view);
......
...@@ -59,7 +59,7 @@ public class ManageSyncSettingsWithFakeProfileSyncServiceTest { ...@@ -59,7 +59,7 @@ public class ManageSyncSettingsWithFakeProfileSyncServiceTest {
(FakeProfileSyncService) mSyncTestRule.getProfileSyncService(); (FakeProfileSyncService) mSyncTestRule.getProfileSyncService();
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
// Trigger PassphraseDialogFragment to be shown when taping on Encryption. // Trigger PassphraseDialogFragment to be shown when taping on Encryption.
fakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(true); fakeProfileSyncService.setPassphraseRequiredForPreferredDataTypes(true);
......
...@@ -64,7 +64,7 @@ public class SyncAndServicesSettingsTest { ...@@ -64,7 +64,7 @@ public class SyncAndServicesSettingsTest {
@Feature({"Sync", "Preferences"}) @Feature({"Sync", "Preferences"})
public void testSyncSwitch() { public void testSyncSwitch() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SyncAndServicesSettings fragment = startSyncAndServicesPreferences(); SyncAndServicesSettings fragment = startSyncAndServicesPreferences();
final ChromeSwitchPreference syncSwitch = getSyncSwitch(fragment); final ChromeSwitchPreference syncSwitch = getSyncSwitch(fragment);
...@@ -125,7 +125,7 @@ public class SyncAndServicesSettingsTest { ...@@ -125,7 +125,7 @@ public class SyncAndServicesSettingsTest {
@Feature({"Sync", "Preferences"}) @Feature({"Sync", "Preferences"})
public void testDefaultControlStatesWithSyncOnThenOff() { public void testDefaultControlStatesWithSyncOnThenOff() {
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SyncAndServicesSettings fragment = startSyncAndServicesPreferences(); SyncAndServicesSettings fragment = startSyncAndServicesPreferences();
assertSyncOnState(fragment); assertSyncOnState(fragment);
mSyncTestRule.togglePreference(getSyncSwitch(fragment)); mSyncTestRule.togglePreference(getSyncSwitch(fragment));
......
...@@ -45,7 +45,7 @@ public class SyncAndServicesSettingsWithFakeProfileSyncServiceTest { ...@@ -45,7 +45,7 @@ public class SyncAndServicesSettingsWithFakeProfileSyncServiceTest {
FakeProfileSyncService fakeProfileSyncService = FakeProfileSyncService fakeProfileSyncService =
(FakeProfileSyncService) mSyncTestRule.getProfileSyncService(); (FakeProfileSyncService) mSyncTestRule.getProfileSyncService();
mSyncTestRule.setUpAccountAndEnableSyncForTesting(); mSyncTestRule.setUpAccountAndEnableSyncForTesting();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
fakeProfileSyncService.setEngineInitialized(true); fakeProfileSyncService.setEngineInitialized(true);
fakeProfileSyncService.setTrustedVaultKeyRequiredForPreferredDataTypes(true); fakeProfileSyncService.setTrustedVaultKeyRequiredForPreferredDataTypes(true);
......
...@@ -59,7 +59,7 @@ public class SyncTest { ...@@ -59,7 +59,7 @@ public class SyncTest {
// Signing back in should re-enable sync. // Signing back in should re-enable sync.
mSyncTestRule.signinAndEnableSync(accountInfo); mSyncTestRule.signinAndEnableSync(accountInfo);
Assert.assertTrue("Sync should be re-enabled.", SyncTestUtil.isSyncActive()); Assert.assertTrue("Sync should be re-enabled.", SyncTestUtil.isSyncFeatureActive());
} }
@Test @Test
...@@ -132,7 +132,7 @@ public class SyncTest { ...@@ -132,7 +132,7 @@ public class SyncTest {
Criteria.checkThat(mSyncTestRule.getCurrentSignedInAccount().getEmail(), Criteria.checkThat(mSyncTestRule.getCurrentSignedInAccount().getEmail(),
Matchers.is(newAccount.name)); Matchers.is(newAccount.name));
}); });
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
@Test @Test
...@@ -166,7 +166,7 @@ public class SyncTest { ...@@ -166,7 +166,7 @@ public class SyncTest {
// Enabling Android sync should turn Chrome sync engine on. // Enabling Android sync should turn Chrome sync engine on.
mSyncTestRule.getSyncContentResolver().setSyncAutomatically(account, authority, true); mSyncTestRule.getSyncContentResolver().setSyncAutomatically(account, authority, true);
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
@Test @Test
...@@ -187,7 +187,7 @@ public class SyncTest { ...@@ -187,7 +187,7 @@ public class SyncTest {
// Enabling Android's master sync should turn Chrome sync engine on. // Enabling Android's master sync should turn Chrome sync engine on.
mSyncTestRule.getSyncContentResolver().setMasterSyncAutomatically(true); mSyncTestRule.getSyncContentResolver().setMasterSyncAutomatically(true);
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
@Test @Test
...@@ -223,7 +223,7 @@ public class SyncTest { ...@@ -223,7 +223,7 @@ public class SyncTest {
// But then re-enabling Chrome sync should. // But then re-enabling Chrome sync should.
mSyncTestRule.getSyncContentResolver().setSyncAutomatically(account, authority, true); mSyncTestRule.getSyncContentResolver().setSyncAutomatically(account, authority, true);
Assert.assertTrue(SyncTestUtil.canSyncFeatureStart()); Assert.assertTrue(SyncTestUtil.canSyncFeatureStart());
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
@Test @Test
...@@ -258,7 +258,7 @@ public class SyncTest { ...@@ -258,7 +258,7 @@ public class SyncTest {
// But then re-enabling master sync should. // But then re-enabling master sync should.
mSyncTestRule.getSyncContentResolver().setMasterSyncAutomatically(true); mSyncTestRule.getSyncContentResolver().setMasterSyncAutomatically(true);
Assert.assertTrue(SyncTestUtil.canSyncFeatureStart()); Assert.assertTrue(SyncTestUtil.canSyncFeatureStart());
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
@Test @Test
......
...@@ -207,7 +207,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule { ...@@ -207,7 +207,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule {
mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mProfileSyncService); mAccountManagerTestRule.addTestAccountThenSigninAndEnableSync(mProfileSyncService);
// Enable UKM when enabling sync as it is done by the sync confirmation UI. // Enable UKM when enabling sync as it is done by the sync confirmation UI.
enableUKM(); enableUKM();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SyncTestUtil.triggerSyncAndWaitForCompletion(); SyncTestUtil.triggerSyncAndWaitForCompletion();
return accountInfo; return accountInfo;
} }
...@@ -240,7 +240,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule { ...@@ -240,7 +240,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule {
public void startSyncAndWait() { public void startSyncAndWait() {
startSync(); startSync();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
} }
public void stopSync() { public void stopSync() {
...@@ -253,7 +253,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule { ...@@ -253,7 +253,7 @@ public class SyncTestRule extends ChromeTabbedActivityTestRule {
SigninTestUtil.signinAndEnableSync(accountInfo, mProfileSyncService); SigninTestUtil.signinAndEnableSync(accountInfo, mProfileSyncService);
// Enable UKM when enabling sync as it is done by the sync confirmation UI. // Enable UKM when enabling sync as it is done by the sync confirmation UI.
enableUKM(); enableUKM();
SyncTestUtil.waitForSyncActive(); SyncTestUtil.waitForSyncFeatureActive();
SyncTestUtil.triggerSyncAndWaitForCompletion(); SyncTestUtil.triggerSyncAndWaitForCompletion();
} }
......
...@@ -151,7 +151,7 @@ void ProfileSyncServiceAndroid::SetSyncAllowedByPlatform( ...@@ -151,7 +151,7 @@ void ProfileSyncServiceAndroid::SetSyncAllowedByPlatform(
sync_service_->GetUserSettings()->SetSyncAllowedByPlatform(allowed); sync_service_->GetUserSettings()->SetSyncAllowedByPlatform(allowed);
} }
jboolean ProfileSyncServiceAndroid::IsSyncActive( jboolean ProfileSyncServiceAndroid::IsSyncFeatureActive(
JNIEnv* env, JNIEnv* env,
const JavaParamRef<jobject>& obj) { const JavaParamRef<jobject>& obj) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
......
...@@ -50,8 +50,8 @@ class ProfileSyncServiceAndroid : public syncer::SyncServiceObserver { ...@@ -50,8 +50,8 @@ class ProfileSyncServiceAndroid : public syncer::SyncServiceObserver {
void SetSyncAllowedByPlatform(JNIEnv* env, void SetSyncAllowedByPlatform(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& obj,
jboolean allowed); jboolean allowed);
jboolean IsSyncActive(JNIEnv* env, jboolean IsSyncFeatureActive(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj); const base::android::JavaParamRef<jobject>& obj);
jboolean IsSyncDisabledByEnterprisePolicy( jboolean IsSyncDisabledByEnterprisePolicy(
JNIEnv* env, JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj); const base::android::JavaParamRef<jobject>& obj);
......
...@@ -61,23 +61,23 @@ public final class SyncTestUtil { ...@@ -61,23 +61,23 @@ public final class SyncTestUtil {
} }
/** /**
* Returns whether sync is active. * Returns whether sync-the-feature is active.
*/ */
public static boolean isSyncActive() { public static boolean isSyncFeatureActive() {
return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() { return TestThreadUtils.runOnUiThreadBlockingNoException(new Callable<Boolean>() {
@Override @Override
public Boolean call() { public Boolean call() {
return ProfileSyncService.get().isSyncActive(); return ProfileSyncService.get().isSyncFeatureActive();
} }
}); });
} }
/** /**
* Waits for sync to become active. * Waits for sync-the-feature to become active.
*/ */
public static void waitForSyncActive() { public static void waitForSyncFeatureActive() {
CriteriaHelper.pollUiThread(() CriteriaHelper.pollUiThread(()
-> ProfileSyncService.get().isSyncActive(), -> ProfileSyncService.get().isSyncFeatureActive(),
"Timed out waiting for sync to become active.", TIMEOUT_MS, INTERVAL_MS); "Timed out waiting for sync to become active.", TIMEOUT_MS, INTERVAL_MS);
} }
......
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