Commit 140cf0d9 authored by akalin@chromium.org's avatar akalin@chromium.org

[Sync] Make P2PNotifier emit a notification only if some enabled types changed

Relaxed some integrations tests that failed because of this.  A client
with type X disabled shouldn't be expected to quiesce with other clients
that with X enabled given a change to X.

Cleaned up indentation in preferences integration test.

BUG=138893
TEST=


Review URL: https://chromiumcodereview.appspot.com/10833004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148379 0039d316-1c4b-4281-b951-d872f2087c98
parent 54a37cdc
......@@ -295,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientAppsSyncTest, DisableApps) {
ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncer::APPS));
InstallApp(GetProfile(0), 0);
InstallApp(verifier(), 0);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Installed an app."));
ASSERT_TRUE(HasSameAppsAsVerifier(0));
ASSERT_FALSE(HasSameAppsAsVerifier(1));
......
......@@ -1572,7 +1572,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, MC_DeleteBookmark) {
ASSERT_TRUE(AddURL(0, GetBookmarkBarNode(0), 0, L"bar", bar_url) != NULL);
ASSERT_TRUE(AddURL(0, GetOtherNode(0), 0, L"other", other_url) != NULL);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a bookmark."));
ASSERT_TRUE(HasNodeWithURL(0, bar_url));
ASSERT_TRUE(HasNodeWithURL(0, other_url));
......@@ -1580,7 +1580,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, MC_DeleteBookmark) {
ASSERT_FALSE(HasNodeWithURL(1, other_url));
Remove(0, GetBookmarkBarNode(0), 0);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Removed a bookmark."));
ASSERT_FALSE(HasNodeWithURL(0, bar_url));
ASSERT_TRUE(HasNodeWithURL(0, other_url));
......
......@@ -247,7 +247,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientExtensionsSyncTest, DisableExtensions) {
ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncer::EXTENSIONS));
InstallExtension(GetProfile(0), 1);
InstallExtension(verifier(), 1);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(
GetClient(0)->AwaitFullSyncCompletion("Installed an extension."));
ASSERT_FALSE(AllProfilesHaveSameExtensionsAsVerifier());
ASSERT_TRUE(GetClient(1)->EnableSyncForDatatype(syncer::EXTENSIONS));
......
......@@ -80,7 +80,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPasswordsSyncTest, DisablePasswords) {
AddLogin(GetPasswordStore(0), form);
ASSERT_EQ(1, GetPasswordCount(0));
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Added a password."));
ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0));
ASSERT_FALSE(ProfileContainsSamePasswordFormsAsVerifier(1));
......
......@@ -35,13 +35,11 @@ class TwoClientPreferencesSyncTest : public SyncTest {
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kHomePageIsNewTabPage) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
}
// TCM ID - 7260488.
......@@ -51,10 +49,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, Race) {
ASSERT_TRUE(StringPrefMatches(prefs::kHomePage));
ChangeStringPref(0, prefs::kHomePage,
"http://www.google.com/0");
ChangeStringPref(1, prefs::kHomePage,
"http://www.google.com/1");
ChangeStringPref(0, prefs::kHomePage, "http://www.google.com/0");
ChangeStringPref(1, prefs::kHomePage,"http://www.google.com/1");
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(StringPrefMatches(prefs::kHomePage));
}
......@@ -63,13 +59,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, Race) {
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kPasswordManagerEnabled) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
ChangeBooleanPref(0, prefs::kPasswordManagerEnabled);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
}
// TCM ID - 3699293.
......@@ -78,13 +72,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSyncKeepEverythingSynced));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncThemes));
GetClient(0)->DisableSyncForDatatype(syncer::THEMES);
ASSERT_FALSE(BooleanPrefMatches(
prefs::kSyncKeepEverythingSynced));
ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced));
}
// TCM ID - 3661290.
......@@ -93,19 +85,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisablePreferences) {
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncPreferences));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
GetClient(1)->DisableSyncForDatatype(syncer::PREFERENCES);
ChangeBooleanPref(0, prefs::kPasswordManagerEnabled);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_FALSE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Changed a preference."));
ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
}
// TCM ID - 3664292.
......@@ -114,23 +103,20 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, DisableSync) {
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncPreferences));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
GetClient(1)->DisableSyncForAllDatatypes();
ChangeBooleanPref(0, prefs::kPasswordManagerEnabled);
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Changed a preference."));
ASSERT_FALSE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_FALSE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
ChangeBooleanPref(1, prefs::kShowHomeButton);
ASSERT_FALSE(BooleanPrefMatches(prefs::kShowHomeButton));
GetClient(1)->EnableSyncForAllDatatypes();
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(BooleanPrefMatches(
prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kPasswordManagerEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
}
......@@ -144,8 +130,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, SignInDialog) {
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncThemes));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncExtensions));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncAutofill));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSyncKeepEverythingSynced));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced));
GetClient(0)->DisableSyncForDatatype(syncer::PREFERENCES);
GetClient(1)->EnableSyncForDatatype(syncer::PREFERENCES);
......@@ -165,8 +150,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, SignInDialog) {
ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncThemes));
ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncExtensions));
ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncAutofill));
ASSERT_FALSE(BooleanPrefMatches(
prefs::kSyncKeepEverythingSynced));
ASSERT_FALSE(BooleanPrefMatches(prefs::kSyncKeepEverythingSynced));
}
// TCM ID - 3666296.
......@@ -197,13 +181,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kCheckDefaultBrowser) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(
prefs::kCheckDefaultBrowser));
ASSERT_TRUE(BooleanPrefMatches(prefs::kCheckDefaultBrowser));
ChangeBooleanPref(0, prefs::kCheckDefaultBrowser);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_FALSE(BooleanPrefMatches(
prefs::kCheckDefaultBrowser));
ASSERT_FALSE(BooleanPrefMatches(prefs::kCheckDefaultBrowser));
}
// TCM ID - 3628298.
......@@ -211,8 +193,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kHomePage) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(StringPrefMatches(prefs::kHomePage));
ChangeStringPref(0, prefs::kHomePage,
"http://news.google.com");
ChangeStringPref(0, prefs::kHomePage, "http://news.google.com");
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(StringPrefMatches(prefs::kHomePage));
}
......@@ -252,8 +233,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kURLsToRestoreOnStartup) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(IntegerPrefMatches(prefs::kRestoreOnStartup));
ASSERT_TRUE(ListPrefMatches(
prefs::kURLsToRestoreOnStartup));
ASSERT_TRUE(ListPrefMatches(prefs::kURLsToRestoreOnStartup));
ChangeIntegerPref(0, prefs::kRestoreOnStartup, 0);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
......@@ -266,8 +246,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
ChangeListPref(0, prefs::kURLsToRestoreOnStartup, urls);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(IntegerPrefMatches(prefs::kRestoreOnStartup));
ASSERT_TRUE(ListPrefMatches(
prefs::kURLsToRestoreOnStartup));
ASSERT_TRUE(ListPrefMatches(prefs::kURLsToRestoreOnStartup));
}
// TCM ID - 3684287.
......@@ -285,28 +264,20 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, Privacy) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(
prefs::kAlternateErrorPagesEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSearchSuggestEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kNetworkPredictionEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSafeBrowsingEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kAlternateErrorPagesEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSearchSuggestEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kNetworkPredictionEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSafeBrowsingEnabled));
ChangeBooleanPref(0, prefs::kAlternateErrorPagesEnabled);
ChangeBooleanPref(0, prefs::kSearchSuggestEnabled);
ChangeBooleanPref(0, prefs::kNetworkPredictionEnabled);
ChangeBooleanPref(0, prefs::kSafeBrowsingEnabled);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kAlternateErrorPagesEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSearchSuggestEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kNetworkPredictionEnabled));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSafeBrowsingEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kAlternateErrorPagesEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSearchSuggestEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kNetworkPredictionEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSafeBrowsingEnabled));
}
// TCM ID - 3649279.
......@@ -314,10 +285,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ClearData) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(
prefs::kDeleteBrowsingHistory));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kDeleteDownloadHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteBrowsingHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteDownloadHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteCache));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteCookies));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeletePasswords));
......@@ -332,10 +301,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ClearData) {
ChangeBooleanPref(0, prefs::kDeleteFormData);
ChangeBooleanPref(0, prefs::kDeleteHostedAppsData);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kDeleteBrowsingHistory));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kDeleteDownloadHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteBrowsingHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteDownloadHistory));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteCache));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeleteCookies));
ASSERT_TRUE(BooleanPrefMatches(prefs::kDeletePasswords));
......@@ -347,13 +314,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, ClearData) {
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kWebKitUsesUniversalDetector) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kWebKitUsesUniversalDetector));
ASSERT_TRUE(BooleanPrefMatches(prefs::kWebKitUsesUniversalDetector));
ChangeBooleanPref(0, prefs::kWebKitUsesUniversalDetector);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kWebKitUsesUniversalDetector));
ASSERT_TRUE(BooleanPrefMatches(prefs::kWebKitUsesUniversalDetector));
}
// TCM ID - 3673298.
......@@ -370,39 +335,33 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kDefaultCharset) {
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kBlockThirdPartyCookies) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kBlockThirdPartyCookies));
ASSERT_TRUE(BooleanPrefMatches(prefs::kBlockThirdPartyCookies));
ChangeBooleanPref(0, prefs::kBlockThirdPartyCookies);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kBlockThirdPartyCookies));
ASSERT_TRUE(BooleanPrefMatches(prefs::kBlockThirdPartyCookies));
}
// TCM ID - 7297279.
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kClearSiteDataOnExit) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kClearSiteDataOnExit));
ASSERT_TRUE(BooleanPrefMatches(prefs::kClearSiteDataOnExit));
ChangeBooleanPref(0, prefs::kClearSiteDataOnExit);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kClearSiteDataOnExit));
ASSERT_TRUE(BooleanPrefMatches(prefs::kClearSiteDataOnExit));
}
// TCM ID - 7306184.
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kSafeBrowsingEnabled) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSafeBrowsingEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSafeBrowsingEnabled));
ChangeBooleanPref(0, prefs::kSafeBrowsingEnabled);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kSafeBrowsingEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kSafeBrowsingEnabled));
}
// TCM ID - 3624302.
......@@ -411,20 +370,16 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
DisableVerifier();
ASSERT_TRUE(BooleanPrefMatches(
prefs::kAutofillAuxiliaryProfilesEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kAutofillAuxiliaryProfilesEnabled));
ChangeBooleanPref(0,
prefs::kAutofillAuxiliaryProfilesEnabled);
ChangeBooleanPref(0, prefs::kAutofillAuxiliaryProfilesEnabled);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
// kAutofillAuxiliaryProfilesEnabled is only synced on Mac.
#if defined(OS_MACOSX)
ASSERT_TRUE(BooleanPrefMatches(
prefs::kAutofillAuxiliaryProfilesEnabled));
ASSERT_TRUE(BooleanPrefMatches(prefs::kAutofillAuxiliaryProfilesEnabled));
#else
ASSERT_FALSE(BooleanPrefMatches(
prefs::kAutofillAuxiliaryProfilesEnabled));
ASSERT_FALSE(BooleanPrefMatches(prefs::kAutofillAuxiliaryProfilesEnabled));
#endif // OS_MACOSX
}
......@@ -510,13 +465,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kExtensionsUIDeveloperMode) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kExtensionsUIDeveloperMode));
ASSERT_TRUE(BooleanPrefMatches(prefs::kExtensionsUIDeveloperMode));
ChangeBooleanPref(0, prefs::kExtensionsUIDeveloperMode);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kExtensionsUIDeveloperMode));
ASSERT_TRUE(BooleanPrefMatches(prefs::kExtensionsUIDeveloperMode));
}
// TCM ID - 7583816
......@@ -569,13 +522,11 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest, kUsesSystemTheme) {
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
kUseCustomChromeFrame) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kUseCustomChromeFrame));
ASSERT_TRUE(BooleanPrefMatches(prefs::kUseCustomChromeFrame));
ChangeBooleanPref(0, prefs::kUseCustomChromeFrame);
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kUseCustomChromeFrame));
ASSERT_TRUE(BooleanPrefMatches(prefs::kUseCustomChromeFrame));
}
#endif // TOOLKIT_GTK
......@@ -624,16 +575,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
SingleClientEnabledEncryptionAndChanged) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage);
ASSERT_TRUE(EnableEncryption(0, syncer::PREFERENCES));
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(IsEncrypted(0, syncer::PREFERENCES));
ASSERT_TRUE(IsEncrypted(1, syncer::PREFERENCES));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
}
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
......@@ -650,14 +599,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
SingleClientEnabledEncryptionBothChanged) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(StringPrefMatches(prefs::kHomePage));
ASSERT_TRUE(EnableEncryption(0, syncer::PREFERENCES));
ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage);
ChangeStringPref(1, prefs::kHomePage,
"http://www.google.com/1");
ChangeStringPref(1, prefs::kHomePage, "http://www.google.com/1");
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(IsEncrypted(0, syncer::PREFERENCES));
ASSERT_TRUE(IsEncrypted(1, syncer::PREFERENCES));
......@@ -669,16 +616,14 @@ IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
IN_PROC_BROWSER_TEST_F(TwoClientPreferencesSyncTest,
SingleClientEnabledEncryptionAndChangedMultipleTimes) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ChangeBooleanPref(0, prefs::kHomePageIsNewTabPage);
ASSERT_TRUE(EnableEncryption(0, syncer::PREFERENCES));
ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
ASSERT_TRUE(IsEncrypted(0, syncer::PREFERENCES));
ASSERT_TRUE(IsEncrypted(1, syncer::PREFERENCES));
ASSERT_TRUE(BooleanPrefMatches(
prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kHomePageIsNewTabPage));
ASSERT_TRUE(BooleanPrefMatches(prefs::kShowHomeButton));
ChangeBooleanPref(0, prefs::kShowHomeButton);
......
......@@ -202,7 +202,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientThemesSyncTest, DisableThemes) {
ASSERT_TRUE(GetClient(1)->DisableSyncForDatatype(syncer::THEMES));
UseCustomTheme(GetProfile(0), 0);
UseCustomTheme(verifier(), 0);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(GetClient(0)->AwaitFullSyncCompletion("Changed the theme."));
ASSERT_EQ(GetCustomTheme(0), GetThemeID(GetProfile(0)));
ASSERT_FALSE(UsingCustomTheme(GetProfile(1)));
......
......@@ -201,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, DisableEnableSync) {
GURL url2(kUrl2);
AddUrlToHistory(0, url1);
AddUrlToHistory(1, url2);
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(GetClient(1)->AwaitFullSyncCompletion("Added a typed url."));
// Make sure that no data was exchanged.
history::URLRows post_sync_urls = GetTypedUrlsFromClient(0);
......
......@@ -260,13 +260,14 @@ void P2PNotifier::OnIncomingNotification(
<< "not emitting notification";
return;
}
if (notification_data.GetChangedTypes().Empty()) {
DVLOG(1) << "No changed types -- not emitting notification";
const ModelTypeSet types_to_notify =
Intersection(enabled_types_, notification_data.GetChangedTypes());
if (types_to_notify.Empty()) {
DVLOG(1) << "No enabled and changed types -- not emitting notification";
return;
}
const ModelTypePayloadMap& type_payloads =
ModelTypePayloadMapFromEnumSet(
notification_data.GetChangedTypes(), std::string());
ModelTypePayloadMapFromEnumSet(types_to_notify, std::string());
FOR_EACH_OBSERVER(SyncNotifierObserver, observer_list_,
OnIncomingNotification(type_payloads, REMOTE_NOTIFICATION));
}
......
......@@ -182,12 +182,12 @@ TEST_F(P2PNotifierTest, NotificationsBasic) {
// target settings. The notifications received by the observer should
// be consistent with the target settings.
TEST_F(P2PNotifierTest, SendNotificationData) {
ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES);
ModelTypeSet enabled_types(BOOKMARKS, PREFERENCES, THEMES);
ModelTypeSet changed_types(THEMES, APPS);
ModelTypeSet expected_types(THEMES);
const ModelTypePayloadMap& changed_payload_map =
MakePayloadMap(changed_types);
const ModelTypePayloadMap& expected_payload_map =
MakePayloadMap(expected_types);
EXPECT_CALL(mock_observer_, OnNotificationsEnabled());
EXPECT_CALL(mock_observer_,
......@@ -211,7 +211,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(changed_payload_map,
EXPECT_CALL(mock_observer_, OnIncomingNotification(expected_payload_map,
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_SELF, changed_types));
......@@ -240,7 +240,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(changed_payload_map,
EXPECT_CALL(mock_observer_, OnIncomingNotification(expected_payload_map,
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_OTHERS, changed_types));
......@@ -256,7 +256,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(changed_payload_map,
EXPECT_CALL(mock_observer_, OnIncomingNotification(expected_payload_map,
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender", NOTIFY_ALL, changed_types));
......@@ -265,7 +265,7 @@ TEST_F(P2PNotifierTest, SendNotificationData) {
// Should be propagated.
Mock::VerifyAndClearExpectations(&mock_observer_);
EXPECT_CALL(mock_observer_, OnIncomingNotification(changed_payload_map,
EXPECT_CALL(mock_observer_, OnIncomingNotification(expected_payload_map,
REMOTE_NOTIFICATION));
p2p_notifier_.SendNotificationDataForTest(
P2PNotificationData("sender2", NOTIFY_ALL, changed_types));
......
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