Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: chrome/browser/sync/sessions/session_state_unittest.cc

Issue 7477004: Simulate transient error and verify exponential backoff. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/sync/sessions/session_state.h" 5 #include "chrome/browser/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"
11 #include "base/time.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chrome/test/base/values_test_util.h" 13 #include "chrome/test/base/values_test_util.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace browser_sync { 16 namespace browser_sync {
16 namespace sessions { 17 namespace sessions {
17 namespace { 18 namespace {
18 19
19 using test::ExpectDictBooleanValue; 20 using test::ExpectDictBooleanValue;
20 using test::ExpectDictDictionaryValue; 21 using test::ExpectDictDictionaryValue;
(...skipping 17 matching lines...) Expand all
38 scoped_ptr<DictionaryValue> value(source_info.ToValue()); 39 scoped_ptr<DictionaryValue> value(source_info.ToValue());
39 EXPECT_EQ(2u, value->size()); 40 EXPECT_EQ(2u, value->size());
40 ExpectDictStringValue("PERIODIC", *value, "updatesSource"); 41 ExpectDictStringValue("PERIODIC", *value, "updatesSource");
41 ExpectDictDictionaryValue(*expected_types_value, *value, "types"); 42 ExpectDictDictionaryValue(*expected_types_value, *value, "types");
42 } 43 }
43 44
44 TEST_F(SessionStateTest, SyncerStatusToValue) { 45 TEST_F(SessionStateTest, SyncerStatusToValue) {
45 SyncerStatus status; 46 SyncerStatus status;
46 status.invalid_store = true; 47 status.invalid_store = true;
47 status.syncer_stuck = false; 48 status.syncer_stuck = false;
48 status.syncing = true; 49 status.sync_in_progress = true;
49 status.num_successful_commits = 5; 50 status.num_successful_commits = 5;
50 status.num_successful_bookmark_commits = 10; 51 status.num_successful_bookmark_commits = 10;
51 status.num_updates_downloaded_total = 100; 52 status.num_updates_downloaded_total = 100;
52 status.num_tombstone_updates_downloaded_total = 200; 53 status.num_tombstone_updates_downloaded_total = 200;
53 status.num_local_overwrites = 15; 54 status.num_local_overwrites = 15;
54 status.num_server_overwrites = 18; 55 status.num_server_overwrites = 18;
55 56
56 scoped_ptr<DictionaryValue> value(status.ToValue()); 57 scoped_ptr<DictionaryValue> value(status.ToValue());
57 EXPECT_EQ(9u, value->size()); 58 EXPECT_EQ(9u, value->size());
58 ExpectDictBooleanValue(status.invalid_store, *value, "invalidStore"); 59 ExpectDictBooleanValue(status.invalid_store, *value, "invalidStore");
59 ExpectDictBooleanValue(status.syncer_stuck, *value, "syncerStuck"); 60 ExpectDictBooleanValue(status.syncer_stuck, *value, "syncerStuck");
60 ExpectDictBooleanValue(status.syncing, *value, "syncing"); 61 ExpectDictBooleanValue(status.sync_in_progress, *value, "syncInProgress");
61 ExpectDictIntegerValue(status.num_successful_commits, 62 ExpectDictIntegerValue(status.num_successful_commits,
62 *value, "numSuccessfulCommits"); 63 *value, "numSuccessfulCommits");
63 ExpectDictIntegerValue(status.num_successful_bookmark_commits, 64 ExpectDictIntegerValue(status.num_successful_bookmark_commits,
64 *value, "numSuccessfulBookmarkCommits"); 65 *value, "numSuccessfulBookmarkCommits");
65 ExpectDictIntegerValue(status.num_updates_downloaded_total, 66 ExpectDictIntegerValue(status.num_updates_downloaded_total,
66 *value, "numUpdatesDownloadedTotal"); 67 *value, "numUpdatesDownloadedTotal");
67 ExpectDictIntegerValue(status.num_tombstone_updates_downloaded_total, 68 ExpectDictIntegerValue(status.num_tombstone_updates_downloaded_total,
68 *value, "numTombstoneUpdatesDownloadedTotal"); 69 *value, "numTombstoneUpdatesDownloadedTotal");
69 ExpectDictIntegerValue(status.num_local_overwrites, 70 ExpectDictIntegerValue(status.num_local_overwrites,
70 *value, "numLocalOverwrites"); 71 *value, "numLocalOverwrites");
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 kIsShareUsable, 154 kIsShareUsable,
154 initial_sync_ended, 155 initial_sync_ended,
155 download_progress_markers, 156 download_progress_markers,
156 kHasMoreToSync, 157 kHasMoreToSync,
157 kIsSilenced, 158 kIsSilenced,
158 kUnsyncedCount, 159 kUnsyncedCount,
159 kNumBlockingConflictingUpdates, 160 kNumBlockingConflictingUpdates,
160 kNumConflictingUpdates, 161 kNumConflictingUpdates,
161 kDidCommitItems, 162 kDidCommitItems,
162 source, 163 source,
163 0); 164 0,
165 base::Time::Now());
164 scoped_ptr<DictionaryValue> value(snapshot.ToValue()); 166 scoped_ptr<DictionaryValue> value(snapshot.ToValue());
165 EXPECT_EQ(14u, value->size()); 167 EXPECT_EQ(14u, value->size());
166 ExpectDictDictionaryValue(*expected_syncer_status_value, *value, 168 ExpectDictDictionaryValue(*expected_syncer_status_value, *value,
167 "syncerStatus"); 169 "syncerStatus");
168 ExpectDictDictionaryValue(*expected_errors_value, *value, "errors"); 170 ExpectDictDictionaryValue(*expected_errors_value, *value, "errors");
169 ExpectDictIntegerValue(kNumServerChangesRemaining, *value, 171 ExpectDictIntegerValue(kNumServerChangesRemaining, *value,
170 "numServerChangesRemaining"); 172 "numServerChangesRemaining");
171 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable"); 173 ExpectDictBooleanValue(kIsShareUsable, *value, "isShareUsable");
172 ExpectDictListValue(*expected_initial_sync_ended_value, *value, 174 ExpectDictListValue(*expected_initial_sync_ended_value, *value,
173 "initialSyncEnded"); 175 "initialSyncEnded");
174 ExpectDictDictionaryValue(*expected_download_progress_markers_value, 176 ExpectDictDictionaryValue(*expected_download_progress_markers_value,
175 *value, "downloadProgressMarkers"); 177 *value, "downloadProgressMarkers");
176 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync"); 178 ExpectDictBooleanValue(kHasMoreToSync, *value, "hasMoreToSync");
177 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced"); 179 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced");
178 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount"); 180 ExpectDictIntegerValue(kUnsyncedCount, *value, "unsyncedCount");
179 ExpectDictIntegerValue(kNumBlockingConflictingUpdates, *value, 181 ExpectDictIntegerValue(kNumBlockingConflictingUpdates, *value,
180 "numBlockingConflictingUpdates"); 182 "numBlockingConflictingUpdates");
181 ExpectDictIntegerValue(kNumConflictingUpdates, *value, 183 ExpectDictIntegerValue(kNumConflictingUpdates, *value,
182 "numConflictingUpdates"); 184 "numConflictingUpdates");
183 ExpectDictBooleanValue(kDidCommitItems, *value, 185 ExpectDictBooleanValue(kDidCommitItems, *value,
184 "didCommitItems"); 186 "didCommitItems");
185 ExpectDictDictionaryValue(*expected_source_value, *value, "source"); 187 ExpectDictDictionaryValue(*expected_source_value, *value, "source");
186 } 188 }
187 189
188 } // namespace 190 } // namespace
189 } // namespace sessions 191 } // namespace sessions
190 } // namespace browser_sync 192 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/session_state.cc ('k') | chrome/browser/sync/sessions/status_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698