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_backup_manager.h" | 5 #include "sync/internal_api/sync_backup_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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 manager->Init(&args); | 71 manager->Init(&args); |
72 EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK_DEFERRED, | 72 EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK_DEFERRED, |
73 storage_used_); | 73 storage_used_); |
74 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); | 74 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); |
75 run_loop.Run(); | 75 run_loop.Run(); |
76 } | 76 } |
77 | 77 |
78 void CreateEntry(UserShare* user_share, ModelType type, | 78 void CreateEntry(UserShare* user_share, ModelType type, |
79 const std::string& client_tag) { | 79 const std::string& client_tag) { |
80 WriteTransaction trans(FROM_HERE, user_share); | 80 WriteTransaction trans(FROM_HERE, user_share); |
81 ReadNode type_root(&trans); | |
82 EXPECT_EQ(BaseNode::INIT_OK, type_root.InitTypeRoot(type)); | |
83 | 81 |
84 WriteNode node(&trans); | 82 WriteNode node(&trans); |
85 EXPECT_EQ(WriteNode::INIT_SUCCESS, | 83 EXPECT_EQ(WriteNode::INIT_SUCCESS, |
86 node.InitUniqueByCreation(type, type_root, client_tag)); | 84 node.InitUniqueByCreation(type, client_tag)); |
87 } | 85 } |
88 | 86 |
89 void ConfigureSyncer() { | 87 void ConfigureSyncer() { |
90 manager_->ConfigureSyncer(CONFIGURE_REASON_NEW_CLIENT, | 88 manager_->ConfigureSyncer(CONFIGURE_REASON_NEW_CLIENT, |
91 ModelTypeSet(SEARCH_ENGINES), | 89 ModelTypeSet(SEARCH_ENGINES), |
92 ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), | 90 ModelTypeSet(), ModelTypeSet(), ModelTypeSet(), |
93 ModelSafeRoutingInfo(), | 91 ModelSafeRoutingInfo(), |
94 base::Bind(&OnConfigDone, true), | 92 base::Bind(&OnConfigDone, true), |
95 base::Bind(&OnConfigDone, false)); | 93 base::Bind(&OnConfigDone, false)); |
96 } | 94 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 174 |
177 TEST_F(SyncBackupManagerTest, FailToInitialize) { | 175 TEST_F(SyncBackupManagerTest, FailToInitialize) { |
178 // Test graceful shutdown on initialization failure. | 176 // Test graceful shutdown on initialization failure. |
179 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); | 177 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); |
180 InitManager(manager.get(), InternalComponentsFactory::STORAGE_INVALID); | 178 InitManager(manager.get(), InternalComponentsFactory::STORAGE_INVALID); |
181 } | 179 } |
182 | 180 |
183 } // anonymous namespace | 181 } // anonymous namespace |
184 | 182 |
185 } // namespace syncer | 183 } // namespace syncer |
OLD | NEW |