| 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_echo_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_echo_updates_downloaded_total, |
| 68 *value, "numEchoUpdatesDownloadedTotal"); |
| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ExpectDictIntegerValue(kNumServerConflicts, *value, | 170 ExpectDictIntegerValue(kNumServerConflicts, *value, |
| 168 "numServerConflicts"); | 171 "numServerConflicts"); |
| 169 ExpectDictBooleanValue(kDidCommitItems, *value, | 172 ExpectDictBooleanValue(kDidCommitItems, *value, |
| 170 "didCommitItems"); | 173 "didCommitItems"); |
| 171 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); | 174 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); |
| 172 } | 175 } |
| 173 | 176 |
| 174 } // namespace | 177 } // namespace |
| 175 } // namespace sessions | 178 } // namespace sessions |
| 176 } // namespace browser_sync | 179 } // namespace browser_sync |
| OLD | NEW |