OLD | NEW |
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 <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/at_exit.h" | 13 #include "base/at_exit.h" |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
| 17 #include "base/string_number_conversions.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "chrome/browser/sync/engine/conflict_resolver.h" | 19 #include "chrome/browser/sync/engine/conflict_resolver.h" |
19 #include "chrome/browser/sync/engine/get_commit_ids_command.h" | 20 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
20 #include "chrome/browser/sync/engine/model_safe_worker.h" | 21 #include "chrome/browser/sync/engine/model_safe_worker.h" |
21 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 22 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
22 #include "chrome/browser/sync/engine/process_updates_command.h" | 23 #include "chrome/browser/sync/engine/process_updates_command.h" |
23 #include "chrome/browser/sync/engine/syncer.h" | 24 #include "chrome/browser/sync/engine/syncer.h" |
24 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 25 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
25 #include "chrome/browser/sync/engine/syncer_util.h" | 26 #include "chrome/browser/sync/engine/syncer_util.h" |
26 #include "chrome/browser/sync/engine/syncproto.h" | 27 #include "chrome/browser/sync/engine/syncproto.h" |
(...skipping 4948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4975 EXPECT_TRUE(entry_with_id.Get(NEXT_ID).IsRoot()); | 4976 EXPECT_TRUE(entry_with_id.Get(NEXT_ID).IsRoot()); |
4976 } else { | 4977 } else { |
4977 EXPECT_TRUE(entry_with_id.Get(NEXT_ID) == next->second); | 4978 EXPECT_TRUE(entry_with_id.Get(NEXT_ID) == next->second); |
4978 next++; | 4979 next++; |
4979 } | 4980 } |
4980 prev_id = id; | 4981 prev_id = id; |
4981 } | 4982 } |
4982 } | 4983 } |
4983 | 4984 |
4984 void AddRootItemWithPosition(int64 position) { | 4985 void AddRootItemWithPosition(int64 position) { |
4985 string id = string("ServerId") + Int64ToString(next_update_id_++); | 4986 string id = string("ServerId") + base::Int64ToString(next_update_id_++); |
4986 string name = "my name is my id -- " + id; | 4987 string name = "my name is my id -- " + id; |
4987 int revision = next_revision_++; | 4988 int revision = next_revision_++; |
4988 mock_server_->AddUpdateDirectory(id, kRootId, name, revision, revision); | 4989 mock_server_->AddUpdateDirectory(id, kRootId, name, revision, revision); |
4989 mock_server_->SetLastUpdatePosition(position); | 4990 mock_server_->SetLastUpdatePosition(position); |
4990 position_map_.insert( | 4991 position_map_.insert( |
4991 PosMap::value_type(position, Id::CreateFromServerId(id))); | 4992 PosMap::value_type(position, Id::CreateFromServerId(id))); |
4992 } | 4993 } |
4993 private: | 4994 private: |
4994 typedef multimap<int64, Id> PosMap; | 4995 typedef multimap<int64, Id> PosMap; |
4995 PosMap position_map_; | 4996 PosMap position_map_; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5162 Add(low_id_); | 5163 Add(low_id_); |
5163 Add(high_id_); | 5164 Add(high_id_); |
5164 syncer_->SyncShare(this); | 5165 syncer_->SyncShare(this); |
5165 ExpectLocalOrderIsByServerId(); | 5166 ExpectLocalOrderIsByServerId(); |
5166 } | 5167 } |
5167 | 5168 |
5168 const SyncerTest::CommitOrderingTest | 5169 const SyncerTest::CommitOrderingTest |
5169 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5170 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
5170 | 5171 |
5171 } // namespace browser_sync | 5172 } // namespace browser_sync |
OLD | NEW |