| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 29 matching lines...) Expand all Loading... |
| 40 EXPECT_TRUE(status.TestAndClearIsDirty()); | 40 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 41 status.set_num_consecutive_errors(10); | 41 status.set_num_consecutive_errors(10); |
| 42 EXPECT_FALSE(status.TestAndClearIsDirty()); // Only dirty if value changed. | 42 EXPECT_FALSE(status.TestAndClearIsDirty()); // Only dirty if value changed. |
| 43 status.increment_num_consecutive_errors(); | 43 status.increment_num_consecutive_errors(); |
| 44 EXPECT_TRUE(status.TestAndClearIsDirty()); | 44 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 45 status.increment_num_consecutive_errors_by(1); | 45 status.increment_num_consecutive_errors_by(1); |
| 46 EXPECT_TRUE(status.TestAndClearIsDirty()); | 46 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 47 status.increment_num_consecutive_errors_by(0); | 47 status.increment_num_consecutive_errors_by(0); |
| 48 EXPECT_FALSE(status.TestAndClearIsDirty()); | 48 EXPECT_FALSE(status.TestAndClearIsDirty()); |
| 49 | 49 |
| 50 { | |
| 51 ScopedModelSafeGroupRestriction r(&status, GROUP_UI); | |
| 52 status.set_current_download_timestamp(syncable::BOOKMARKS, 100); | |
| 53 EXPECT_TRUE(status.TestAndClearIsDirty()); | |
| 54 } | |
| 55 | |
| 56 status.set_num_server_changes_remaining(30); | 50 status.set_num_server_changes_remaining(30); |
| 57 EXPECT_TRUE(status.TestAndClearIsDirty()); | 51 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 58 | 52 |
| 59 status.set_invalid_store(true); | 53 status.set_invalid_store(true); |
| 60 EXPECT_TRUE(status.TestAndClearIsDirty()); | 54 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 61 status.set_invalid_store(false); | 55 status.set_invalid_store(false); |
| 62 EXPECT_TRUE(status.TestAndClearIsDirty()); | 56 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| 63 | 57 |
| 64 status.set_syncer_stuck(true); | 58 status.set_syncer_stuck(true); |
| 65 EXPECT_TRUE(status.TestAndClearIsDirty()); | 59 EXPECT_TRUE(status.TestAndClearIsDirty()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 status.increment_num_consecutive_transient_error_commits_by(0); | 117 status.increment_num_consecutive_transient_error_commits_by(0); |
| 124 EXPECT_EQ(7, status.error_counters().consecutive_transient_error_commits); | 118 EXPECT_EQ(7, status.error_counters().consecutive_transient_error_commits); |
| 125 | 119 |
| 126 status.set_num_consecutive_errors(8); | 120 status.set_num_consecutive_errors(8); |
| 127 EXPECT_EQ(8, status.error_counters().consecutive_errors); | 121 EXPECT_EQ(8, status.error_counters().consecutive_errors); |
| 128 status.increment_num_consecutive_errors(); | 122 status.increment_num_consecutive_errors(); |
| 129 EXPECT_EQ(9, status.error_counters().consecutive_errors); | 123 EXPECT_EQ(9, status.error_counters().consecutive_errors); |
| 130 status.increment_num_consecutive_errors_by(2); | 124 status.increment_num_consecutive_errors_by(2); |
| 131 EXPECT_EQ(11, status.error_counters().consecutive_errors); | 125 EXPECT_EQ(11, status.error_counters().consecutive_errors); |
| 132 | 126 |
| 133 { | |
| 134 ScopedModelSafeGroupRestriction r(&status, GROUP_UI); | |
| 135 status.set_current_download_timestamp(syncable::BOOKMARKS, 12); | |
| 136 EXPECT_EQ(12, status.ComputeMaxLocalTimestamp()); | |
| 137 } | |
| 138 | |
| 139 status.set_num_server_changes_remaining(13); | 127 status.set_num_server_changes_remaining(13); |
| 140 EXPECT_EQ(13, status.num_server_changes_remaining()); | 128 EXPECT_EQ(13, status.num_server_changes_remaining()); |
| 141 | 129 |
| 142 EXPECT_FALSE(status.syncer_status().invalid_store); | 130 EXPECT_FALSE(status.syncer_status().invalid_store); |
| 143 status.set_invalid_store(true); | 131 status.set_invalid_store(true); |
| 144 EXPECT_TRUE(status.syncer_status().invalid_store); | 132 EXPECT_TRUE(status.syncer_status().invalid_store); |
| 145 | 133 |
| 146 EXPECT_FALSE(status.syncer_status().syncer_stuck); | 134 EXPECT_FALSE(status.syncer_status().syncer_stuck); |
| 147 status.set_syncer_stuck(true); | 135 status.set_syncer_stuck(true); |
| 148 EXPECT_TRUE(status.syncer_status().syncer_stuck); | 136 EXPECT_TRUE(status.syncer_status().syncer_stuck); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 status.GetUnrestrictedUpdateProgress( | 207 status.GetUnrestrictedUpdateProgress( |
| 220 GROUP_UI)->SuccessfullyAppliedUpdateCount(); | 208 GROUP_UI)->SuccessfullyAppliedUpdateCount(); |
| 221 status.mutable_commit_message(); | 209 status.mutable_commit_message(); |
| 222 status.commit_response(); | 210 status.commit_response(); |
| 223 status.mutable_commit_response(); | 211 status.mutable_commit_response(); |
| 224 status.updates_response(); | 212 status.updates_response(); |
| 225 status.mutable_updates_response(); | 213 status.mutable_updates_response(); |
| 226 status.error_counters(); | 214 status.error_counters(); |
| 227 status.syncer_status(); | 215 status.syncer_status(); |
| 228 status.num_server_changes_remaining(); | 216 status.num_server_changes_remaining(); |
| 229 status.ComputeMaxLocalTimestamp(); | |
| 230 status.commit_ids(); | 217 status.commit_ids(); |
| 231 status.HasBookmarkCommitActivity(); | 218 status.HasBookmarkCommitActivity(); |
| 232 status.download_updates_succeeded(); | 219 status.download_updates_succeeded(); |
| 233 status.ServerSaysNothingMoreToDownload(); | 220 status.ServerSaysNothingMoreToDownload(); |
| 234 status.group_restriction(); | 221 status.group_restriction(); |
| 235 } | 222 } |
| 236 | 223 |
| 237 } // namespace sessions | 224 } // namespace sessions |
| 238 } // namespace browser_sync | 225 } // namespace browser_sync |
| OLD | NEW |