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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 manager_ = manager; | 53 manager_ = manager; |
54 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) | 54 EXPECT_CALL(*this, OnInitializationComplete(_, _, _, _)) |
55 .WillOnce(WithArgs<2>(Invoke(this, | 55 .WillOnce(WithArgs<2>(Invoke(this, |
56 &SyncBackupManagerTest::HandleInit))); | 56 &SyncBackupManagerTest::HandleInit))); |
57 | 57 |
58 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(), | 58 TestInternalComponentsFactory factory(InternalComponentsFactory::Switches(), |
59 storage_option); | 59 storage_option); |
60 manager->AddObserver(this); | 60 manager->AddObserver(this); |
61 | 61 |
62 base::RunLoop run_loop; | 62 base::RunLoop run_loop; |
63 manager->Init(temp_dir_.path(), | 63 |
64 MakeWeakHandle(base::WeakPtr<JsEventHandler>()), | 64 SyncManager::InitArgs args; |
65 GURL("https://example.com/"), | 65 args.database_location = temp_dir_.path(); |
66 scoped_ptr<HttpPostProviderFactory>().Pass(), | 66 args.event_handler = MakeWeakHandle(base::WeakPtr<JsEventHandler>()); |
67 std::vector<scoped_refptr<ModelSafeWorker> >(), | 67 args.service_url = GURL("https://example.com/"); |
68 NULL, | 68 args.post_factory = scoped_ptr<HttpPostProviderFactory>().Pass(); |
69 NULL, | 69 args.internal_components_factory = &factory; |
70 SyncCredentials(), | 70 manager->Init(&args); |
71 "", | |
72 "", | |
73 "", | |
74 &factory, | |
75 NULL, | |
76 scoped_ptr<UnrecoverableErrorHandler>().Pass(), | |
77 NULL, | |
78 NULL); | |
79 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); | 71 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); |
80 run_loop.Run(); | 72 run_loop.Run(); |
81 } | 73 } |
82 | 74 |
83 void CreateEntry(UserShare* user_share, ModelType type, | 75 void CreateEntry(UserShare* user_share, ModelType type, |
84 const std::string& client_tag) { | 76 const std::string& client_tag) { |
85 WriteTransaction trans(FROM_HERE, user_share); | 77 WriteTransaction trans(FROM_HERE, user_share); |
86 ReadNode type_root(&trans); | 78 ReadNode type_root(&trans); |
87 EXPECT_EQ(BaseNode::INIT_OK, type_root.InitTypeRoot(type)); | 79 EXPECT_EQ(BaseNode::INIT_OK, type_root.InitTypeRoot(type)); |
88 | 80 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 152 |
161 TEST_F(SyncBackupManagerTest, FailToInitialize) { | 153 TEST_F(SyncBackupManagerTest, FailToInitialize) { |
162 // Test graceful shutdown on initialization failure. | 154 // Test graceful shutdown on initialization failure. |
163 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); | 155 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); |
164 InitManager(manager.get(), STORAGE_INVALID); | 156 InitManager(manager.get(), STORAGE_INVALID); |
165 } | 157 } |
166 | 158 |
167 } // anonymous namespace | 159 } // anonymous namespace |
168 | 160 |
169 } // namespace syncer | 161 } // namespace syncer |
OLD | NEW |