OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 // Unit tests for the SyncApi. Note that a lot of the underlying | 5 // Unit tests for the SyncApi. Note that a lot of the underlying |
6 // functionality is provided by the Syncable layer, which has its own | 6 // functionality is provided by the Syncable layer, which has its own |
7 // unit tests. We'll test SyncApi specific things in this harness. | 7 // unit tests. We'll test SyncApi specific things in this harness. |
8 | 8 |
9 #include <cstddef> | 9 #include <cstddef> |
10 #include <map> | 10 #include <map> |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 credentials.email = "foo@bar.com"; | 806 credentials.email = "foo@bar.com"; |
807 credentials.sync_token = "sometoken"; | 807 credentials.sync_token = "sometoken"; |
808 | 808 |
809 sync_manager_.AddObserver(&manager_observer_); | 809 sync_manager_.AddObserver(&manager_observer_); |
810 EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)). | 810 EXPECT_CALL(manager_observer_, OnInitializationComplete(_, _, _, _)). |
811 WillOnce(DoAll(SaveArg<0>(&js_backend_), | 811 WillOnce(DoAll(SaveArg<0>(&js_backend_), |
812 SaveArg<2>(&initialization_succeeded_))); | 812 SaveArg<2>(&initialization_succeeded_))); |
813 | 813 |
814 EXPECT_FALSE(js_backend_.IsInitialized()); | 814 EXPECT_FALSE(js_backend_.IsInitialized()); |
815 | 815 |
816 std::vector<ModelSafeWorker*> workers; | 816 std::vector<scoped_refptr<ModelSafeWorker> > workers; |
817 ModelSafeRoutingInfo routing_info; | 817 ModelSafeRoutingInfo routing_info; |
818 GetModelSafeRoutingInfo(&routing_info); | 818 GetModelSafeRoutingInfo(&routing_info); |
819 | 819 |
820 // This works only because all routing info types are GROUP_PASSIVE. | 820 // This works only because all routing info types are GROUP_PASSIVE. |
821 // If we had types in other groups, we would need additional workers | 821 // If we had types in other groups, we would need additional workers |
822 // to support them. | 822 // to support them. |
823 scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(GROUP_PASSIVE); | 823 scoped_refptr<ModelSafeWorker> worker = new FakeModelWorker(GROUP_PASSIVE); |
824 workers.push_back(worker.get()); | 824 workers.push_back(worker); |
825 | 825 |
826 // Takes ownership of |fake_invalidator_|. | 826 // Takes ownership of |fake_invalidator_|. |
827 sync_manager_.Init( | 827 sync_manager_.Init( |
828 temp_dir_.path(), | 828 temp_dir_.path(), |
829 WeakHandle<JsEventHandler>(), | 829 WeakHandle<JsEventHandler>(), |
830 "bogus", | 830 "bogus", |
831 0, | 831 0, |
832 false, | 832 false, |
833 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()), | 833 scoped_ptr<HttpPostProviderFactory>(new TestHttpPostProviderFactory()), |
834 workers, | 834 workers, |
(...skipping 2676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3511 // SyncManagerInitInvalidStorageTest::GetFactory will return | 3511 // SyncManagerInitInvalidStorageTest::GetFactory will return |
3512 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. | 3512 // DirectoryBackingStore that ensures that SyncManagerImpl::OpenDirectory fails. |
3513 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's | 3513 // SyncManagerImpl initialization is done in SyncManagerTest::SetUp. This test's |
3514 // task is to ensure that SyncManagerImpl reported initialization failure in | 3514 // task is to ensure that SyncManagerImpl reported initialization failure in |
3515 // OnInitializationComplete callback. | 3515 // OnInitializationComplete callback. |
3516 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { | 3516 TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { |
3517 EXPECT_FALSE(initialization_succeeded_); | 3517 EXPECT_FALSE(initialization_succeeded_); |
3518 } | 3518 } |
3519 | 3519 |
3520 } // namespace | 3520 } // namespace |
OLD | NEW |