diff options
Diffstat (limited to 'chrome/browser/sync')
13 files changed, 174 insertions, 69 deletions
diff --git a/chrome/browser/sync/profile_sync_factory_impl.cc b/chrome/browser/sync/profile_sync_factory_impl.cc index 5d8824e26..a820419 100644 --- a/chrome/browser/sync/profile_sync_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_factory_impl.cc @@ -153,6 +153,13 @@ void ProfileSyncFactoryImpl::RegisterDataTypes(ProfileSyncService* pss) { new TypedUrlDataTypeController(this, profile_)); } + // Search Engine sync is enabled by default. Register only if explicitly + // disabled. + if (!command_line_->HasSwitch(switches::kDisableSyncSearchEngines)) { + pss->RegisterDataTypeController( + new SearchEngineDataTypeController(this, profile_, pss)); + } + // Session sync is disabled by default. Register only if explicitly // enabled. if (command_line_->HasSwitch(switches::kEnableSyncTabs)) { @@ -176,13 +183,6 @@ void ProfileSyncFactoryImpl::RegisterDataTypes(ProfileSyncService* pss) { new AutofillProfileDataTypeController(this, profile_)); } - // Search Engine sync is disabled by default. Register only if explicitly - // enabled. - if (command_line_->HasSwitch(switches::kEnableSyncSearchEngines)) { - pss->RegisterDataTypeController( - new SearchEngineDataTypeController(this, profile_, pss)); - } - // App notifications sync is disabled by default. Register only if // explicitly enabled. if (command_line_->HasSwitch(switches::kEnableSyncAppNotifications)) { diff --git a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc index 74cd79a..91b5e96 100644 --- a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc @@ -44,6 +44,7 @@ class ProfileSyncFactoryImplTest : public testing::Test { datatypes.push_back(syncable::AUTOFILL_PROFILE); datatypes.push_back(syncable::PASSWORDS); datatypes.push_back(syncable::TYPED_URLS); + datatypes.push_back(syncable::SEARCH_ENGINES); return datatypes; } diff --git a/chrome/browser/sync/resources/configure.html b/chrome/browser/sync/resources/configure.html index 107f136..a2963b5 100644 --- a/chrome/browser/sync/resources/configure.html +++ b/chrome/browser/sync/resources/configure.html @@ -358,22 +358,15 @@ html[os='mac'] input[type='submit'] { args.syncApps; document.getElementById("appsItem").className = "sync-item-show"; } else { - document.getElementById("appsItem").className = "sync-item-hide";
- }
- if (args.searchEnginesRegistered) {
- document.getElementById("searchEnginesCheckbox").checked =
- args.syncSearchEngines;
- document.getElementById("searchEnginesItem").className = "sync-item-show";
- } else {
- document.getElementById("searchEnginesItem").className = "sync-item-hide";
- }
- if (args.sessionsRegistered) {
- document.getElementById("sessionsCheckbox").checked = args.syncSessions;
- document.getElementById("sessionsItem").className = "sync-item-show";
- } else {
- document.getElementById("sessionsItem").className = "sync-item-hide";
- }
-
+ document.getElementById("appsItem").className = "sync-item-hide"; + } + if (args.sessionsRegistered) { + document.getElementById("sessionsCheckbox").checked = args.syncSessions; + document.getElementById("sessionsItem").className = "sync-item-show"; + } else { + document.getElementById("sessionsItem").className = "sync-item-hide"; + } + setCheckboxesToKeepEverythingSynced(args.syncAllDataTypes); } @@ -461,9 +454,8 @@ html[os='mac'] input[type='submit'] { "syncPasswords": syncAll || f.passwordsCheckbox.checked, "syncAutofill": syncAll || f.autofillCheckbox.checked, "syncExtensions": syncAll || f.extensionsCheckbox.checked, - "syncTypedUrls": syncAll || f.typedUrlsCheckbox.checked,
- "syncApps": syncAll || f.appsCheckbox.checked,
- "syncSearchEngines": syncAll || f.searchEnginesCheckbox.checked, + "syncTypedUrls": syncAll || f.typedUrlsCheckbox.checked, + "syncApps": syncAll || f.appsCheckbox.checked, "syncSessions": syncAll || f.sessionsCheckbox.checked, "usePassphrase": (getRadioCheckedValue() == 'explicit'), "passphrase": f.passphrase.value @@ -619,13 +611,6 @@ html[os='mac'] input[type='submit'] { for="sessionsCheckbox" i18n-content="foreignsessions" il8n-values="title:sessions"></label> </div> - <!-- Search Engines --> - <div class="sync-item-show" id="searchEnginesItem"> - <input id="searchEnginesCheckbox" name="dataTypeCheckbox" type="checkbox"> - <label id="searchEnginesCheckboxLabel" name="dataTypeLabel" - for="searchEnginesCheckbox" i18n-content="searchengines" - il8n-values="title:searchengines"></label> - </div> </div> </div> </div> diff --git a/chrome/browser/sync/sync_prefs.cc b/chrome/browser/sync/sync_prefs.cc index 65c28f3..1e27f4a 100644 --- a/chrome/browser/sync/sync_prefs.cc +++ b/chrome/browser/sync/sync_prefs.cc @@ -134,11 +134,12 @@ syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( return registered_types; } - // Remove autofill_profile since it's controlled by autofill (see - // code below). + // Remove autofill_profile since it's controlled by autofill, and + // search_engines since it's controlled by preferences (see code below). syncable::ModelTypeSet user_selectable_types(registered_types); DCHECK_EQ(user_selectable_types.count(syncable::NIGORI), 0u); user_selectable_types.erase(syncable::AUTOFILL_PROFILE); + user_selectable_types.erase(syncable::SEARCH_ENGINES); // Remove app_notifications since it's controlled by apps (see // code below). @@ -155,13 +156,19 @@ syncable::ModelTypeSet SyncPrefs::GetPreferredDataTypes( } } - // Set autofill_profile to the same enabled/disabled state as - // autofill (since only autofill is shown on the UI). + // Group the enabled/disabled state of autofill_profile with autofill, and + // search_engines with preferences (since only autofill and preferences are + // shown on the UI). if (registered_types.count(syncable::AUTOFILL) && registered_types.count(syncable::AUTOFILL_PROFILE) && GetDataTypePreferred(syncable::AUTOFILL)) { preferred_types.insert(syncable::AUTOFILL_PROFILE); } + if (registered_types.count(syncable::PREFERENCES) && + registered_types.count(syncable::SEARCH_ENGINES) && + GetDataTypePreferred(syncable::PREFERENCES)) { + preferred_types.insert(syncable::SEARCH_ENGINES); + } // Set app_notifications to the same enabled/disabled state as // apps (since only apps is shown on the UI). @@ -202,6 +209,16 @@ void SyncPrefs::SetPreferredDataTypes( preferred_types_with_dependents.erase(syncable::APP_NOTIFICATIONS); } } + // Set search_engines to the same enabled/disabled state as + // preferences (since only preferences is shown in the UI). + if (registered_types.count(syncable::PREFERENCES) && + registered_types.count(syncable::SEARCH_ENGINES)) { + if (preferred_types_with_dependents.count(syncable::PREFERENCES)) { + preferred_types_with_dependents.insert(syncable::SEARCH_ENGINES); + } else { + preferred_types_with_dependents.erase(syncable::SEARCH_ENGINES); + } + } for (syncable::ModelTypeSet::const_iterator it = registered_types.begin(); it != registered_types.end(); ++it) { diff --git a/chrome/browser/sync/sync_prefs_unittest.cc b/chrome/browser/sync/sync_prefs_unittest.cc index fedfa52..6ec9bd4 100644 --- a/chrome/browser/sync/sync_prefs_unittest.cc +++ b/chrome/browser/sync/sync_prefs_unittest.cc @@ -41,6 +41,7 @@ syncable::ModelTypeSet GetNonPassiveTypes() { syncable::ModelTypeSet GetUserVisibleTypes() { syncable::ModelTypeSet user_visible_types(GetNonPassiveTypes()); user_visible_types.erase(syncable::AUTOFILL_PROFILE); + user_visible_types.erase(syncable::SEARCH_ENGINES); user_visible_types.erase(syncable::APP_NOTIFICATIONS); return user_visible_types; } @@ -110,6 +111,9 @@ TEST_F(SyncPrefsTest, PreferredTypesNotKeepEverythingSynced) { if (*it == syncable::AUTOFILL) { expected_preferred_types.insert(syncable::AUTOFILL_PROFILE); } + if (*it == syncable::PREFERENCES) { + expected_preferred_types.insert(syncable::SEARCH_ENGINES); + } if (*it == syncable::APPS) { expected_preferred_types.insert(syncable::APP_NOTIFICATIONS); } diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc index 619c8e2..7cb6c7a 100644 --- a/chrome/browser/sync/sync_setup_flow.cc +++ b/chrome/browser/sync/sync_setup_flow.cc @@ -140,8 +140,6 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, registered_types.count(syncable::TYPED_URLS) > 0); args->SetBoolean("appsRegistered", registered_types.count(syncable::APPS) > 0); - args->SetBoolean("searchEnginesRegistered", - registered_types.count(syncable::SEARCH_ENGINES) > 0); args->SetBoolean("sessionsRegistered", registered_types.count(syncable::SESSIONS) > 0); args->SetBoolean("syncBookmarks", @@ -156,8 +154,6 @@ void SyncSetupFlow::GetArgsForConfigure(ProfileSyncService* service, preferred_types.count(syncable::AUTOFILL) > 0); args->SetBoolean("syncExtensions", preferred_types.count(syncable::EXTENSIONS) > 0); - args->SetBoolean("syncSearchEngines", - preferred_types.count(syncable::SEARCH_ENGINES) > 0); args->SetBoolean("syncSessions", preferred_types.count(syncable::SESSIONS) > 0); args->SetBoolean("syncTypedUrls", diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc index 1c9933c..e407623 100644 --- a/chrome/browser/sync/sync_setup_wizard_unittest.cc +++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc @@ -325,8 +325,8 @@ TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) { "{\"syncAllDataTypes\":false,\"syncBookmarks\":true," "\"syncPreferences\":true,\"syncThemes\":false,\"syncPasswords\":false," "\"syncAutofill\":false,\"syncExtensions\":false,\"syncTypedUrls\":true," - "\"syncApps\":true,\"syncSearchEngines\":false,\"syncSessions\":false," - "\"usePassphrase\":false,\"encryptAllData\":false}"; + "\"syncApps\":true,\"syncSessions\":false,\"usePassphrase\":false," + "\"encryptAllData\":false}"; data_type_choices_value.Append(new StringValue(data_type_choices)); // Simulate the user choosing data types; bookmarks, prefs, typed URLS, and @@ -344,7 +344,6 @@ TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) { EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::EXTENSIONS)); EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::TYPED_URLS)); EXPECT_EQ(1U, service_->chosen_data_types_.count(syncable::APPS)); - EXPECT_EQ(0U, service_->chosen_data_types_.count(syncable::SEARCH_ENGINES)); EXPECT_EQ(0U, service_->chosen_data_types_.count( syncable::APP_NOTIFICATIONS)); } diff --git a/chrome/browser/sync/test/integration/search_engines_helper.cc b/chrome/browser/sync/test/integration/search_engines_helper.cc index 95a9fc7..adc3ed7 100644 --- a/chrome/browser/sync/test/integration/search_engines_helper.cc +++ b/chrome/browser/sync/test/integration/search_engines_helper.cc @@ -137,6 +137,20 @@ bool ServicesMatch(int profile_a, int profile_b) { return false; } + const TemplateURL* default_a = service_a->GetDefaultSearchProvider(); + const TemplateURL* default_b = service_b->GetDefaultSearchProvider(); + CHECK(default_a); + CHECK(default_b); + if (!TURLsMatch(default_a, default_b)) { + LOG(ERROR) << "Default search providers do not match: A's default: " + << default_a->keyword() << " B's default: " + << default_b->keyword(); + return false; + } else { + LOG(INFO) << "A had default with URL: " << default_a->url()->url() + << " and keyword: " << default_a->keyword(); + } + return true; } @@ -155,10 +169,16 @@ bool AllServicesMatch() { return true; } +// Convenience helper for consistently generating the same keyword for a given +// seed. +string16 CreateKeyword(int seed) { + return ASCIIToUTF16(base::StringPrintf("test%d", seed)); +} + TemplateURL* CreateTestTemplateURL(int seed) { TemplateURL* turl = new TemplateURL(); turl->SetURL(base::StringPrintf("http://www.test%d.com/", seed), 0, 0); - turl->set_keyword(ASCIIToUTF16(base::StringPrintf("test%d", seed))); + turl->set_keyword(CreateKeyword(seed)); turl->set_short_name(ASCIIToUTF16(base::StringPrintf("test%d", seed))); turl->set_safe_for_autoreplace(true); GURL favicon_url("http://favicon.url"); @@ -200,18 +220,37 @@ void EditSearchEngine(int profile, } } -void DeleteSearchEngine(int profile, const std::string& keyword) { +void DeleteSearchEngineByKeyword(int profile, const string16 keyword) { const TemplateURL* turl = GetServiceForProfile(profile)-> - GetTemplateURLForKeyword(ASCIIToUTF16(keyword)); + GetTemplateURLForKeyword(keyword); EXPECT_TRUE(turl); GetServiceForProfile(profile)->Remove(turl); // Make sure we do the same on the verifier. if (test()->use_verifier()) { const TemplateURL* verifier_turl = - GetVerifierService()->GetTemplateURLForKeyword(ASCIIToUTF16(keyword)); + GetVerifierService()->GetTemplateURLForKeyword(keyword); EXPECT_TRUE(verifier_turl); GetVerifierService()->Remove(verifier_turl); } } +void DeleteSearchEngineBySeed(int profile, int seed) { + DeleteSearchEngineByKeyword(profile, CreateKeyword(seed)); +} + +void ChangeDefaultSearchProvider(int profile, int seed) { + TemplateURLService* service = GetServiceForProfile(profile); + ASSERT_TRUE(service); + const TemplateURL* new_default = service->GetTemplateURLForKeyword( + CreateKeyword(seed)); + ASSERT_TRUE(new_default); + service->SetDefaultSearchProvider(new_default); + if (test()->use_verifier()) { + new_default = GetVerifierService()->GetTemplateURLForKeyword( + CreateKeyword(seed)); + ASSERT_TRUE(new_default); + GetVerifierService()->SetDefaultSearchProvider(new_default); + } +} + } // namespace search_engines_helper diff --git a/chrome/browser/sync/test/integration/search_engines_helper.h b/chrome/browser/sync/test/integration/search_engines_helper.h index 75acc4b..4858280 100644 --- a/chrome/browser/sync/test/integration/search_engines_helper.h +++ b/chrome/browser/sync/test/integration/search_engines_helper.h @@ -9,6 +9,8 @@ #include <map> #include <string> +#include "base/string16.h" + class TemplateURL; class TemplateURLService; @@ -59,7 +61,15 @@ void EditSearchEngine(int profile, // Deletes a search engine from the service at index |profile| with original // keyword |keyword|. Does the same to the verifier, if it is used. -void DeleteSearchEngine(int profile, const std::string& keyword); +void DeleteSearchEngineByKeyword(int profile, const string16 keyword); + +// Deletes a search engine from the service at index |profile| which was +// generated by seed |seed|. +void DeleteSearchEngineBySeed(int profile, int seed); + +// Change the search engine generated with |seed| in service at index |profile| +// to be the new default. Does the same to the verifier, if it is used. +void ChangeDefaultSearchProvider(int profile, int seed); } // namespace search_engines_helper diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 6d39389..34518d2 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -224,10 +224,6 @@ void SyncTest::AddOptionalTypesToCommandLine(CommandLine* cl) { // TODO(sync): Remove this once sessions sync is enabled by default. if (!cl->HasSwitch(switches::kEnableSyncTabs)) cl->AppendSwitch(switches::kEnableSyncTabs); - - // TODO(stevet): Remove this once search engines sync is enabled by default. - if (!cl->HasSwitch(switches::kEnableSyncSearchEngines)) - cl->AppendSwitch(switches::kEnableSyncSearchEngines); } // static @@ -703,6 +699,15 @@ void SyncTest::TriggerSetSyncTabs() { UTF16ToASCII(browser()->GetSelectedTabContents()->GetTitle())); } +int SyncTest::NumberOfDefaultSyncItems() const { + // Just return the current number of basic sync items that are synced, + // including preferences, themes, and search engines. + // TODO(stevet): It would be nice if there was some mechanism for retrieving + // this sum from each data type without having to manually count and update + // this value. + return 7; +} + void SyncTest::SetProxyConfig(net::URLRequestContextGetter* context_getter, const net::ProxyConfig& proxy_config) { base::WaitableEvent done(false, false); diff --git a/chrome/browser/sync/test/integration/sync_test.h b/chrome/browser/sync/test/integration/sync_test.h index 73c03de..a276ca1091 100644 --- a/chrome/browser/sync/test/integration/sync_test.h +++ b/chrome/browser/sync/test/integration/sync_test.h @@ -181,6 +181,9 @@ class SyncTest : public InProcessBrowserTest { // Triggers setting the sync_tabs field of the nigori node. void TriggerSetSyncTabs(); + // Returns the number of default items that every client syncs. + int NumberOfDefaultSyncItems() const; + protected: // Add custom switches needed for running the test. virtual void AddTestSwitches(CommandLine* cl); diff --git a/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc b/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc index d3caa6e..710eaf4 100644 --- a/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_search_engines_sync_test.cc @@ -11,8 +11,10 @@ using search_engines_helper::AddSearchEngine; using search_engines_helper::AllServicesMatch; +using search_engines_helper::ChangeDefaultSearchProvider; using search_engines_helper::CreateTestTemplateURL; -using search_engines_helper::DeleteSearchEngine; +using search_engines_helper::DeleteSearchEngineByKeyword; +using search_engines_helper::DeleteSearchEngineBySeed; using search_engines_helper::EditSearchEngine; using search_engines_helper::GetServiceForProfile; using search_engines_helper::GetVerifierService; @@ -97,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, Delete) { ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllServicesMatch()); - DeleteSearchEngine(0, "test0"); + DeleteSearchEngineBySeed(0, 0); ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_TRUE(AllServicesMatch()); @@ -119,3 +121,42 @@ IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DisableSync) { ASSERT_TRUE(AwaitQuiescence()); ASSERT_TRUE(AllServicesMatch()); } + +// TCM ID - 8891809. +IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, SyncDefault) { + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; + ASSERT_TRUE(AllServicesMatch()); + + AddSearchEngine(0, 0); + ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); + + // Change the default to the new search engine, sync, and ensure that it + // changed in the second client. AllServicesMatch does a default search + // provider check. + ChangeDefaultSearchProvider(0, 0); + ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); + + ASSERT_TRUE(AllServicesMatch()); +} + +// Ensure that we can change the search engine and immediately delete it +// without putting the clients out of sync. +IN_PROC_BROWSER_TEST_F(TwoClientSearchEnginesSyncTest, DeleteSyncedDefault) { + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; + ASSERT_TRUE(AllServicesMatch()); + + AddSearchEngine(0, 0); + AddSearchEngine(0, 1); + ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); + + ChangeDefaultSearchProvider(0, 0); + ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); + ASSERT_TRUE(AllServicesMatch()); + + // Change the default on the first client and delete the old default. + ChangeDefaultSearchProvider(0, 1); + DeleteSearchEngineBySeed(0, 0); + ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); + + ASSERT_TRUE(AllServicesMatch()); +} diff --git a/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc b/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc index 84c8a19..8748125 100644 --- a/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc +++ b/chrome/browser/sync/test/integration/two_client_sessions_sync_test.cc @@ -160,10 +160,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired()); ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); - // We have 6 non-blocking conflicts due to the two meta nodes (one for each - // client), the one tab node, and the six basic preference/themes/search - // engines. - ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()-> + // We have two meta nodes (one for each client), the one tab node, plus the + // basic preference/themes/search engines items. + ASSERT_EQ(NumberOfDefaultSyncItems() + 3, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); @@ -197,9 +197,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_TRUE(GetClient(1)->AwaitPassphraseRequired()); ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); - // We have eight non-blocking conflicts due to the two meta nodes (one for - // each client), and the 6 basic preference/themes/search engines nodes. - ASSERT_EQ(8, GetClient(1)->GetLastSessionSnapshot()-> + // We have nine non-blocking conflicts due to the two meta nodes (one for + // each client), plus the basic preference/themes/search engines nodes. + ASSERT_EQ(NumberOfDefaultSyncItems() + 2, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. ScopedWindowMap client0_windows; @@ -208,7 +209,8 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); - ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()-> + ASSERT_EQ(NumberOfDefaultSyncItems() + 3, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); @@ -242,8 +244,9 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); // We have two non-blocking conflicts due to the two meta nodes (one for each - // client), and the 6 basic preference/themes/search engines nodes. - ASSERT_EQ(8, GetClient(1)->GetLastSessionSnapshot()-> + // client), plus the basic preference/themes/search engines nodes. + ASSERT_EQ(NumberOfDefaultSyncItems() + 2, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. // These changes are either made with the old passphrase or not encrypted at @@ -295,9 +298,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); // We have three non-blocking conflicts due to the two meta nodes (one for - // each client), the one tab node, and the 6 basic preference/themes/search + // each client), the one tab node, plus the basic preference/themes/search // engines nodes. - ASSERT_GE(9, GetClient(1)->GetLastSessionSnapshot()-> + ASSERT_GE(NumberOfDefaultSyncItems() + 3, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. // At this point we enter the passphrase, triggering a resync. @@ -339,9 +343,10 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest, ASSERT_EQ(0, GetClient(1)->GetLastSessionSnapshot()-> num_blocking_conflicting_updates); // We have three non-blocking conflicts due to the two meta nodes (one for - // each client), the one tab node, and the 6 basic preference/themes/search + // each client), the one tab node, plus the basic preference/themes/search // engines nodes. - ASSERT_EQ(9, GetClient(1)->GetLastSessionSnapshot()-> + ASSERT_EQ(NumberOfDefaultSyncItems() + 3, + GetClient(1)->GetLastSessionSnapshot()-> num_conflicting_updates); // The encrypted nodes. GetClient(1)->service()->SetPassphrase(kValidPassphrase, true); |