| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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/engine/apply_updates_command.h" | 5 #include "chrome/browser/sync/engine/apply_updates_command.h" |
| 6 #include "chrome/browser/sync/engine/sync_cycle_state.h" | 6 #include "chrome/browser/sync/engine/sync_cycle_state.h" |
| 7 #include "chrome/browser/sync/engine/sync_process_state.h" | 7 #include "chrome/browser/sync/engine/sync_process_state.h" |
| 8 #include "chrome/browser/sync/engine/syncer_session.h" | 8 #include "chrome/browser/sync/engine/syncer_session.h" |
| 9 #include "chrome/browser/sync/syncable/directory_manager.h" | 9 #include "chrome/browser/sync/syncable/directory_manager.h" |
| 10 #include "chrome/browser/sync/syncable/syncable.h" | 10 #include "chrome/browser/sync/syncable/syncable.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void CreateUnappliedNewItemWithParent(const string& item_id, | 40 void CreateUnappliedNewItemWithParent(const string& item_id, |
| 41 const string& parent_id) { | 41 const string& parent_id) { |
| 42 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); | 42 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); |
| 43 ASSERT_TRUE(dir.good()); | 43 ASSERT_TRUE(dir.good()); |
| 44 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); | 44 WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__); |
| 45 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, | 45 MutableEntry entry(&trans, syncable::CREATE_NEW_UPDATE_ITEM, |
| 46 Id::CreateFromServerId(item_id)); | 46 Id::CreateFromServerId(item_id)); |
| 47 ASSERT_TRUE(entry.good()); | 47 ASSERT_TRUE(entry.good()); |
| 48 entry.Put(syncable::SERVER_VERSION, next_revision_++); | 48 entry.Put(syncable::SERVER_VERSION, next_revision_++); |
| 49 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); | 49 entry.Put(syncable::IS_UNAPPLIED_UPDATE, true); |
| 50 entry.Put(syncable::SERVER_NAME, item_id); | 50 |
| 51 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); | 51 entry.Put(syncable::SERVER_NON_UNIQUE_NAME, item_id); |
| 52 entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id)); | 52 entry.Put(syncable::SERVER_PARENT_ID, Id::CreateFromServerId(parent_id)); |
| 53 entry.Put(syncable::SERVER_IS_DIR, true); | 53 entry.Put(syncable::SERVER_IS_DIR, true); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TestDirectorySetterUpper syncdb_; | 56 TestDirectorySetterUpper syncdb_; |
| 57 ApplyUpdatesCommand apply_updates_command_; | 57 ApplyUpdatesCommand apply_updates_command_; |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 int64 next_revision_; | 60 int64 next_revision_; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 145 |
| 146 EXPECT_EQ(6, cycle_state.AppliedUpdatesSize()) | 146 EXPECT_EQ(6, cycle_state.AppliedUpdatesSize()) |
| 147 << "All updates should have been attempted"; | 147 << "All updates should have been attempted"; |
| 148 EXPECT_EQ(2, process_state.ConflictingItemsSize()) | 148 EXPECT_EQ(2, process_state.ConflictingItemsSize()) |
| 149 << "The updates with unknown ancestors should be in conflict"; | 149 << "The updates with unknown ancestors should be in conflict"; |
| 150 EXPECT_EQ(4, cycle_state.SuccessfullyAppliedUpdateCount()) | 150 EXPECT_EQ(4, cycle_state.SuccessfullyAppliedUpdateCount()) |
| 151 << "The updates with known ancestors should be successfully applied"; | 151 << "The updates with known ancestors should be successfully applied"; |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace browser_sync | 154 } // namespace browser_sync |
| OLD | NEW |