OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "sync/engine/process_commit_response_command.h" | 5 #include "sync/engine/process_commit_response_command.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ModelType model_type, | 91 ModelType model_type, |
92 sessions::OrderedCommitSet *commit_set, | 92 sessions::OrderedCommitSet *commit_set, |
93 sync_pb::ClientToServerMessage *commit, | 93 sync_pb::ClientToServerMessage *commit, |
94 sync_pb::ClientToServerResponse *response) { | 94 sync_pb::ClientToServerResponse *response) { |
95 int64 metahandle = 0; | 95 int64 metahandle = 0; |
96 test_entry_factory_->CreateUnsyncedItem(item_id, parent_id, name, | 96 test_entry_factory_->CreateUnsyncedItem(item_id, parent_id, name, |
97 is_folder, model_type, &metahandle); | 97 is_folder, model_type, &metahandle); |
98 | 98 |
99 // ProcessCommitResponseCommand consumes commit_ids from the session | 99 // ProcessCommitResponseCommand consumes commit_ids from the session |
100 // state, so we need to update that. O(n^2) because it's a test. | 100 // state, so we need to update that. O(n^2) because it's a test. |
101 commit_set->AddCommitItem(metahandle, item_id, model_type); | 101 commit_set->AddCommitItem(metahandle, model_type); |
102 | 102 |
103 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); | 103 WriteTransaction trans(FROM_HERE, UNITTEST, directory()); |
104 MutableEntry entry(&trans, syncable::GET_BY_ID, item_id); | 104 MutableEntry entry(&trans, syncable::GET_BY_ID, item_id); |
105 EXPECT_TRUE(entry.good()); | 105 EXPECT_TRUE(entry.good()); |
106 entry.Put(syncable::SYNCING, true); | 106 entry.Put(syncable::SYNCING, true); |
107 | 107 |
108 // Add to the commit message. | 108 // Add to the commit message. |
109 // TODO(sync): Use the real commit-building code to construct this. | 109 // TODO(sync): Use the real commit-building code to construct this. |
110 commit->set_message_contents(ClientToServerMessage::COMMIT); | 110 commit->set_message_contents(ClientToServerMessage::COMMIT); |
111 sync_pb::SyncEntity* entity = commit->mutable_commit()->add_entries(); | 111 sync_pb::SyncEntity* entity = commit->mutable_commit()->add_entries(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 } | 356 } |
357 } | 357 } |
358 cid = c.GetSuccessorId(); | 358 cid = c.GetSuccessorId(); |
359 child_count++; | 359 child_count++; |
360 } | 360 } |
361 ASSERT_EQ(batch_size*2, child_count) | 361 ASSERT_EQ(batch_size*2, child_count) |
362 << "Too few or too many children in parent folder after commit."; | 362 << "Too few or too many children in parent folder after commit."; |
363 } | 363 } |
364 | 364 |
365 } // namespace syncer | 365 } // namespace syncer |
OLD | NEW |