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 "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "sync/internal_api/public/read_node.h" | 9 #include "sync/internal_api/public/read_node.h" |
10 #include "sync/internal_api/public/read_transaction.h" | 10 #include "sync/internal_api/public/read_transaction.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 MOCK_METHOD1(OnMigrationRequested, void(ModelTypeSet));; | 85 MOCK_METHOD1(OnMigrationRequested, void(ModelTypeSet));; |
86 MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); | 86 MOCK_METHOD1(OnProtocolEvent, void(const ProtocolEvent&)); |
87 | 87 |
88 void OnConfigDone(bool success) { | 88 void OnConfigDone(bool success) { |
89 EXPECT_TRUE(success); | 89 EXPECT_TRUE(success); |
90 } | 90 } |
91 | 91 |
92 int64 CreateEntry(UserShare* user_share, ModelType type, | 92 int64 CreateEntry(UserShare* user_share, ModelType type, |
93 const std::string& client_tag) { | 93 const std::string& client_tag) { |
94 WriteTransaction trans(FROM_HERE, user_share); | 94 WriteTransaction trans(FROM_HERE, user_share); |
95 ReadNode type_root(&trans); | |
96 EXPECT_EQ(BaseNode::INIT_OK, type_root.InitTypeRoot(type)); | |
97 | |
98 WriteNode node(&trans); | 95 WriteNode node(&trans); |
99 EXPECT_EQ(WriteNode::INIT_SUCCESS, | 96 EXPECT_EQ(WriteNode::INIT_SUCCESS, |
100 node.InitUniqueByCreation(type, type_root, client_tag)); | 97 node.InitUniqueByCreation(type, client_tag)); |
101 return node.GetEntry()->GetMetahandle(); | 98 return node.GetEntry()->GetMetahandle(); |
102 } | 99 } |
103 | 100 |
104 void InitManager(SyncManager* manager, ModelTypeSet types, | 101 void InitManager(SyncManager* manager, ModelTypeSet types, |
105 TestChangeDelegate* delegate, | 102 TestChangeDelegate* delegate, |
106 InternalComponentsFactory::StorageOption storage_option) { | 103 InternalComponentsFactory::StorageOption storage_option) { |
107 manager_ = manager; | 104 manager_ = manager; |
108 types_ = types; | 105 types_ = types; |
109 | 106 |
110 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) | 107 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 // Test graceful shutdown on initialization failure. | 256 // Test graceful shutdown on initialization failure. |
260 scoped_ptr<SyncRollbackManager> rollback_manager( | 257 scoped_ptr<SyncRollbackManager> rollback_manager( |
261 new SyncRollbackManager); | 258 new SyncRollbackManager); |
262 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, | 259 InitManager(rollback_manager.get(), ModelTypeSet(PREFERENCES), NULL, |
263 InternalComponentsFactory::STORAGE_ON_DISK); | 260 InternalComponentsFactory::STORAGE_ON_DISK); |
264 } | 261 } |
265 | 262 |
266 } // anonymous namespace | 263 } // anonymous namespace |
267 | 264 |
268 } // namespace syncer | 265 } // namespace syncer |
OLD | NEW |