OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/internal_api/sync_rollback_manager.h" | 5 #include "sync/internal_api/sync_rollback_manager.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "sync/internal_api/public/read_node.h" | 8 #include "sync/internal_api/public/read_node.h" |
9 #include "sync/internal_api/public/read_transaction.h" | 9 #include "sync/internal_api/public/read_transaction.h" |
10 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 10 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); | 84 MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); |
85 | 85 |
86 void OnConfigDone(bool success) { | 86 void OnConfigDone(bool success) { |
87 EXPECT_TRUE(success); | 87 EXPECT_TRUE(success); |
88 } | 88 } |
89 | 89 |
90 int64 CreateEntry(UserShare* user_share, ModelType type, | 90 int64 CreateEntry(UserShare* user_share, ModelType type, |
91 const std::string& client_tag) { | 91 const std::string& client_tag) { |
92 WriteTransaction trans(FROM_HERE, user_share); | 92 WriteTransaction trans(FROM_HERE, user_share); |
93 ReadNode type_root(&trans); | 93 ReadNode type_root(&trans); |
94 EXPECT_EQ(BaseNode::INIT_OK, | 94 EXPECT_EQ(BaseNode::INIT_OK, type_root.InitTypeRoot(type)); |
95 type_root.InitByTagLookup(ModelTypeToRootTag(type))); | |
96 | 95 |
97 WriteNode node(&trans); | 96 WriteNode node(&trans); |
98 EXPECT_EQ(WriteNode::INIT_SUCCESS, | 97 EXPECT_EQ(WriteNode::INIT_SUCCESS, |
99 node.InitUniqueByCreation(type, type_root, client_tag)); | 98 node.InitUniqueByCreation(type, type_root, client_tag)); |
100 return node.GetEntry()->GetMetahandle(); | 99 return node.GetEntry()->GetMetahandle(); |
101 } | 100 } |
102 | 101 |
103 void InitManager(SyncManager* manager, ModelTypeSet types, | 102 void InitManager(SyncManager* manager, ModelTypeSet types, |
104 TestChangeDelegate* delegate) { | 103 TestChangeDelegate* delegate) { |
105 manager->AddObserver(this); | 104 manager->AddObserver(this); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Verify new entry was not persisted. | 215 // Verify new entry was not persisted. |
217 rollback_manager.reset(new SyncRollbackManager); | 216 rollback_manager.reset(new SyncRollbackManager); |
218 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), &delegate); | 217 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), &delegate); |
219 EXPECT_FALSE(VerifyEntry(rollback_manager->GetUserShare(), PREFERENCES, | 218 EXPECT_FALSE(VerifyEntry(rollback_manager->GetUserShare(), PREFERENCES, |
220 "pref2")); | 219 "pref2")); |
221 } | 220 } |
222 | 221 |
223 } // anonymous namespace | 222 } // anonymous namespace |
224 | 223 |
225 } // namespace syncer | 224 } // namespace syncer |
OLD | NEW |