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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 &SyncBackupManagerTest::HandleInit))); | 59 &SyncBackupManagerTest::HandleInit))); |
60 | 60 |
61 manager->AddObserver(this); | 61 manager->AddObserver(this); |
62 | 62 |
63 base::RunLoop run_loop; | 63 base::RunLoop run_loop; |
64 | 64 |
65 SyncManager::InitArgs args; | 65 SyncManager::InitArgs args; |
66 args.database_location = temp_dir_.path(); | 66 args.database_location = temp_dir_.path(); |
67 args.event_handler = MakeWeakHandle(base::WeakPtr<JsEventHandler>()); | 67 args.event_handler = MakeWeakHandle(base::WeakPtr<JsEventHandler>()); |
68 args.service_url = GURL("https://example.com/"); | 68 args.service_url = GURL("https://example.com/"); |
69 args.post_factory = scoped_ptr<HttpPostProviderFactory>().Pass(); | 69 args.post_factory = scoped_ptr<HttpPostProviderFactory>(); |
70 args.internal_components_factory.reset(new TestInternalComponentsFactory( | 70 args.internal_components_factory.reset(new TestInternalComponentsFactory( |
71 InternalComponentsFactory::Switches(), storage_option, | 71 InternalComponentsFactory::Switches(), storage_option, |
72 &storage_used_)); | 72 &storage_used_)); |
73 manager->Init(&args); | 73 manager->Init(&args); |
74 EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK_DEFERRED, | 74 EXPECT_EQ(InternalComponentsFactory::STORAGE_ON_DISK_DEFERRED, |
75 storage_used_); | 75 storage_used_); |
76 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); | 76 loop_.PostTask(FROM_HERE, run_loop.QuitClosure()); |
77 run_loop.Run(); | 77 run_loop.Run(); |
78 } | 78 } |
79 | 79 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 TEST_F(SyncBackupManagerTest, FailToInitialize) { | 177 TEST_F(SyncBackupManagerTest, FailToInitialize) { |
178 // Test graceful shutdown on initialization failure. | 178 // Test graceful shutdown on initialization failure. |
179 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); | 179 scoped_ptr<SyncBackupManager> manager(new SyncBackupManager); |
180 InitManager(manager.get(), InternalComponentsFactory::STORAGE_INVALID); | 180 InitManager(manager.get(), InternalComponentsFactory::STORAGE_INVALID); |
181 } | 181 } |
182 | 182 |
183 } // anonymous namespace | 183 } // anonymous namespace |
184 | 184 |
185 } // namespace syncer | 185 } // namespace syncer |
OLD | NEW |