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

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

Issue 7621085: Server directed error handling backend code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload before commit. Created 9 years, 3 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/sync_session.h" 5 #include "chrome/browser/sync/sessions/sync_session.h"
6 #include "chrome/test/sync/engine/test_id_factory.h" 6 #include "chrome/test/sync/engine/test_id_factory.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace browser_sync { 9 namespace browser_sync {
10 namespace sessions { 10 namespace sessions {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 status.set_commit_set(commits); 101 status.set_commit_set(commits);
102 EXPECT_FALSE(status.TestAndClearIsDirty()); 102 EXPECT_FALSE(status.TestAndClearIsDirty());
103 } 103 }
104 104
105 // This test is useful, as simple as it sounds, due to the copy-paste prone 105 // This test is useful, as simple as it sounds, due to the copy-paste prone
106 // nature of status_controller.cc (we have had bugs in the past where a set_foo 106 // nature of status_controller.cc (we have had bugs in the past where a set_foo
107 // method was actually setting |bar_| instead!). 107 // method was actually setting |bar_| instead!).
108 TEST_F(StatusControllerTest, ReadYourWrites) { 108 TEST_F(StatusControllerTest, ReadYourWrites) {
109 StatusController status(routes_); 109 StatusController status(routes_);
110 status.increment_num_conflicting_commits_by(1); 110 status.increment_num_conflicting_commits_by(1);
111 EXPECT_EQ(1, status.error_counters().num_conflicting_commits); 111 EXPECT_EQ(1, status.error().num_conflicting_commits);
112 112
113 status.set_num_consecutive_transient_error_commits(6); 113 status.set_num_consecutive_transient_error_commits(6);
114 EXPECT_EQ(6, status.error_counters().consecutive_transient_error_commits); 114 EXPECT_EQ(6, status.error().consecutive_transient_error_commits);
115 status.increment_num_consecutive_transient_error_commits_by(1); 115 status.increment_num_consecutive_transient_error_commits_by(1);
116 EXPECT_EQ(7, status.error_counters().consecutive_transient_error_commits); 116 EXPECT_EQ(7, status.error().consecutive_transient_error_commits);
117 status.increment_num_consecutive_transient_error_commits_by(0); 117 status.increment_num_consecutive_transient_error_commits_by(0);
118 EXPECT_EQ(7, status.error_counters().consecutive_transient_error_commits); 118 EXPECT_EQ(7, status.error().consecutive_transient_error_commits);
119 119
120 status.set_num_consecutive_errors(8); 120 status.set_num_consecutive_errors(8);
121 EXPECT_EQ(8, status.error_counters().consecutive_errors); 121 EXPECT_EQ(8, status.error().consecutive_errors);
122 status.increment_num_consecutive_errors(); 122 status.increment_num_consecutive_errors();
123 EXPECT_EQ(9, status.error_counters().consecutive_errors); 123 EXPECT_EQ(9, status.error().consecutive_errors);
124 status.increment_num_consecutive_errors_by(2); 124 status.increment_num_consecutive_errors_by(2);
125 EXPECT_EQ(11, status.error_counters().consecutive_errors); 125 EXPECT_EQ(11, status.error().consecutive_errors);
126 126
127 status.set_num_server_changes_remaining(13); 127 status.set_num_server_changes_remaining(13);
128 EXPECT_EQ(13, status.num_server_changes_remaining()); 128 EXPECT_EQ(13, status.num_server_changes_remaining());
129 129
130 EXPECT_FALSE(status.syncer_status().invalid_store); 130 EXPECT_FALSE(status.syncer_status().invalid_store);
131 status.set_invalid_store(true); 131 status.set_invalid_store(true);
132 EXPECT_TRUE(status.syncer_status().invalid_store); 132 EXPECT_TRUE(status.syncer_status().invalid_store);
133 133
134 EXPECT_FALSE(status.syncer_status().syncer_stuck); 134 EXPECT_FALSE(status.syncer_status().syncer_stuck);
135 status.set_syncer_stuck(true); 135 status.set_syncer_stuck(true);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Basic test that non group-restricted state accessors don't cause violations. 204 // Basic test that non group-restricted state accessors don't cause violations.
205 TEST_F(StatusControllerTest, Unrestricted) { 205 TEST_F(StatusControllerTest, Unrestricted) {
206 StatusController status(routes_); 206 StatusController status(routes_);
207 status.GetUnrestrictedUpdateProgress( 207 status.GetUnrestrictedUpdateProgress(
208 GROUP_UI)->SuccessfullyAppliedUpdateCount(); 208 GROUP_UI)->SuccessfullyAppliedUpdateCount();
209 status.mutable_commit_message(); 209 status.mutable_commit_message();
210 status.commit_response(); 210 status.commit_response();
211 status.mutable_commit_response(); 211 status.mutable_commit_response();
212 status.updates_response(); 212 status.updates_response();
213 status.mutable_updates_response(); 213 status.mutable_updates_response();
214 status.error_counters(); 214 status.error();
215 status.syncer_status(); 215 status.syncer_status();
216 status.num_server_changes_remaining(); 216 status.num_server_changes_remaining();
217 status.commit_ids(); 217 status.commit_ids();
218 status.HasBookmarkCommitActivity(); 218 status.HasBookmarkCommitActivity();
219 status.download_updates_succeeded(); 219 status.download_updates_succeeded();
220 status.ServerSaysNothingMoreToDownload(); 220 status.ServerSaysNothingMoreToDownload();
221 status.group_restriction(); 221 status.group_restriction();
222 } 222 }
223 223
224 } // namespace sessions 224 } // namespace sessions
225 } // namespace browser_sync 225 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/sessions/status_controller.cc ('k') | chrome/browser/sync/sessions/sync_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698