| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 syncable::ModelTypeSetToValue(initial_sync_ended)); | 112 syncable::ModelTypeSetToValue(initial_sync_ended)); |
| 113 | 113 |
| 114 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; | 114 std::string download_progress_markers[syncable::MODEL_TYPE_COUNT]; |
| 115 download_progress_markers[syncable::BOOKMARKS] = "test"; | 115 download_progress_markers[syncable::BOOKMARKS] = "test"; |
| 116 download_progress_markers[syncable::APPS] = "apps"; | 116 download_progress_markers[syncable::APPS] = "apps"; |
| 117 scoped_ptr<DictionaryValue> expected_download_progress_markers_value( | 117 scoped_ptr<DictionaryValue> expected_download_progress_markers_value( |
| 118 DownloadProgressMarkersToValue(download_progress_markers)); | 118 DownloadProgressMarkersToValue(download_progress_markers)); |
| 119 | 119 |
| 120 const bool kHasMoreToSync = false; | 120 const bool kHasMoreToSync = false; |
| 121 const bool kIsSilenced = true; | 121 const bool kIsSilenced = true; |
| 122 const int kUnsyncedCount = 1053; | |
| 123 const int kNumEncryptionConflicts = 1054; | 122 const int kNumEncryptionConflicts = 1054; |
| 124 const int kNumHierarchyConflicts = 1055; | 123 const int kNumHierarchyConflicts = 1055; |
| 125 const int kNumSimpleConflicts = 1056; | 124 const int kNumSimpleConflicts = 1056; |
| 126 const int kNumServerConflicts = 1057; | 125 const int kNumServerConflicts = 1057; |
| 127 const bool kDidCommitItems = true; | |
| 128 | 126 |
| 129 SyncSourceInfo source; | 127 SyncSourceInfo source; |
| 130 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue()); | 128 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue()); |
| 131 | 129 |
| 132 SyncSessionSnapshot snapshot(syncer_status, | 130 SyncSessionSnapshot snapshot(syncer_status, |
| 133 errors, | 131 errors, |
| 134 kNumServerChangesRemaining, | 132 kNumServerChangesRemaining, |
| 135 kIsShareUsable, | 133 kIsShareUsable, |
| 136 initial_sync_ended, | 134 initial_sync_ended, |
| 137 download_progress_markers, | 135 download_progress_markers, |
| 138 kHasMoreToSync, | 136 kHasMoreToSync, |
| 139 kIsSilenced, | 137 kIsSilenced, |
| 140 kUnsyncedCount, | |
| 141 kNumEncryptionConflicts, | 138 kNumEncryptionConflicts, |
| 142 kNumHierarchyConflicts, | 139 kNumHierarchyConflicts, |
| 143 kNumSimpleConflicts, | 140 kNumSimpleConflicts, |
| 144 kNumServerConflicts, | 141 kNumServerConflicts, |
| 145 kDidCommitItems, | |
| 146 source, | 142 source, |
| 147 false, | 143 false, |
| 148 0, | 144 0, |
| 149 base::Time::Now(), | 145 base::Time::Now(), |
| 150 false); | 146 false); |
| 151 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); | 147 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); |
| 152 EXPECT_EQ(16u, value->size()); | 148 EXPECT_EQ(14u, value->size()); |
| 153 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, | 149 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, |
| 154 "syncerStatus"); | 150 "syncerStatus"); |
| 155 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, | 151 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, |
| 156 "numServerChangesRemaining"); | 152 "numServerChangesRemaining"); |
| 157 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); | 153 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); |
| 158 ExpectDictListValue(*expected_initial_sync_ended_value, *value, | 154 ExpectDictListValue(*expected_initial_sync_ended_value, *value, |
| 159 "initialSyncEnded"); | 155 "initialSyncEnded"); |
| 160 ExpectDictDictionaryValue(*expected_download_progress_markers_value, | 156 ExpectDictDictionaryValue(*expected_download_progress_markers_value, |
| 161 *value, "downloadProgressMarkers"); | 157 *value, "downloadProgressMarkers"); |
| 162 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); | 158 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); |
| 163 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); | 159 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); |
| 164 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount"); | |
| 165 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, | 160 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, |
| 166 "numEncryptionConflicts"); | 161 "numEncryptionConflicts"); |
| 167 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, | 162 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, |
| 168 "numHierarchyConflicts"); | 163 "numHierarchyConflicts"); |
| 169 ExpectDictIntegerValue(kNumSimpleConflicts, *value, | 164 ExpectDictIntegerValue(kNumSimpleConflicts, *value, |
| 170 "numSimpleConflicts"); | 165 "numSimpleConflicts"); |
| 171 ExpectDictIntegerValue(kNumServerConflicts, *value, | 166 ExpectDictIntegerValue(kNumServerConflicts, *value, |
| 172 "numServerConflicts"); | 167 "numServerConflicts"); |
| 173 ExpectDictBooleanValue(kDidCommitItems, *value, | |
| 174 "didCommitItems"); | |
| 175 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | 168 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); |
| 176 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); | 169 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); |
| 177 } | 170 } |
| 178 | 171 |
| 179 } // namespace | 172 } // namespace |
| 180 } // namespace sessions | 173 } // namespace sessions |
| 181 } // namespace browser_sync | 174 } // namespace browser_sync |
| OLD | NEW |