Commit ac2be120 authored by Maksim Moskvitin's avatar Maksim Moskvitin Committed by Commit Bot

[Invalidations] Use Topic API in InvalidationLogger

This CL is a part of ObjectID -> Topic API migration. It replaces
ObjectID with Topic in InvalidationLogger and its dependencies.

There should be only one behavioral change: chrome://invalidations page
would expose 0 as an ObjectID::source for any subscription. It's not a
real change, because |source| was already deprecated and the same value
used. In the future chrome://invalidations should be updated to use
Topic instead of ObjectID.

chrome.invalidations.logInvalidations now receives
TopicInvalidationMap::ToValue() instead of
ObjectIDInalidationMap::ToValue(), but their ToValue() implementations
are the same, so there should be no changes.

Bug: 1029698
Change-Id: I17f36f7c43b664185bf87da4edb8d7d99a0afec9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2074877
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746338}
parent be8daa80
......@@ -14,15 +14,13 @@
#include "components/invalidation/impl/profile_invalidation_provider.h"
#include "components/invalidation/public/invalidation_handler.h"
#include "components/invalidation/public/invalidation_service.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "content/public/browser/web_ui.h"
namespace invalidation {
class InvalidationLogger;
} // namespace invalidation
namespace syncer {
class ObjectIdInvalidationMap;
} // namespace syncer
namespace {
......@@ -100,15 +98,19 @@ void InvalidationsMessageHandler::OnStateChange(
base::Value(last_changed_timestamp.ToJsTime()));
}
void InvalidationsMessageHandler::OnUpdateIds(
void InvalidationsMessageHandler::OnUpdatedTopics(
const std::string& handler_name,
const syncer::ObjectIdCountMap& ids) {
const syncer::TopicCountMap& topics) {
base::ListValue list_of_objects;
for (auto it = ids.begin(); it != ids.end(); ++it) {
for (const auto& topic_item : topics) {
std::unique_ptr<base::DictionaryValue> dic(new base::DictionaryValue());
dic->SetString("name", (it->first).name());
dic->SetInteger("source", (it->first).source());
dic->SetInteger("totalCount", it->second);
dic->SetString("name", topic_item.first);
// TODO(crbug.com/1056181): source has been deprecated and after Topic->
// ObjectID refactoring completely makes no sense. It needs to be cleaned
// up together with other ObjectID references in js counterpart. Pass 0
// temporary to avoid changes in js counterpart.
dic->SetInteger("source", 0);
dic->SetInteger("totalCount", topic_item.second);
list_of_objects.Append(std::move(dic));
}
web_ui()->CallJavascriptFunctionUnsafe("chrome.invalidations.updateIds",
......@@ -119,7 +121,7 @@ void InvalidationsMessageHandler::OnDebugMessage(
const base::DictionaryValue& details) {}
void InvalidationsMessageHandler::OnInvalidation(
const syncer::ObjectIdInvalidationMap& new_invalidations) {
const syncer::TopicInvalidationMap& new_invalidations) {
std::unique_ptr<base::ListValue> invalidations_list =
new_invalidations.ToValue();
web_ui()->CallJavascriptFunctionUnsafe(
......
......@@ -32,11 +32,11 @@ class InvalidationsMessageHandler
const std::multiset<std::string>& registered_handlers) override;
void OnStateChange(const syncer::InvalidatorState& new_state,
const base::Time& last_change_timestamp) override;
void OnUpdateIds(const std::string& handler_name,
const syncer::ObjectIdCountMap& ids_set) override;
void OnUpdatedTopics(const std::string& handler_name,
const syncer::TopicCountMap& topics_counts) override;
void OnDebugMessage(const base::DictionaryValue& details) override;
void OnInvalidation(
const syncer::ObjectIdInvalidationMap& new_invalidations) override;
const syncer::TopicInvalidationMap& new_invalidations) override;
void OnDetailedStatus(const base::DictionaryValue& network_details) override;
// Implementation of WebUIMessageHandler.
......
......@@ -8,7 +8,6 @@
#include "base/callback.h"
#include "base/logging.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "components/prefs/pref_service.h"
#include "google/cacheinvalidation/include/types.h"
......
......@@ -14,7 +14,6 @@
#include "components/invalidation/impl/per_user_topic_subscription_manager.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/invalidator_state.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "services/data_decoder/public/cpp/test_support/in_process_data_decoder.h"
#include "testing/gmock/include/gmock/gmock.h"
......
......@@ -14,7 +14,6 @@
#include "components/invalidation/impl/fcm_network_handler.h"
#include "components/invalidation/impl/invalidation_prefs.h"
#include "components/invalidation/public/invalidator_state.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "components/prefs/scoped_user_pref_update.h"
......@@ -104,7 +103,7 @@ bool FCMInvalidationServiceBase::UpdateInterestedTopics(
if (!invalidator_registrar_.UpdateRegisteredTopics(handler, topic_map))
return false;
DoUpdateSubscribedTopicsIfNeeded();
logger_.OnUpdateTopics(invalidator_registrar_.GetHandlerNameToTopicsMap());
logger_.OnUpdatedTopics(invalidator_registrar_.GetHandlerNameToTopicsMap());
return true;
}
......@@ -151,8 +150,7 @@ void FCMInvalidationServiceBase::OnInvalidate(
const syncer::TopicInvalidationMap& invalidation_map) {
invalidator_registrar_.DispatchInvalidationsToHandlers(invalidation_map);
logger_.OnInvalidation(
ConvertTopicInvalidationMapToObjectIdInvalidationMap(invalidation_map));
logger_.OnInvalidation(invalidation_map);
}
void FCMInvalidationServiceBase::OnInvalidatorStateChange(
......
......@@ -8,9 +8,9 @@
#include "components/invalidation/impl/invalidation_logger_observer.h"
#include "components/invalidation/public/invalidation_handler.h"
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/topic_invalidation_map.h"
namespace invalidation {
class InvalidationLoggerObserver;
InvalidationLogger::InvalidationLogger()
: last_invalidator_state_(syncer::TRANSIENT_INVALIDATION_ERROR),
......@@ -53,35 +53,25 @@ void InvalidationLogger::EmitState() {
}
}
void InvalidationLogger::OnUpdateTopics(
std::map<std::string, syncer::Topics> updated_topics) {
for (const auto& updated_topic : updated_topics) {
latest_ids_[updated_topic.first] =
syncer::ConvertTopicsToIds(updated_topic.second);
void InvalidationLogger::OnUpdatedTopics(
std::map<std::string, syncer::Topics> handler_updated_topics_map) {
for (const auto& updated_topics : handler_updated_topics_map) {
handler_latest_topics_map_[updated_topics.first] = updated_topics.second;
}
EmitUpdatedIds();
EmitUpdatedTopics();
}
void InvalidationLogger::OnUpdateIds(
std::map<std::string, syncer::ObjectIdSet> updated_ids) {
for (std::map<std::string, syncer::ObjectIdSet>::const_iterator it =
updated_ids.begin(); it != updated_ids.end(); ++it) {
latest_ids_[it->first] = syncer::ObjectIdSet(it->second);
}
EmitUpdatedIds();
}
void InvalidationLogger::EmitUpdatedIds() {
for (std::map<std::string, syncer::ObjectIdSet>::const_iterator it =
latest_ids_.begin(); it != latest_ids_.end(); ++it) {
const syncer::ObjectIdSet& object_ids_for_handler = it->second;
syncer::ObjectIdCountMap per_object_invalidation_count;
for (auto oid_it = object_ids_for_handler.begin();
oid_it != object_ids_for_handler.end(); ++oid_it) {
per_object_invalidation_count[*oid_it] = invalidation_count_[*oid_it];
void InvalidationLogger::EmitUpdatedTopics() {
for (const auto& handler_name_and_topics : handler_latest_topics_map_) {
syncer::TopicCountMap per_handler_invalidation_count;
for (const auto& topic_item : handler_name_and_topics.second) {
const syncer::Topic& topic = topic_item.first;
per_handler_invalidation_count[topic] = invalidation_count_[topic];
}
for (auto& observer : observer_list_) {
observer.OnUpdatedTopics(handler_name_and_topics.first,
per_handler_invalidation_count);
}
for (auto& observer : observer_list_)
observer.OnUpdateIds(it->first, per_object_invalidation_count);
}
}
......@@ -91,22 +81,17 @@ void InvalidationLogger::OnDebugMessage(const base::DictionaryValue& details) {
}
void InvalidationLogger::OnInvalidation(
const syncer::ObjectIdInvalidationMap& details) {
std::vector<syncer::Invalidation> internal_invalidations;
details.GetAllInvalidations(&internal_invalidations);
for (std::vector<syncer::Invalidation>::const_iterator it =
internal_invalidations.begin();
it != internal_invalidations.end();
++it) {
invalidation_count_[it->object_id()]++;
const syncer::TopicInvalidationMap& invalidations) {
for (const auto& topic : invalidations.GetTopics()) {
invalidation_count_[topic] += invalidations.ForTopic(topic).GetSize();
}
for (auto& observer : observer_list_)
observer.OnInvalidation(details);
observer.OnInvalidation(invalidations);
}
void InvalidationLogger::EmitContent() {
EmitState();
EmitUpdatedIds();
EmitUpdatedTopics();
EmitRegisteredHandlers();
}
......
......@@ -18,7 +18,7 @@ class DictionaryValue;
} // namespace base
namespace syncer {
class ObjectIdInvalidationMap;
class TopicInvalidationMap;
} // namespace syncer
namespace invalidation {
......@@ -26,17 +26,16 @@ namespace invalidation {
class InvalidationLoggerObserver;
// This class is in charge of logging invalidation-related information.
// It is used store the state of the InvalidatorService that owns this object
// It is used store the state of the InvalidationService that owns this object
// and then rebroadcast it to observers than can display it accordingly
// (like a debugging page). This class only stores lightweight state, as in
// which services are registered and listening for certain objects, and the
// status of the InvalidatorService (in order not to increase unnecessary
// which services are registered and listening for certain topics, and the
// status of the InvalidationService (in order not to increase unnecessary
// memory usage).
//
// Observers can be registered and will be called to be notified of any
// status change immediatly. They can log there the history of what messages
// they receive.
class InvalidationLogger {
public:
......@@ -48,10 +47,10 @@ class InvalidationLogger {
void OnRegistration(const std::string& details);
void OnUnregistration(const std::string& details);
void OnStateChange(const syncer::InvalidatorState& new_state);
void OnUpdateIds(std::map<std::string, syncer::ObjectIdSet> updated_ids);
void OnUpdateTopics(std::map<std::string, syncer::Topics> updated_topics);
void OnUpdatedTopics(
std::map<std::string, syncer::Topics> handler_updated_topics_map);
void OnDebugMessage(const base::DictionaryValue& details);
void OnInvalidation(const syncer::ObjectIdInvalidationMap& details);
void OnInvalidation(const syncer::TopicInvalidationMap& invalidations);
// Triggers messages to be sent to the Observers to provide them with
// the current state of the logging.
......@@ -67,9 +66,9 @@ class InvalidationLogger {
// Send to every Observer a OnStateChange event with the latest state.
void EmitState();
// Send to every Observer many OnUpdateIds events, each with one registrar
// and every objectId it currently has registered.
void EmitUpdatedIds();
// Send to every Observer many OnUpdatedTopics() events, each with one
// handler and every Topic it currently has registered.
void EmitUpdatedTopics();
// Send to every Observer a vector with the all the current registered
// handlers.
......@@ -84,14 +83,16 @@ class InvalidationLogger {
// The map that contains every object id that is currently registered
// and its owner.
std::map<std::string, syncer::ObjectIdSet> latest_ids_;
std::map<std::string, syncer::Topics> handler_latest_topics_map_;
// The map that counts how many invalidations per objectId there has been.
syncer::ObjectIdCountMap invalidation_count_;
// The map that counts how many invalidations per Topic there has been.
syncer::TopicCountMap invalidation_count_;
// The name of all invalidatorHandler registered (note that this is not
// necessarily the same as the keys of latest_ids_, because they might
// have not registered any object id).
// necessarily the same as the keys of latest_topics_, because they might
// have not registered any Topic).
// TODO(crbug.com/1049591): it should be std::set, once handlers names are
// unique.
std::multiset<std::string> registered_handlers_;
DISALLOW_COPY_AND_ASSIGN(InvalidationLogger);
......
......@@ -7,32 +7,30 @@
#include "components/invalidation/public/invalidation_util.h"
#include "components/invalidation/public/invalidator_state.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
namespace base {
class DictionaryValue;
} // namespace base
namespace syncer {
class ObjectIdInvalidationMap;
class TopicInvalidationMap;
} // namespace syncer
namespace invalidation {
// This class provides the possibilty to register as an observer for the
// InvalidationLogger notifications whenever an InvalidatorService changes
// This class provides the possibility to register as an observer for the
// InvalidationLogger notifications whenever an InvalidationService changes
// its internal state.
// (i.e. A new registration, a new invalidation, a TICL/GCM state change)
// (i.e. A new registration, a new invalidation, a GCM state change)
class InvalidationLoggerObserver {
public:
virtual void OnRegistrationChange(
const std::multiset<std::string>& registered_handlers) = 0;
virtual void OnStateChange(const syncer::InvalidatorState& new_state,
const base::Time& last_change_timestamp) = 0;
virtual void OnUpdateIds(const std::string& handler_name,
const syncer::ObjectIdCountMap& details) = 0;
virtual void OnUpdatedTopics(const std::string& handler_name,
const syncer::TopicCountMap& details) = 0;
virtual void OnDebugMessage(const base::DictionaryValue& details) = 0;
virtual void OnInvalidation(
const syncer::ObjectIdInvalidationMap& details) = 0;
virtual void OnInvalidation(const syncer::TopicInvalidationMap& details) = 0;
virtual void OnDetailedStatus(const base::DictionaryValue& details) = 0;
protected:
......
......@@ -3,8 +3,10 @@
// found in the LICENSE file.
#include "components/invalidation/impl/invalidation_logger.h"
#include "components/invalidation/impl/invalidation_logger_observer.h"
#include "components/invalidation/impl/invalidation_logger_observer.h"
#include "components/invalidation/public/invalidation.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace invalidation {
......@@ -20,7 +22,7 @@ class InvalidationLoggerObserverTest : public InvalidationLoggerObserver {
debug_message_received = false;
invalidation_received = false;
detailed_status_received = false;
update_id_replicated = std::map<std::string, syncer::ObjectIdCountMap>();
updated_topics_replicated = std::map<std::string, syncer::TopicCountMap>();
registered_handlers = std::multiset<std::string>();
}
......@@ -35,10 +37,10 @@ class InvalidationLoggerObserverTest : public InvalidationLoggerObserver {
state_received = true;
}
void OnUpdateIds(const std::string& handler,
const syncer::ObjectIdCountMap& details) override {
void OnUpdatedTopics(const std::string& handler,
const syncer::TopicCountMap& topics_counts) override {
update_id_received = true;
update_id_replicated[handler] = details;
updated_topics_replicated[handler] = topics_counts;
}
void OnDebugMessage(const base::DictionaryValue& details) override {
......@@ -46,7 +48,7 @@ class InvalidationLoggerObserverTest : public InvalidationLoggerObserver {
}
void OnInvalidation(
const syncer::ObjectIdInvalidationMap& new_invalidations) override {
const syncer::TopicInvalidationMap& new_invalidations) override {
invalidation_received = true;
}
......@@ -60,7 +62,7 @@ class InvalidationLoggerObserverTest : public InvalidationLoggerObserver {
bool debug_message_received;
bool invalidation_received;
bool detailed_status_received;
std::map<std::string, syncer::ObjectIdCountMap> update_id_replicated;
std::map<std::string, syncer::TopicCountMap> updated_topics_replicated;
std::multiset<std::string> registered_handlers;
};
......@@ -81,7 +83,7 @@ TEST(InvalidationLoggerTest, TestCallbacks) {
observer_test.ResetStates();
log.OnInvalidation(syncer::ObjectIdInvalidationMap());
log.OnInvalidation(syncer::TopicInvalidationMap());
EXPECT_TRUE(observer_test.invalidation_received);
EXPECT_FALSE(observer_test.state_received);
EXPECT_FALSE(observer_test.update_id_received);
......@@ -102,12 +104,12 @@ TEST(InvalidationLoggerTest, TestReleaseOfObserver) {
log.RegisterObserver(&observer_test);
log.UnregisterObserver(&observer_test);
log.OnInvalidation(syncer::ObjectIdInvalidationMap());
log.OnInvalidation(syncer::TopicInvalidationMap());
log.OnStateChange(syncer::INVALIDATIONS_ENABLED);
log.OnRegistration(std::string());
log.OnUnregistration(std::string());
log.OnDebugMessage(base::DictionaryValue());
log.OnUpdateIds(std::map<std::string, syncer::ObjectIdSet>());
log.OnUpdatedTopics(std::map<std::string, syncer::Topics>());
EXPECT_FALSE(observer_test.registration_change_received);
EXPECT_FALSE(observer_test.update_id_received);
EXPECT_FALSE(observer_test.invalidation_received);
......@@ -135,9 +137,9 @@ TEST(InvalidationLoggerTest, TestEmitContent) {
EXPECT_FALSE(observer_test.detailed_status_received);
observer_test.ResetStates();
std::map<std::string, syncer::ObjectIdSet> test_map;
test_map["Test"] = syncer::ObjectIdSet();
log.OnUpdateIds(test_map);
std::map<std::string, syncer::Topics> test_map;
test_map["Test"] = syncer::Topics();
log.OnUpdatedTopics(test_map);
EXPECT_TRUE(observer_test.update_id_received);
observer_test.ResetStates();
......@@ -158,60 +160,60 @@ TEST(InvalidationLoggerTest, TestEmitContent) {
TEST(InvalidationLoggerTest, TestUpdateIdsMap) {
InvalidationLogger log;
InvalidationLoggerObserverTest observer_test;
std::map<std::string, syncer::ObjectIdSet> send_test_map;
std::map<std::string, syncer::ObjectIdCountMap> expected_received_map;
std::map<std::string, syncer::Topics> send_test_map;
std::map<std::string, syncer::TopicCountMap> expected_received_map;
log.RegisterObserver(&observer_test);
syncer::ObjectIdSet sync_set_A;
syncer::ObjectIdCountMap counted_sync_set_A;
syncer::Topics topics_a;
syncer::TopicCountMap topics_counts_a;
ObjectId o1(1000, "DataType1");
sync_set_A.insert(o1);
counted_sync_set_A[o1] = 0;
syncer::Topic t1 = "Topic1";
topics_a.emplace(t1, syncer::TopicMetadata{/*is_public=*/false});
topics_counts_a[t1] = 0;
ObjectId o2(1000, "DataType2");
sync_set_A.insert(o2);
counted_sync_set_A[o2] = 0;
syncer::Topic t2 = "Topic2";
topics_a.emplace(t2, syncer::TopicMetadata{/*is_public=*/false});
topics_counts_a[t2] = 0;
syncer::ObjectIdSet sync_set_B;
syncer::ObjectIdCountMap counted_sync_set_B;
syncer::Topics topics_b;
syncer::TopicCountMap topics_counts_b;
ObjectId o3(1020, "DataTypeA");
sync_set_B.insert(o3);
counted_sync_set_B[o3] = 0;
syncer::Topic t3 = "Topic3";
topics_b.emplace(t3, syncer::TopicMetadata{/*is_public=*/false});
topics_counts_b[t3] = 0;
send_test_map["TestA"] = sync_set_A;
send_test_map["TestB"] = sync_set_B;
expected_received_map["TestA"] = counted_sync_set_A;
expected_received_map["TestB"] = counted_sync_set_B;
send_test_map["TestA"] = topics_a;
send_test_map["TestB"] = topics_b;
expected_received_map["TestA"] = topics_counts_a;
expected_received_map["TestB"] = topics_counts_b;
// Send the objects ids registered for the two different handler name.
log.OnUpdateIds(send_test_map);
EXPECT_EQ(expected_received_map, observer_test.update_id_replicated);
// Send the topics registered for the two different handler name.
log.OnUpdatedTopics(send_test_map);
EXPECT_EQ(expected_received_map, observer_test.updated_topics_replicated);
syncer::ObjectIdSet sync_set_B2;
syncer::ObjectIdCountMap counted_sync_set_B2;
syncer::Topics topics_b2;
syncer::TopicCountMap topics_counts_b2;
ObjectId o4(1020, "DataTypeF");
sync_set_B2.insert(o4);
counted_sync_set_B2[o4] = 0;
syncer::Topic t4 = "Topic4";
topics_b2.emplace(t4, syncer::TopicMetadata{/*is_public=*/false});
topics_counts_b2[t4] = 0;
ObjectId o5(1020, "DataTypeG");
sync_set_B2.insert(o5);
counted_sync_set_B2[o5] = 0;
syncer::Topic t5 = "Topic5";
topics_b2.emplace(t5, syncer::TopicMetadata{/*is_public=*/false});
topics_counts_b2[t5] = 0;
send_test_map["TestB"] = sync_set_B2;
expected_received_map["TestB"] = counted_sync_set_B2;
send_test_map["TestB"] = topics_b2;
expected_received_map["TestB"] = topics_counts_b2;
// Test now that if we replace the registered datatypes for TestB, the
// Test now that if we replace the registered topics for TestB, the
// original don't show up again.
log.OnUpdateIds(send_test_map);
EXPECT_EQ(expected_received_map, observer_test.update_id_replicated);
log.OnUpdatedTopics(send_test_map);
EXPECT_EQ(expected_received_map, observer_test.updated_topics_replicated);
// The emit content should return the same map too.
observer_test.ResetStates();
log.EmitContent();
EXPECT_EQ(expected_received_map, observer_test.update_id_replicated);
EXPECT_EQ(expected_received_map, observer_test.updated_topics_replicated);
log.UnregisterObserver(&observer_test);
}
......@@ -222,36 +224,35 @@ TEST(InvalidationLoggerTest, TestInvalidtionsTotalCount) {
InvalidationLoggerObserverTest observer_test;
log.RegisterObserver(&observer_test);
std::map<std::string, syncer::ObjectIdSet> send_test_map;
std::map<std::string, syncer::ObjectIdCountMap> expected_received_map;
syncer::ObjectIdSet sync_set;
syncer::ObjectIdCountMap counted_sync_set;
std::map<std::string, syncer::Topics> send_test_map;
std::map<std::string, syncer::TopicCountMap> expected_received_map;
syncer::Topics topics;
syncer::TopicCountMap topics_counts;
ObjectId o1(1020, "DataTypeA");
sync_set.insert(o1);
counted_sync_set[o1] = 1;
syncer::Topic t1 = "Topic1";
topics.emplace(t1, syncer::TopicMetadata{/*is_public=*/false});
topics_counts[t1] = 1;
// Generate invalidation for datatype A only.
syncer::ObjectIdInvalidationMap fake_invalidations =
syncer::ObjectIdInvalidationMap::InvalidateAll(sync_set);
// Generate invalidation for |t1| only.
syncer::TopicInvalidationMap fake_invalidations;
fake_invalidations.Insert(syncer::Invalidation::InitUnknownVersion(t1));
ObjectId o2(1040, "DataTypeB");
sync_set.insert(o2);
counted_sync_set[o2] = 0;
syncer::Topic t2 = "Topic2";
topics.emplace(t2, syncer::TopicMetadata{/*is_public=*/false});
topics_counts[t2] = 0;
// Registed the two objectIds and send an invalidation only for the
// Datatype A.
send_test_map["Test"] = sync_set;
log.OnUpdateIds(send_test_map);
// Register the two Topics and send an invalidation only for |t1|.
send_test_map["Test"] = topics;
log.OnUpdatedTopics(send_test_map);
log.OnInvalidation(fake_invalidations);
expected_received_map["Test"] = counted_sync_set;
expected_received_map["Test"] = topics_counts;
// Reset the state of the observer to receive the ObjectIds with the
// count of invalidations received (1 and 0).
// Reset the state of the observer to receive the Topics with the count of
// invalidations received (1 and 0).
observer_test.ResetStates();
log.EmitContent();
EXPECT_EQ(expected_received_map, observer_test.update_id_replicated);
EXPECT_EQ(expected_received_map, observer_test.updated_topics_replicated);
log.UnregisterObserver(&observer_test);
}
......
......@@ -11,7 +11,6 @@
#include "base/logging.h"
#include "base/values.h"
#include "components/invalidation/public/object_id_invalidation_map.h"
#include "components/invalidation/public/topic_invalidation_map.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/scoped_user_pref_update.h"
......
......@@ -65,13 +65,12 @@ struct INVALIDATION_EXPORT InvalidationVersionLessThan {
typedef std::set<invalidation::ObjectId, ObjectIdLessThan> ObjectIdSet;
typedef std::map<invalidation::ObjectId, int, ObjectIdLessThan>
ObjectIdCountMap;
using Topic = std::string;
// It should be std::set, since std::set_difference is used for it.
using TopicSet = std::set<std::string>;
using TopicCountMap = std::map<Topic, int>;
INVALIDATION_EXPORT struct TopicMetadata {
// Whether the topic is public.
bool is_public;
......
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