diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 23:39:25 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-31 23:39:25 +0000 |
commit | 33596da5267a8a3e2e6cb0d44bbc8660f615b878 (patch) | |
tree | ee9e5b9c4ea8bc6f8d0592f9f784a6a67c447f48 /sync/notifier/fake_invalidator.cc | |
parent | 939532d0da8b6e19f3424c9a8a6cac9fc1dc5e12 (diff) | |
download | chromium_src-33596da5267a8a3e2e6cb0d44bbc8660f615b878.zip chromium_src-33596da5267a8a3e2e6cb0d44bbc8660f615b878.tar.gz chromium_src-33596da5267a8a3e2e6cb0d44bbc8660f615b878.tar.bz2 |
[Sync] Rework Invalidator-related unit tests
Introduce invalidator_test_template.h, which contains tests that should be used for each Invalidator implementation. Make all Invalidator implementations, and also InvalidatorRegistrar, instantiate that test template. Move most InvalidatorRegistrar tests and some of the other Invalidator implementation tests to the template.
Make P2PInvalidator support arbitrary object IDs. Also make SendInvalidation take an ObjectIdStateMap.
Simplify BridgedInvalidator a bit; it no longer requires a call to UpdateEnabledTypes (it just uses all registered types from its registrar).
Rework tests for BridgedInvalidator/ChromeSyncNotifierBridge to not require functions in ChromeSyncNotifierBridge to be marked virtual.
Add conversions to/from Values for InvalidationState, ObjectId, and ObjectIdStateMap.
BUG=141678
Review URL: https://chromiumcodereview.appspot.com/10874096
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/notifier/fake_invalidator.cc')
-rw-r--r-- | sync/notifier/fake_invalidator.cc | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/sync/notifier/fake_invalidator.cc b/sync/notifier/fake_invalidator.cc index 85696ad..7468dae 100644 --- a/sync/notifier/fake_invalidator.cc +++ b/sync/notifier/fake_invalidator.cc @@ -16,11 +16,7 @@ bool FakeInvalidator::IsHandlerRegistered(InvalidationHandler* handler) const { ObjectIdSet FakeInvalidator::GetRegisteredIds( InvalidationHandler* handler) const { - return registrar_.GetRegisteredIdsForTest(handler); -} - -void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) { - registrar_.RegisterHandler(handler); + return registrar_.GetRegisteredIds(handler); } const std::string& FakeInvalidator::GetUniqueId() const { @@ -39,8 +35,27 @@ const std::string& FakeInvalidator::GetCredentialsToken() const { return token_; } -ModelTypeSet FakeInvalidator::GetLastChangedTypes() const { - return last_changed_types_; +const ObjectIdStateMap& FakeInvalidator::GetLastSentIdStateMap() const { + return last_sent_id_state_map_; +} + +void FakeInvalidator::EmitOnNotificationsEnabled() { + registrar_.EmitOnNotificationsEnabled(); +} + +void FakeInvalidator::EmitOnIncomingNotification( + const ObjectIdStateMap& id_state_map, + IncomingNotificationSource source) { + registrar_.DispatchInvalidationsToHandlers(id_state_map, source); +} + +void FakeInvalidator::EmitOnNotificationsDisabled( + NotificationsDisabledReason reason) { + registrar_.EmitOnNotificationsDisabled(reason); +} + +void FakeInvalidator::RegisterHandler(InvalidationHandler* handler) { + registrar_.RegisterHandler(handler); } void FakeInvalidator::UpdateRegisteredIds(InvalidationHandler* handler, @@ -66,8 +81,8 @@ void FakeInvalidator::UpdateCredentials( token_ = token; } -void FakeInvalidator::SendNotification(ModelTypeSet changed_types) { - last_changed_types_ = changed_types; +void FakeInvalidator::SendNotification(const ObjectIdStateMap& id_state_map) { + last_sent_id_state_map_ = id_state_map; } } // namespace syncer |