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 | 6 |
7 #include "chrome/browser/sync/engine/conflict_resolver.h" | 7 #include "chrome/browser/sync/engine/conflict_resolver.h" |
8 #include "chrome/browser/sync/engine/syncer_types.h" | 8 #include "chrome/browser/sync/engine/syncer_types.h" |
9 #include "chrome/browser/sync/engine/syncer_util.h" | 9 #include "chrome/browser/sync/engine/syncer_util.h" |
10 #include "chrome/browser/sync/syncable/directory_manager.h" | 10 #include "chrome/browser/sync/syncable/directory_manager.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 { | 101 { |
102 ScopedSessionContextConflictResolver s_resolver(context_.get(), &resolver); | 102 ScopedSessionContextConflictResolver s_resolver(context_.get(), &resolver); |
103 EXPECT_EQ(&resolver, context_->resolver()); | 103 EXPECT_EQ(&resolver, context_->resolver()); |
104 } | 104 } |
105 EXPECT_FALSE(context_->resolver()); | 105 EXPECT_FALSE(context_->resolver()); |
106 } | 106 } |
107 | 107 |
108 TEST_F(SyncSessionTest, SetWriteTransaction) { | 108 TEST_F(SyncSessionTest, SetWriteTransaction) { |
109 TestDirectorySetterUpper db; | 109 TestDirectorySetterUpper db; |
110 db.SetUp(); | 110 db.SetUp(); |
111 session_.reset(NULL); | 111 session_.reset(); |
112 context_.reset(new SyncSessionContext(NULL, db.manager(), this, | 112 context_.reset(new SyncSessionContext(NULL, db.manager(), this, |
113 std::vector<SyncEngineEventListener*>())); | 113 std::vector<SyncEngineEventListener*>())); |
114 session_.reset(MakeSession()); | 114 session_.reset(MakeSession()); |
115 context_->set_account_name(db.name()); | 115 context_->set_account_name(db.name()); |
116 syncable::ScopedDirLookup dir(context_->directory_manager(), | 116 syncable::ScopedDirLookup dir(context_->directory_manager(), |
117 context_->account_name()); | 117 context_->account_name()); |
118 ASSERT_TRUE(dir.good()); | 118 ASSERT_TRUE(dir.good()); |
119 | 119 |
120 scoped_ptr<SyncSession> session(MakeSession()); | 120 scoped_ptr<SyncSession> session(MakeSession()); |
121 EXPECT_TRUE(NULL == session->write_transaction()); | 121 EXPECT_TRUE(NULL == session->write_transaction()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 } | 243 } |
244 | 244 |
245 TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) { | 245 TEST_F(SyncSessionTest, MoreToSyncIfConflictsResolved) { |
246 // Conflict resolution happens after get updates and commit, | 246 // Conflict resolution happens after get updates and commit, |
247 // so we need to loop back and get updates / commit again now | 247 // so we need to loop back and get updates / commit again now |
248 // that we have made forward progress. | 248 // that we have made forward progress. |
249 status()->update_conflicts_resolved(true); | 249 status()->update_conflicts_resolved(true); |
250 EXPECT_TRUE(session_->HasMoreToSync()); | 250 EXPECT_TRUE(session_->HasMoreToSync()); |
251 } | 251 } |
252 | 252 |
| 253 TEST_F(SyncSessionTest, ResetTransientState) { |
| 254 status()->update_conflicts_resolved(true); |
| 255 status()->increment_num_successful_commits(); |
| 256 EXPECT_TRUE(session_->HasMoreToSync()); |
| 257 session_->ResetTransientState(); |
| 258 EXPECT_FALSE(status()->conflicts_resolved()); |
| 259 EXPECT_FALSE(session_->HasMoreToSync()); |
| 260 EXPECT_FALSE(status()->TestAndClearIsDirty()); |
| 261 } |
| 262 |
| 263 TEST_F(SyncSessionTest, Coalesce) { |
| 264 |
| 265 } |
| 266 |
253 } // namespace | 267 } // namespace |
254 } // namespace sessions | 268 } // namespace sessions |
255 } // namespace browser_sync | 269 } // namespace browser_sync |
OLD | NEW |