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 70 matching lines...) Loading... |
81 } | 81 } |
82 | 82 |
83 bool controller_invocations_allowed_; | 83 bool controller_invocations_allowed_; |
84 scoped_ptr<SyncSession> session_; | 84 scoped_ptr<SyncSession> session_; |
85 scoped_ptr<SyncSessionContext> context_; | 85 scoped_ptr<SyncSessionContext> context_; |
86 ModelSafeRoutingInfo routes_; | 86 ModelSafeRoutingInfo routes_; |
87 }; | 87 }; |
88 | 88 |
89 TEST_F(SyncSessionTest, ScopedContextHelpers) { | 89 TEST_F(SyncSessionTest, ScopedContextHelpers) { |
90 ConflictResolver resolver; | 90 ConflictResolver resolver; |
91 SyncerEventChannel* channel = new SyncerEventChannel( | 91 SyncerEventChannel* channel = new SyncerEventChannel(); |
92 SyncerEvent(SyncerEvent::SHUTDOWN_USE_WITH_CARE)); | |
93 EXPECT_FALSE(context_->resolver()); | 92 EXPECT_FALSE(context_->resolver()); |
94 EXPECT_FALSE(context_->syncer_event_channel()); | 93 EXPECT_FALSE(context_->syncer_event_channel()); |
95 { | 94 { |
96 ScopedSessionContextConflictResolver s_resolver(context_.get(), &resolver); | 95 ScopedSessionContextConflictResolver s_resolver(context_.get(), &resolver); |
97 ScopedSessionContextSyncerEventChannel s_channel(context_.get(), channel); | 96 ScopedSessionContextSyncerEventChannel s_channel(context_.get(), channel); |
98 EXPECT_EQ(&resolver, context_->resolver()); | 97 EXPECT_EQ(&resolver, context_->resolver()); |
99 EXPECT_EQ(channel, context_->syncer_event_channel()); | 98 EXPECT_EQ(channel, context_->syncer_event_channel()); |
100 } | 99 } |
101 EXPECT_FALSE(context_->resolver()); | 100 EXPECT_FALSE(context_->resolver()); |
102 EXPECT_FALSE(context_->syncer_event_channel()); | 101 EXPECT_FALSE(context_->syncer_event_channel()); |
| 102 channel->Notify(SyncerEvent(SyncerEvent::SHUTDOWN_USE_WITH_CARE)); |
103 delete channel; | 103 delete channel; |
104 } | 104 } |
105 | 105 |
106 TEST_F(SyncSessionTest, SetWriteTransaction) { | 106 TEST_F(SyncSessionTest, SetWriteTransaction) { |
107 TestDirectorySetterUpper db; | 107 TestDirectorySetterUpper db; |
108 db.SetUp(); | 108 db.SetUp(); |
109 session_.reset(NULL); | 109 session_.reset(NULL); |
110 context_.reset(new SyncSessionContext(NULL, NULL, db.manager(), this)); | 110 context_.reset(new SyncSessionContext(NULL, NULL, db.manager(), this)); |
111 session_.reset(new SyncSession(context_.get(), this)); | 111 session_.reset(new SyncSession(context_.get(), this)); |
112 context_->set_account_name(db.name()); | 112 context_->set_account_name(db.name()); |
(...skipping 114 matching lines...) Loading... |
227 // Conflict resolution happens after get updates and commit, | 227 // Conflict resolution happens after get updates and commit, |
228 // so we need to loop back and get updates / commit again now | 228 // so we need to loop back and get updates / commit again now |
229 // that we have made forward progress. | 229 // that we have made forward progress. |
230 status()->update_conflicts_resolved(true); | 230 status()->update_conflicts_resolved(true); |
231 EXPECT_TRUE(session_->HasMoreToSync()); | 231 EXPECT_TRUE(session_->HasMoreToSync()); |
232 } | 232 } |
233 | 233 |
234 } // namespace | 234 } // namespace |
235 } // namespace sessions | 235 } // namespace sessions |
236 } // namespace browser_sync | 236 } // namespace browser_sync |
OLD | NEW |