| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 syncable::ModelTypeSetToValue(initial_sync_ended)); | 89 syncable::ModelTypeSetToValue(initial_sync_ended)); |
| 90 | 90 |
| 91 syncable::ModelTypePayloadMap download_progress_markers; | 91 syncable::ModelTypePayloadMap download_progress_markers; |
| 92 download_progress_markers[syncable::BOOKMARKS] = "test"; | 92 download_progress_markers[syncable::BOOKMARKS] = "test"; |
| 93 download_progress_markers[syncable::APPS] = "apps"; | 93 download_progress_markers[syncable::APPS] = "apps"; |
| 94 scoped_ptr<DictionaryValue> expected_download_progress_markers_value( | 94 scoped_ptr<DictionaryValue> expected_download_progress_markers_value( |
| 95 syncable::ModelTypePayloadMapToValue(download_progress_markers)); | 95 syncable::ModelTypePayloadMapToValue(download_progress_markers)); |
| 96 | 96 |
| 97 const bool kHasMoreToSync = false; | 97 const bool kHasMoreToSync = false; |
| 98 const bool kIsSilenced = true; | 98 const bool kIsSilenced = true; |
| 99 const int kUnsyncedCount = 1053; | |
| 100 const int kNumEncryptionConflicts = 1054; | 99 const int kNumEncryptionConflicts = 1054; |
| 101 const int kNumHierarchyConflicts = 1055; | 100 const int kNumHierarchyConflicts = 1055; |
| 102 const int kNumSimpleConflicts = 1056; | 101 const int kNumSimpleConflicts = 1056; |
| 103 const int kNumServerConflicts = 1057; | 102 const int kNumServerConflicts = 1057; |
| 104 const bool kDidCommitItems = true; | |
| 105 | 103 |
| 106 SyncSourceInfo source; | 104 SyncSourceInfo source; |
| 107 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue()); | 105 scoped_ptr<DictionaryValue> expected_source_value(source.ToValue()); |
| 108 | 106 |
| 109 SyncSessionSnapshot snapshot(syncer_status, | 107 SyncSessionSnapshot snapshot(syncer_status, |
| 110 errors, | 108 errors, |
| 111 kNumServerChangesRemaining, | 109 kNumServerChangesRemaining, |
| 112 kIsShareUsable, | 110 kIsShareUsable, |
| 113 initial_sync_ended, | 111 initial_sync_ended, |
| 114 download_progress_markers, | 112 download_progress_markers, |
| 115 kHasMoreToSync, | 113 kHasMoreToSync, |
| 116 kIsSilenced, | 114 kIsSilenced, |
| 117 kUnsyncedCount, | |
| 118 kNumEncryptionConflicts, | 115 kNumEncryptionConflicts, |
| 119 kNumHierarchyConflicts, | 116 kNumHierarchyConflicts, |
| 120 kNumSimpleConflicts, | 117 kNumSimpleConflicts, |
| 121 kNumServerConflicts, | 118 kNumServerConflicts, |
| 122 kDidCommitItems, | |
| 123 source, | 119 source, |
| 124 false, | 120 false, |
| 125 0, | 121 0, |
| 126 base::Time::Now(), | 122 base::Time::Now(), |
| 127 false); | 123 false); |
| 128 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); | 124 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); |
| 129 EXPECT_EQ(16u, value->size()); | 125 EXPECT_EQ(14u, value->size()); |
| 130 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, | 126 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, |
| 131 "syncerStatus"); | 127 "syncerStatus"); |
| 132 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, | 128 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, |
| 133 "numServerChangesRemaining"); | 129 "numServerChangesRemaining"); |
| 134 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); | 130 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); |
| 135 ExpectDictListValue(*expected_initial_sync_ended_value, *value, | 131 ExpectDictListValue(*expected_initial_sync_ended_value, *value, |
| 136 "initialSyncEnded"); | 132 "initialSyncEnded"); |
| 137 ExpectDictDictionaryValue(*expected_download_progress_markers_value, | 133 ExpectDictDictionaryValue(*expected_download_progress_markers_value, |
| 138 *value, "downloadProgressMarkers"); | 134 *value, "downloadProgressMarkers"); |
| 139 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); | 135 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); |
| 140 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); | 136 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); |
| 141 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount"); | |
| 142 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, | 137 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, |
| 143 "numEncryptionConflicts"); | 138 "numEncryptionConflicts"); |
| 144 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, | 139 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, |
| 145 "numHierarchyConflicts"); | 140 "numHierarchyConflicts"); |
| 146 ExpectDictIntegerValue(kNumSimpleConflicts, *value, | 141 ExpectDictIntegerValue(kNumSimpleConflicts, *value, |
| 147 "numSimpleConflicts"); | 142 "numSimpleConflicts"); |
| 148 ExpectDictIntegerValue(kNumServerConflicts, *value, | 143 ExpectDictIntegerValue(kNumServerConflicts, *value, |
| 149 "numServerConflicts"); | 144 "numServerConflicts"); |
| 150 ExpectDictBooleanValue(kDidCommitItems, *value, | |
| 151 "didCommitItems"); | |
| 152 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | 145 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); |
| 153 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); | 146 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); |
| 154 } | 147 } |
| 155 | 148 |
| 156 } // namespace | 149 } // namespace |
| 157 } // namespace sessions | 150 } // namespace sessions |
| 158 } // namespace browser_sync | 151 } // namespace browser_sync |
| OLD | NEW |