OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sync/sessions/session_state.h" | 5 #include "sync/sessions/session_state.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); | 42 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); |
43 } | 43 } |
44 | 44 |
45 TEST_F(SessionStateTest, SyncerStatusToValue) { | 45 TEST_F(SessionStateTest, SyncerStatusToValue) { |
46 SyncerStatus status; | 46 SyncerStatus status; |
47 status.invalid_store = true; | 47 status.invalid_store = true; |
48 status.num_successful_commits = 5; | 48 status.num_successful_commits = 5; |
49 status.num_successful_bookmark_commits = 10; | 49 status.num_successful_bookmark_commits = 10; |
50 status.num_updates_downloaded_total = 100; | 50 status.num_updates_downloaded_total = 100; |
51 status.num_tombstone_updates_downloaded_total = 200; | 51 status.num_tombstone_updates_downloaded_total = 200; |
| 52 status.num_reflected_updates_downloaded_total = 50; |
52 status.num_local_overwrites = 15; | 53 status.num_local_overwrites = 15; |
53 status.num_server_overwrites = 18; | 54 status.num_server_overwrites = 18; |
54 | 55 |
55 scoped_ptr<DictionaryValue> value(status.ToValue()); | 56 scoped_ptr<DictionaryValue> value(status.ToValue()); |
56 EXPECT_EQ(7u, value->size()); | 57 EXPECT_EQ(8u, value->size()); |
57 ExpectDictBooleanValue(status.invalid_store, *value, "invalidStore"); | 58 ExpectDictBooleanValue(status.invalid_store, *value, "invalidStore"); |
58 ExpectDictIntegerValue(status.num_successful_commits, | 59 ExpectDictIntegerValue(status.num_successful_commits, |
59 *value, "numSuccessfulCommits"); | 60 *value, "numSuccessfulCommits"); |
60 ExpectDictIntegerValue(status.num_successful_bookmark_commits, | 61 ExpectDictIntegerValue(status.num_successful_bookmark_commits, |
61 *value, "numSuccessfulBookmarkCommits"); | 62 *value, "numSuccessfulBookmarkCommits"); |
62 ExpectDictIntegerValue(status.num_updates_downloaded_total, | 63 ExpectDictIntegerValue(status.num_updates_downloaded_total, |
63 *value, "numUpdatesDownloadedTotal"); | 64 *value, "numUpdatesDownloadedTotal"); |
64 ExpectDictIntegerValue(status.num_tombstone_updates_downloaded_total, | 65 ExpectDictIntegerValue(status.num_tombstone_updates_downloaded_total, |
65 *value, "numTombstoneUpdatesDownloadedTotal"); | 66 *value, "numTombstoneUpdatesDownloadedTotal"); |
| 67 ExpectDictIntegerValue(status.num_reflected_updates_downloaded_total, |
| 68 *value, "numReflectedUpdatesDownloadedTotal"); |
66 ExpectDictIntegerValue(status.num_local_overwrites, | 69 ExpectDictIntegerValue(status.num_local_overwrites, |
67 *value, "numLocalOverwrites"); | 70 *value, "numLocalOverwrites"); |
68 ExpectDictIntegerValue(status.num_server_overwrites, | 71 ExpectDictIntegerValue(status.num_server_overwrites, |
69 *value, "numServerOverwrites"); | 72 *value, "numServerOverwrites"); |
70 } | 73 } |
71 | 74 |
72 TEST_F(SessionStateTest, DownloadProgressMarkersToValue) { | 75 TEST_F(SessionStateTest, DownloadProgressMarkersToValue) { |
73 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 76 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
74 for (int i = syncable::FIRST_REAL_MODEL_TYPE; | 77 for (int i = syncable::FIRST_REAL_MODEL_TYPE; |
75 i < syncable::MODEL_TYPE_COUNT; ++i) { | 78 i < syncable::MODEL_TYPE_COUNT; ++i) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 download_progress_markers, | 137 download_progress_markers, |
135 kHasMoreToSync, | 138 kHasMoreToSync, |
136 kIsSilenced, | 139 kIsSilenced, |
137 kUnsyncedCount, | 140 kUnsyncedCount, |
138 kNumEncryptionConflicts, | 141 kNumEncryptionConflicts, |
139 kNumHierarchyConflicts, | 142 kNumHierarchyConflicts, |
140 kNumSimpleConflicts, | 143 kNumSimpleConflicts, |
141 kNumServerConflicts, | 144 kNumServerConflicts, |
142 kDidCommitItems, | 145 kDidCommitItems, |
143 source, | 146 source, |
| 147 false, |
144 0, | 148 0, |
145 base::Time::Now(), | 149 base::Time::Now(), |
146 false); | 150 false); |
147 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); | 151 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); |
148 EXPECT_EQ(15u, value->size()); | 152 EXPECT_EQ(16u, value->size()); |
149 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, | 153 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, |
150 "syncerStatus"); | 154 "syncerStatus"); |
151 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, | 155 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, |
152 "numServerChangesRemaining"); | 156 "numServerChangesRemaining"); |
153 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); | 157 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); |
154 ExpectDictListValue(*expected_initial_sync_ended_value, *value, | 158 ExpectDictListValue(*expected_initial_sync_ended_value, *value, |
155 "initialSyncEnded"); | 159 "initialSyncEnded"); |
156 ExpectDictDictionaryValue(*expected_download_progress_markers_value, | 160 ExpectDictDictionaryValue(*expected_download_progress_markers_value, |
157 *value, "downloadProgressMarkers"); | 161 *value, "downloadProgressMarkers"); |
158 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); | 162 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); |
159 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); | 163 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); |
160 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount"); | 164 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount"); |
161 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, | 165 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, |
162 "numEncryptionConflicts"); | 166 "numEncryptionConflicts"); |
163 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, | 167 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, |
164 "numHierarchyConflicts"); | 168 "numHierarchyConflicts"); |
165 ExpectDictIntegerValue(kNumSimpleConflicts, *value, | 169 ExpectDictIntegerValue(kNumSimpleConflicts, *value, |
166 "numSimpleConflicts"); | 170 "numSimpleConflicts"); |
167 ExpectDictIntegerValue(kNumServerConflicts, *value, | 171 ExpectDictIntegerValue(kNumServerConflicts, *value, |
168 "numServerConflicts"); | 172 "numServerConflicts"); |
169 ExpectDictBooleanValue(kDidCommitItems, *value, | 173 ExpectDictBooleanValue(kDidCommitItems, *value, |
170 "didCommitItems"); | 174 "didCommitItems"); |
171 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | 175 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); |
| 176 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); |
172 } | 177 } |
173 | 178 |
174 } // namespace | 179 } // namespace |
175 } // namespace sessions | 180 } // namespace sessions |
176 } // namespace browser_sync | 181 } // namespace browser_sync |
OLD | NEW |