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

Side by Side Diff: chrome/browser/sync/engine/syncer_unittest.cc

Issue 6182004: [SYNC] Refactor SyncSourceInfo and add support in chrome invalidation client ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Self review. Fix compile error Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Syncer unit tests. Unfortunately a lot of these tests 5 // Syncer unit tests. Unfortunately a lot of these tests
6 // are outdated and need to be reworked and updated. 6 // are outdated and need to be reworked and updated.
7 7
8 #include <algorithm>
9 #include <limits>
8 #include <list> 10 #include <list>
9 #include <map> 11 #include <map>
10 #include <set> 12 #include <set>
11 #include <string> 13 #include <string>
12 14
13 #include "base/callback.h" 15 #include "base/callback.h"
14 #include "base/scoped_ptr.h" 16 #include "base/scoped_ptr.h"
15 #include "base/string_number_conversions.h" 17 #include "base/string_number_conversions.h"
16 #include "build/build_config.h" 18 #include "build/build_config.h"
17 #include "chrome/browser/sync/engine/conflict_resolver.h" 19 #include "chrome/browser/sync/engine/conflict_resolver.h"
18 #include "chrome/browser/sync/engine/get_commit_ids_command.h" 20 #include "chrome/browser/sync/engine/get_commit_ids_command.h"
19 #include "chrome/browser/sync/engine/model_safe_worker.h" 21 #include "chrome/browser/sync/engine/model_safe_worker.h"
20 #include "chrome/browser/sync/engine/net/server_connection_manager.h" 22 #include "chrome/browser/sync/engine/net/server_connection_manager.h"
21 #include "chrome/browser/sync/engine/process_updates_command.h" 23 #include "chrome/browser/sync/engine/process_updates_command.h"
22 #include "chrome/browser/sync/engine/syncer.h" 24 #include "chrome/browser/sync/engine/syncer.h"
23 #include "chrome/browser/sync/engine/syncer_proto_util.h" 25 #include "chrome/browser/sync/engine/syncer_proto_util.h"
24 #include "chrome/browser/sync/engine/syncer_util.h" 26 #include "chrome/browser/sync/engine/syncer_util.h"
25 #include "chrome/browser/sync/engine/syncproto.h" 27 #include "chrome/browser/sync/engine/syncproto.h"
26 #include "chrome/browser/sync/protocol/sync.pb.h" 28 #include "chrome/browser/sync/protocol/sync.pb.h"
27 #include "chrome/browser/sync/syncable/directory_manager.h" 29 #include "chrome/browser/sync/syncable/directory_manager.h"
30 #include "chrome/browser/sync/syncable/model_type.h"
28 #include "chrome/browser/sync/syncable/syncable.h" 31 #include "chrome/browser/sync/syncable/syncable.h"
29 #include "chrome/common/deprecated/event_sys-inl.h" 32 #include "chrome/common/deprecated/event_sys-inl.h"
30 #include "chrome/test/sync/engine/mock_connection_manager.h" 33 #include "chrome/test/sync/engine/mock_connection_manager.h"
31 #include "chrome/test/sync/engine/test_directory_setter_upper.h" 34 #include "chrome/test/sync/engine/test_directory_setter_upper.h"
32 #include "chrome/test/sync/engine/test_id_factory.h" 35 #include "chrome/test/sync/engine/test_id_factory.h"
33 #include "chrome/test/sync/engine/test_syncable_utils.h" 36 #include "chrome/test/sync/engine/test_syncable_utils.h"
34 #include "testing/gtest/include/gtest/gtest.h" 37 #include "testing/gtest/include/gtest/gtest.h"
35 38
36 using base::TimeDelta; 39 using base::TimeDelta;
37 40
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 CHECK(false) << "Handling unknown error type in unit tests!!"; 146 CHECK(false) << "Handling unknown error type in unit tests!!";
144 } 147 }
145 saw_syncer_event_ = true; 148 saw_syncer_event_ = true;
146 } 149 }
147 150
148 SyncSession* MakeSession() { 151 SyncSession* MakeSession() {
149 ModelSafeRoutingInfo info; 152 ModelSafeRoutingInfo info;
150 std::vector<ModelSafeWorker*> workers; 153 std::vector<ModelSafeWorker*> workers;
151 GetModelSafeRoutingInfo(&info); 154 GetModelSafeRoutingInfo(&info);
152 GetWorkers(&workers); 155 GetWorkers(&workers);
153 return new SyncSession(context_.get(), this, sessions::SyncSourceInfo(), 156 syncable::ModelTypeBitSet types;
154 info, workers); 157 types.set();
158 return new SyncSession(context_.get(), this,
159 sessions::SyncSourceInfo(sync_pb::GetUpdatesCallerInfo::UNKNOWN, types),
160 info, workers);
155 } 161 }
156 162
157 bool SyncShareAsDelegate() { 163 bool SyncShareAsDelegate() {
158 scoped_ptr<SyncSession> session(MakeSession()); 164 scoped_ptr<SyncSession> session(MakeSession());
159 syncer_->SyncShare(session.get()); 165 syncer_->SyncShare(session.get());
160 return session->HasMoreToSync(); 166 return session->HasMoreToSync();
161 } 167 }
162 168
163 void LoopSyncShare() { 169 void LoopSyncShare() {
164 bool should_loop = false; 170 bool should_loop = false;
(...skipping 4998 matching lines...) Expand 10 before | Expand all | Expand 10 after
5163 Add(low_id_); 5169 Add(low_id_);
5164 Add(high_id_); 5170 Add(high_id_);
5165 SyncShareAsDelegate(); 5171 SyncShareAsDelegate();
5166 ExpectLocalOrderIsByServerId(); 5172 ExpectLocalOrderIsByServerId();
5167 } 5173 }
5168 5174
5169 const SyncerTest::CommitOrderingTest 5175 const SyncerTest::CommitOrderingTest
5170 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 5176 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
5171 5177
5172 } // namespace browser_sync 5178 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698