| 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/internal_api/public/sessions/sync_session_snapshot.h" | 5 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/test/values_test_util.h" | 8 #include "base/test/values_test_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "sync/internal_api/public/sessions/sync_source_info.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 11 |
| 13 namespace syncer { | 12 namespace syncer { |
| 14 namespace sessions { | 13 namespace sessions { |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 using base::ExpectDictBooleanValue; | 16 using base::ExpectDictBooleanValue; |
| 18 using base::ExpectDictDictionaryValue; | 17 using base::ExpectDictDictionaryValue; |
| 19 using base::ExpectDictIntegerValue; | 18 using base::ExpectDictIntegerValue; |
| 20 using base::ExpectDictListValue; | 19 using base::ExpectDictListValue; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 download_progress_markers[BOOKMARKS] = "test"; | 36 download_progress_markers[BOOKMARKS] = "test"; |
| 38 download_progress_markers[APPS] = "apps"; | 37 download_progress_markers[APPS] = "apps"; |
| 39 scoped_ptr<base::DictionaryValue> expected_download_progress_markers_value( | 38 scoped_ptr<base::DictionaryValue> expected_download_progress_markers_value( |
| 40 ProgressMarkerMapToValue(download_progress_markers)); | 39 ProgressMarkerMapToValue(download_progress_markers)); |
| 41 | 40 |
| 42 const bool kIsSilenced = true; | 41 const bool kIsSilenced = true; |
| 43 const int kNumEncryptionConflicts = 1054; | 42 const int kNumEncryptionConflicts = 1054; |
| 44 const int kNumHierarchyConflicts = 1055; | 43 const int kNumHierarchyConflicts = 1055; |
| 45 const int kNumServerConflicts = 1057; | 44 const int kNumServerConflicts = 1057; |
| 46 | 45 |
| 47 SyncSourceInfo source; | |
| 48 scoped_ptr<base::DictionaryValue> expected_source_value(source.ToValue()); | |
| 49 | |
| 50 SyncSessionSnapshot snapshot(model_neutral, | 46 SyncSessionSnapshot snapshot(model_neutral, |
| 51 download_progress_markers, | 47 download_progress_markers, |
| 52 kIsSilenced, | 48 kIsSilenced, |
| 53 kNumEncryptionConflicts, | 49 kNumEncryptionConflicts, |
| 54 kNumHierarchyConflicts, | 50 kNumHierarchyConflicts, |
| 55 kNumServerConflicts, | 51 kNumServerConflicts, |
| 56 source, | |
| 57 false, | 52 false, |
| 58 0, | 53 0, |
| 59 base::Time::Now(), | 54 base::Time::Now(), |
| 60 std::vector<int>(MODEL_TYPE_COUNT,0), | 55 std::vector<int>(MODEL_TYPE_COUNT,0), |
| 61 std::vector<int>(MODEL_TYPE_COUNT, 0)); | 56 std::vector<int>(MODEL_TYPE_COUNT, 0), |
| 57 sync_pb::GetUpdatesCallerInfo::UNKNOWN); |
| 62 scoped_ptr<base::DictionaryValue> value(snapshot.ToValue()); | 58 scoped_ptr<base::DictionaryValue> value(snapshot.ToValue()); |
| 63 EXPECT_EQ(17u, value->size()); | 59 EXPECT_EQ(17u, value->size()); |
| 64 ExpectDictIntegerValue(model_neutral.num_successful_commits, | 60 ExpectDictIntegerValue(model_neutral.num_successful_commits, |
| 65 *value, "numSuccessfulCommits"); | 61 *value, "numSuccessfulCommits"); |
| 66 ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits, | 62 ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits, |
| 67 *value, "numSuccessfulBookmarkCommits"); | 63 *value, "numSuccessfulBookmarkCommits"); |
| 68 ExpectDictIntegerValue(model_neutral.num_updates_downloaded_total, | 64 ExpectDictIntegerValue(model_neutral.num_updates_downloaded_total, |
| 69 *value, "numUpdatesDownloadedTotal"); | 65 *value, "numUpdatesDownloadedTotal"); |
| 70 ExpectDictIntegerValue(model_neutral.num_tombstone_updates_downloaded_total, | 66 ExpectDictIntegerValue(model_neutral.num_tombstone_updates_downloaded_total, |
| 71 *value, "numTombstoneUpdatesDownloadedTotal"); | 67 *value, "numTombstoneUpdatesDownloadedTotal"); |
| 72 ExpectDictIntegerValue(model_neutral.num_reflected_updates_downloaded_total, | 68 ExpectDictIntegerValue(model_neutral.num_reflected_updates_downloaded_total, |
| 73 *value, "numReflectedUpdatesDownloadedTotal"); | 69 *value, "numReflectedUpdatesDownloadedTotal"); |
| 74 ExpectDictIntegerValue(model_neutral.num_local_overwrites, | 70 ExpectDictIntegerValue(model_neutral.num_local_overwrites, |
| 75 *value, "numLocalOverwrites"); | 71 *value, "numLocalOverwrites"); |
| 76 ExpectDictIntegerValue(model_neutral.num_server_overwrites, | 72 ExpectDictIntegerValue(model_neutral.num_server_overwrites, |
| 77 *value, "numServerOverwrites"); | 73 *value, "numServerOverwrites"); |
| 78 ExpectDictIntegerValue(model_neutral.num_server_changes_remaining, | 74 ExpectDictIntegerValue(model_neutral.num_server_changes_remaining, |
| 79 *value, "numServerChangesRemaining"); | 75 *value, "numServerChangesRemaining"); |
| 80 ExpectDictDictionaryValue(*expected_download_progress_markers_value, | 76 ExpectDictDictionaryValue(*expected_download_progress_markers_value, |
| 81 *value, "downloadProgressMarkers"); | 77 *value, "downloadProgressMarkers"); |
| 82 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); | 78 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); |
| 83 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, | 79 ExpectDictIntegerValue(kNumEncryptionConflicts, *value, |
| 84 "numEncryptionConflicts"); | 80 "numEncryptionConflicts"); |
| 85 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, | 81 ExpectDictIntegerValue(kNumHierarchyConflicts, *value, |
| 86 "numHierarchyConflicts"); | 82 "numHierarchyConflicts"); |
| 87 ExpectDictIntegerValue(kNumServerConflicts, *value, | 83 ExpectDictIntegerValue(kNumServerConflicts, *value, |
| 88 "numServerConflicts"); | 84 "numServerConflicts"); |
| 89 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | |
| 90 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); | 85 ExpectDictBooleanValue(false, *value, "notificationsEnabled"); |
| 91 } | 86 } |
| 92 | 87 |
| 93 } // namespace | 88 } // namespace |
| 94 } // namespace sessions | 89 } // namespace sessions |
| 95 } // namespace syncer | 90 } // namespace syncer |
| OLD | NEW |