OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | 8 #include <algorithm> |
9 #include <limits> | 9 #include <limits> |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 #include <set> | 12 #include <set> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
19 #include "base/string_number_conversions.h" | 19 #include "base/string_number_conversions.h" |
20 #include "base/tracked.h" | 20 #include "base/tracked.h" |
21 #include "build/build_config.h" | 21 #include "build/build_config.h" |
22 #include "chrome/browser/sync/engine/conflict_resolver.h" | 22 #include "chrome/browser/sync/engine/conflict_resolver.h" |
23 #include "chrome/browser/sync/engine/get_commit_ids_command.h" | 23 #include "chrome/browser/sync/engine/get_commit_ids_command.h" |
24 #include "chrome/browser/sync/engine/model_safe_worker.h" | 24 #include "chrome/browser/sync/engine/model_safe_worker.h" |
25 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 25 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
26 #include "chrome/browser/sync/engine/process_updates_command.h" | 26 #include "chrome/browser/sync/engine/process_updates_command.h" |
| 27 #include "chrome/browser/sync/engine/nigori_util.h" |
27 #include "chrome/browser/sync/engine/syncer.h" | 28 #include "chrome/browser/sync/engine/syncer.h" |
28 #include "chrome/browser/sync/engine/syncer_proto_util.h" | 29 #include "chrome/browser/sync/engine/syncer_proto_util.h" |
29 #include "chrome/browser/sync/engine/syncer_util.h" | 30 #include "chrome/browser/sync/engine/syncer_util.h" |
30 #include "chrome/browser/sync/engine/syncproto.h" | 31 #include "chrome/browser/sync/engine/syncproto.h" |
31 #include "chrome/browser/sync/protocol/sync.pb.h" | 32 #include "chrome/browser/sync/protocol/sync.pb.h" |
32 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" | 33 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" |
33 #include "chrome/browser/sync/sessions/sync_session_context.h" | 34 #include "chrome/browser/sync/sessions/sync_session_context.h" |
34 #include "chrome/browser/sync/syncable/directory_manager.h" | 35 #include "chrome/browser/sync/syncable/directory_manager.h" |
35 #include "chrome/browser/sync/syncable/model_type.h" | 36 #include "chrome/browser/sync/syncable/model_type.h" |
36 #include "chrome/browser/sync/syncable/syncable.h" | 37 #include "chrome/browser/sync/syncable/syncable.h" |
(...skipping 13 matching lines...) Expand all Loading... |
50 namespace browser_sync { | 51 namespace browser_sync { |
51 | 52 |
52 using syncable::BaseTransaction; | 53 using syncable::BaseTransaction; |
53 using syncable::Blob; | 54 using syncable::Blob; |
54 using syncable::CountEntriesWithName; | 55 using syncable::CountEntriesWithName; |
55 using syncable::Directory; | 56 using syncable::Directory; |
56 using syncable::Entry; | 57 using syncable::Entry; |
57 using syncable::GetFirstEntryWithName; | 58 using syncable::GetFirstEntryWithName; |
58 using syncable::GetOnlyEntryWithName; | 59 using syncable::GetOnlyEntryWithName; |
59 using syncable::Id; | 60 using syncable::Id; |
| 61 using syncable::kEncryptedString; |
60 using syncable::MutableEntry; | 62 using syncable::MutableEntry; |
61 using syncable::ReadTransaction; | 63 using syncable::ReadTransaction; |
62 using syncable::ScopedDirLookup; | 64 using syncable::ScopedDirLookup; |
63 using syncable::WriteTransaction; | 65 using syncable::WriteTransaction; |
64 | 66 |
65 using syncable::BASE_VERSION; | 67 using syncable::BASE_VERSION; |
66 using syncable::CREATE; | 68 using syncable::CREATE; |
67 using syncable::CREATE_NEW_UPDATE_ITEM; | 69 using syncable::CREATE_NEW_UPDATE_ITEM; |
68 using syncable::GET_BY_HANDLE; | 70 using syncable::GET_BY_HANDLE; |
69 using syncable::GET_BY_ID; | 71 using syncable::GET_BY_ID; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 encrypted_bookmark.mutable_encrypted(); | 561 encrypted_bookmark.mutable_encrypted(); |
560 AddDefaultExtensionValue(syncable::BOOKMARKS, &encrypted_bookmark); | 562 AddDefaultExtensionValue(syncable::BOOKMARKS, &encrypted_bookmark); |
561 { | 563 { |
562 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); | 564 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); |
563 MutableEntry entry_x(&wtrans, GET_BY_HANDLE, handle_x); | 565 MutableEntry entry_x(&wtrans, GET_BY_HANDLE, handle_x); |
564 MutableEntry entry_b(&wtrans, GET_BY_HANDLE, handle_b); | 566 MutableEntry entry_b(&wtrans, GET_BY_HANDLE, handle_b); |
565 MutableEntry entry_c(&wtrans, GET_BY_HANDLE, handle_c); | 567 MutableEntry entry_c(&wtrans, GET_BY_HANDLE, handle_c); |
566 MutableEntry entry_e(&wtrans, GET_BY_HANDLE, handle_e); | 568 MutableEntry entry_e(&wtrans, GET_BY_HANDLE, handle_e); |
567 MutableEntry entry_f(&wtrans, GET_BY_HANDLE, handle_f); | 569 MutableEntry entry_f(&wtrans, GET_BY_HANDLE, handle_f); |
568 entry_x.Put(SPECIFICS, encrypted_bookmark); | 570 entry_x.Put(SPECIFICS, encrypted_bookmark); |
| 571 entry_x.Put(NON_UNIQUE_NAME, kEncryptedString); |
569 entry_b.Put(SPECIFICS, DefaultBookmarkSpecifics()); | 572 entry_b.Put(SPECIFICS, DefaultBookmarkSpecifics()); |
570 entry_c.Put(SPECIFICS, DefaultBookmarkSpecifics()); | 573 entry_c.Put(SPECIFICS, DefaultBookmarkSpecifics()); |
571 entry_e.Put(SPECIFICS, encrypted_bookmark); | 574 entry_e.Put(SPECIFICS, encrypted_bookmark); |
| 575 entry_e.Put(NON_UNIQUE_NAME, kEncryptedString); |
572 entry_f.Put(SPECIFICS, DefaultPreferencesSpecifics()); | 576 entry_f.Put(SPECIFICS, DefaultPreferencesSpecifics()); |
573 } | 577 } |
574 | 578 |
575 syncable::ModelTypeSet encrypted_types; | 579 syncable::ModelTypeSet encrypted_types; |
576 encrypted_types.insert(syncable::BOOKMARKS); | 580 encrypted_types.insert(syncable::BOOKMARKS); |
577 syncable::Directory::UnsyncedMetaHandles unsynced_handles; | 581 syncable::Directory::UnsyncedMetaHandles unsynced_handles; |
578 unsynced_handles.push_back(handle_x); | 582 unsynced_handles.push_back(handle_x); |
579 unsynced_handles.push_back(handle_b); | 583 unsynced_handles.push_back(handle_b); |
580 unsynced_handles.push_back(handle_c); | 584 unsynced_handles.push_back(handle_c); |
581 unsynced_handles.push_back(handle_e); | 585 unsynced_handles.push_back(handle_e); |
(...skipping 4658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 Add(low_id_); | 5244 Add(low_id_); |
5241 Add(high_id_); | 5245 Add(high_id_); |
5242 SyncShareAsDelegate(); | 5246 SyncShareAsDelegate(); |
5243 ExpectLocalOrderIsByServerId(); | 5247 ExpectLocalOrderIsByServerId(); |
5244 } | 5248 } |
5245 | 5249 |
5246 const SyncerTest::CommitOrderingTest | 5250 const SyncerTest::CommitOrderingTest |
5247 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; | 5251 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; |
5248 | 5252 |
5249 } // namespace browser_sync | 5253 } // namespace browser_sync |
OLD | NEW |