summaryrefslogtreecommitdiffstats
path: root/sync/internal_api/public
diff options
context:
space:
mode:
authorrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 21:32:24 +0000
committerrlarocque@chromium.org <rlarocque@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-30 21:32:24 +0000
commit3e2dbbc1fa2f7160ecb0b88e58f6c4422ac3ec67 (patch)
tree7a91f035bd0cfbbda181aec85dcc6fb0a596ac03 /sync/internal_api/public
parent6c14fefae02783edf15a7012a36d8c2d8af76759 (diff)
downloadchromium_src-3e2dbbc1fa2f7160ecb0b88e58f6c4422ac3ec67.zip
chromium_src-3e2dbbc1fa2f7160ecb0b88e58f6c4422ac3ec67.tar.gz
chromium_src-3e2dbbc1fa2f7160ecb0b88e58f6c4422ac3ec67.tar.bz2
Track merged nudge sources
There's a lot of valuable information in coalesced nudges. Currently, one nudge source can overwrite another, which leaves us in the dark as to why the client behaved a certain way. In fact, today we can't even determine whether or not any coalescing was done. By logging all the coalesced sources and their payloads, we can learn a lot more about client behaviour. I'm hoping to use this to improve our notification effectiveness metrics. BUG=138613 Review URL: https://chromiumcodereview.appspot.com/11416126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170549 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/internal_api/public')
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.cc15
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot.h3
-rw-r--r--sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc9
3 files changed, 25 insertions, 2 deletions
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.cc b/sync/internal_api/public/sessions/sync_session_snapshot.cc
index 5e25da3..d74ffa7 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.cc
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.cc
@@ -34,6 +34,7 @@ SyncSessionSnapshot::SyncSessionSnapshot(
int num_hierarchy_conflicts,
int num_server_conflicts,
const SyncSourceInfo& source,
+ const std::vector<SyncSourceInfo>& debug_info_sources_list,
bool notifications_enabled,
size_t num_entries,
base::Time sync_start_time,
@@ -48,6 +49,7 @@ SyncSessionSnapshot::SyncSessionSnapshot(
num_hierarchy_conflicts_(num_hierarchy_conflicts),
num_server_conflicts_(num_server_conflicts),
source_(source),
+ debug_info_sources_list_(debug_info_sources_list),
notifications_enabled_(notifications_enabled),
num_entries_(num_entries),
sync_start_time_(sync_start_time),
@@ -92,9 +94,15 @@ DictionaryValue* SyncSessionSnapshot::ToValue() const {
num_server_conflicts_);
value->SetInteger("numEntries", num_entries_);
value->Set("source", source_.ToValue());
+ scoped_ptr<ListValue> sources_list(new ListValue());
+ for (std::vector<SyncSourceInfo>::const_iterator i =
+ debug_info_sources_list_.begin();
+ i != debug_info_sources_list_.end(); ++i) {
+ sources_list->Append(i->ToValue());
+ }
+ value->Set("sourcesList", sources_list.release());
value->SetBoolean("notificationsEnabled", notifications_enabled_);
-
scoped_ptr<DictionaryValue> counter_entries(new DictionaryValue());
for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; i++) {
scoped_ptr<DictionaryValue> type_entries(new DictionaryValue());
@@ -155,6 +163,11 @@ SyncSourceInfo SyncSessionSnapshot::source() const {
return source_;
}
+const std::vector<SyncSourceInfo>&
+SyncSessionSnapshot::debug_info_sources_list() const {
+ return debug_info_sources_list_;
+}
+
bool SyncSessionSnapshot::notifications_enabled() const {
return notifications_enabled_;
}
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot.h b/sync/internal_api/public/sessions/sync_session_snapshot.h
index c6b3c78..8252419 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot.h
+++ b/sync/internal_api/public/sessions/sync_session_snapshot.h
@@ -39,6 +39,7 @@ class SyncSessionSnapshot {
int num_hierarchy_conflicts,
int num_server_conflicts,
const SyncSourceInfo& source,
+ const std::vector<SyncSourceInfo>& debug_info_sources_list,
bool notifications_enabled,
size_t num_entries,
base::Time sync_start_time,
@@ -63,6 +64,7 @@ class SyncSessionSnapshot {
int num_hierarchy_conflicts() const;
int num_server_conflicts() const;
SyncSourceInfo source() const;
+ const std::vector<SyncSourceInfo>& debug_info_sources_list() const;
bool notifications_enabled() const;
size_t num_entries() const;
base::Time sync_start_time() const;
@@ -82,6 +84,7 @@ class SyncSessionSnapshot {
int num_hierarchy_conflicts_;
int num_server_conflicts_;
SyncSourceInfo source_;
+ std::vector<SyncSourceInfo> debug_info_sources_list_;
bool notifications_enabled_;
size_t num_entries_;
base::Time sync_start_time_;
diff --git a/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc b/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
index df33a41..5a97a16 100644
--- a/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
+++ b/sync/internal_api/public/sessions/sync_session_snapshot_unittest.cc
@@ -53,6 +53,11 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
SyncSourceInfo source;
scoped_ptr<DictionaryValue> expected_source_value(source.ToValue());
+ std::vector<SyncSourceInfo> debug_info_sources_list;
+ debug_info_sources_list.push_back(source);
+ scoped_ptr<ListValue> expected_sources_list_value(new ListValue());
+ expected_sources_list_value->Append(source.ToValue());
+
SyncSessionSnapshot snapshot(model_neutral,
kIsShareUsable,
initial_sync_ended,
@@ -62,13 +67,14 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
kNumHierarchyConflicts,
kNumServerConflicts,
source,
+ debug_info_sources_list,
false,
0,
base::Time::Now(),
std::vector<int>(MODEL_TYPE_COUNT,0),
std::vector<int>(MODEL_TYPE_COUNT, 0));
scoped_ptr<DictionaryValue> value(snapshot.ToValue());
- EXPECT_EQ(19u, value->size());
+ EXPECT_EQ(20u, value->size());
ExpectDictIntegerValue(model_neutral.num_successful_commits,
*value, "numSuccessfulCommits");
ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits,
@@ -98,6 +104,7 @@ TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
ExpectDictIntegerValue(kNumServerConflicts, *value,
"numServerConflicts");
ExpectDictDictionaryValue(*expected_source_value, *value, "source");
+ ExpectDictListValue(*expected_sources_list_value, *value, "sourcesList");
ExpectDictBooleanValue(false, *value, "notificationsEnabled");
}