summaryrefslogtreecommitdiffstats
path: root/sync/notifier/p2p_invalidator.h
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 23:39:25 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-31 23:39:25 +0000
commit33596da5267a8a3e2e6cb0d44bbc8660f615b878 (patch)
treeee9e5b9c4ea8bc6f8d0592f9f784a6a67c447f48 /sync/notifier/p2p_invalidator.h
parent939532d0da8b6e19f3424c9a8a6cac9fc1dc5e12 (diff)
downloadchromium_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/p2p_invalidator.h')
-rw-r--r--sync/notifier/p2p_invalidator.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/sync/notifier/p2p_invalidator.h b/sync/notifier/p2p_invalidator.h
index ce486ac..99d7fb81 100644
--- a/sync/notifier/p2p_invalidator.h
+++ b/sync/notifier/p2p_invalidator.h
@@ -29,7 +29,7 @@ class PushClient;
namespace syncer {
// The channel to use for sync notifications.
-extern const char* kSyncP2PNotificationChannel;
+extern const char kSyncP2PNotificationChannel[];
// The intended recipient(s) of a P2P notification.
enum P2PNotificationTarget {
@@ -56,14 +56,17 @@ class P2PNotificationData {
P2PNotificationData();
P2PNotificationData(const std::string& sender_id,
P2PNotificationTarget target,
- ModelTypeSet changed_types);
+ const ObjectIdStateMap& id_state_map,
+ IncomingNotificationSource source);
~P2PNotificationData();
// Returns true if the given ID is targeted by this notification.
bool IsTargeted(const std::string& id) const;
- ModelTypeSet GetChangedTypes() const;
+ const ObjectIdStateMap& GetIdStateMap() const;
+
+ IncomingNotificationSource GetSource() const;
bool Equals(const P2PNotificationData& other) const;
@@ -78,8 +81,10 @@ class P2PNotificationData {
std::string sender_id_;
// The intendent recipient(s) of the notification.
P2PNotificationTarget target_;
- // The types the notification is for.
- ModelTypeSet changed_types_;
+ // The state map for the notification.
+ ObjectIdStateMap id_state_map_;
+ // The source of the notification.
+ IncomingNotificationSource source_;
};
class P2PInvalidator : public Invalidator,
@@ -104,7 +109,7 @@ class P2PInvalidator : public Invalidator,
virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
virtual void UpdateCredentials(
const std::string& email, const std::string& token) OVERRIDE;
- virtual void SendNotification(ModelTypeSet changed_types) OVERRIDE;
+ virtual void SendNotification(const ObjectIdStateMap& id_state_map) OVERRIDE;
// PushClientObserver implementation.
virtual void OnNotificationsEnabled() OVERRIDE;
@@ -133,8 +138,6 @@ class P2PInvalidator : public Invalidator,
// Which set of clients should be sent notifications.
P2PNotificationTarget send_notification_target_;
- ModelTypeSet enabled_types_;
-
DISALLOW_COPY_AND_ASSIGN(P2PInvalidator);
};