summaryrefslogtreecommitdiffstats
path: root/sync
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-24 20:39:46 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-24 20:39:46 +0000
commitd4a7d7ad949b447a8d1ea4c8a3edc4aa2785807a (patch)
treece255b74e61b2b32ecae6b2afaf873d5eafb9b6a /sync
parent0b34e72c9c8a4ea1751763472741ebf0da8676c4 (diff)
downloadchromium_src-d4a7d7ad949b447a8d1ea4c8a3edc4aa2785807a.zip
chromium_src-d4a7d7ad949b447a8d1ea4c8a3edc4aa2785807a.tar.gz
chromium_src-d4a7d7ad949b447a8d1ea4c8a3edc4aa2785807a.tar.bz2
[Sync] Pass the correct set of enabled types to the sync notifier
This fixes a bug where only the newly-configured types were being passed to the sync notifier to enable. In the common case, there is an empty configuration cycle, which effectively causes notifications to turn off. For now, read the set of enabled types from the registrar and use that. Add unit test expectations to catch the bug above. Move updating of the notification bridge's data types to the sync thread. Also clean up its unit tests a bit. BUG=138595 TEST= Review URL: https://chromiumcodereview.appspot.com/10817023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148188 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync')
-rw-r--r--sync/internal_api/public/test/fake_sync_manager.h7
-rw-r--r--sync/internal_api/test/fake_sync_manager.cc8
2 files changed, 14 insertions, 1 deletions
diff --git a/sync/internal_api/public/test/fake_sync_manager.h b/sync/internal_api/public/test/fake_sync_manager.h
index b0a5d1f..0183c8f 100644
--- a/sync/internal_api/public/test/fake_sync_manager.h
+++ b/sync/internal_api/public/test/fake_sync_manager.h
@@ -45,6 +45,11 @@ class FakeSyncManager : public SyncManager {
// GetAndResetDownloadedTypes(), or since startup if never called.
ModelTypeSet GetAndResetDownloadedTypes();
+ // Returns those types that have been marked as enabled since the
+ // last call to GetAndResetEnabledTypes(), or since startup if never
+ // called.
+ ModelTypeSet GetAndResetEnabledTypes();
+
// SyncManager implementation.
// Note: we treat whatever message loop this is called from as the sync
// loop for purposes of callbacks.
@@ -115,6 +120,8 @@ class FakeSyncManager : public SyncManager {
ModelTypeSet cleaned_types_;
// The set of types that have been downloaded.
ModelTypeSet downloaded_types_;
+ // The set of types that have been enabled.
+ ModelTypeSet enabled_types_;
// For StopSyncingForShutdown's callback.
MessageLoop* sync_loop_;
diff --git a/sync/internal_api/test/fake_sync_manager.cc b/sync/internal_api/test/fake_sync_manager.cc
index 1951e7f..8899314 100644
--- a/sync/internal_api/test/fake_sync_manager.cc
+++ b/sync/internal_api/test/fake_sync_manager.cc
@@ -42,6 +42,12 @@ ModelTypeSet FakeSyncManager::GetAndResetDownloadedTypes() {
return downloaded_types;
}
+ModelTypeSet FakeSyncManager::GetAndResetEnabledTypes() {
+ ModelTypeSet enabled_types = enabled_types_;
+ enabled_types_.Clear();
+ return enabled_types;
+}
+
bool FakeSyncManager::Init(
const FilePath& database_location,
const WeakHandle<JsEventHandler>& event_handler,
@@ -102,7 +108,7 @@ void FakeSyncManager::UpdateCredentials(const SyncCredentials& credentials) {
}
void FakeSyncManager::UpdateEnabledTypes(const ModelTypeSet& types) {
- // Do nothing.
+ enabled_types_ = types;
}
void FakeSyncManager::StartSyncingNormally(