| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "chrome/browser/sync/glue/shared_change_processor.h" | 5 #include "chrome/browser/sync/glue/shared_change_processor.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 DCHECK(db_syncable_service_.get()); | 95 DCHECK(db_syncable_service_.get()); |
| 96 db_syncable_service_.reset(); | 96 db_syncable_service_.reset(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Used by Connect(). The SharedChangeProcessor is passed in | 99 // Used by Connect(). The SharedChangeProcessor is passed in |
| 100 // because we modify |shared_change_processor_| on the main thread | 100 // because we modify |shared_change_processor_| on the main thread |
| 101 // (in TearDown()). | 101 // (in TearDown()). |
| 102 void ConnectOnDBThread( | 102 void ConnectOnDBThread( |
| 103 const scoped_refptr<SharedChangeProcessor>& shared_change_processor) { | 103 const scoped_refptr<SharedChangeProcessor>& shared_change_processor) { |
| 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 105 EXPECT_CALL(sync_factory_, GetSyncableServiceForType(syncable::AUTOFILL)). | 105 EXPECT_CALL(sync_factory_, GetSyncableServiceForType(syncer::AUTOFILL)). |
| 106 WillOnce(GetWeakPtrToSyncableService(db_syncable_service_.get())); | 106 WillOnce(GetWeakPtrToSyncableService(db_syncable_service_.get())); |
| 107 EXPECT_TRUE(shared_change_processor->Connect(&sync_factory_, | 107 EXPECT_TRUE(shared_change_processor->Connect(&sync_factory_, |
| 108 &sync_service_, | 108 &sync_service_, |
| 109 &error_handler_, | 109 &error_handler_, |
| 110 syncable::AUTOFILL)); | 110 syncer::AUTOFILL)); |
| 111 } | 111 } |
| 112 | 112 |
| 113 MessageLoopForUI ui_loop_; | 113 MessageLoopForUI ui_loop_; |
| 114 content::TestBrowserThread ui_thread_; | 114 content::TestBrowserThread ui_thread_; |
| 115 content::TestBrowserThread db_thread_; | 115 content::TestBrowserThread db_thread_; |
| 116 | 116 |
| 117 scoped_refptr<SharedChangeProcessor> shared_change_processor_; | 117 scoped_refptr<SharedChangeProcessor> shared_change_processor_; |
| 118 NiceMock<ProfileSyncComponentsFactoryMock> sync_factory_; | 118 NiceMock<ProfileSyncComponentsFactoryMock> sync_factory_; |
| 119 NiceMock<ProfileSyncServiceMock> sync_service_; | 119 NiceMock<ProfileSyncServiceMock> sync_service_; |
| 120 StrictMock<DataTypeErrorHandlerMock> error_handler_; | 120 StrictMock<DataTypeErrorHandlerMock> error_handler_; |
| 121 | 121 |
| 122 // Used only on DB thread. | 122 // Used only on DB thread. |
| 123 scoped_ptr<syncer::FakeSyncableService> db_syncable_service_; | 123 scoped_ptr<syncer::FakeSyncableService> db_syncable_service_; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 // Simply connect the shared change processor. It should succeed, and | 126 // Simply connect the shared change processor. It should succeed, and |
| 127 // nothing further should happen. | 127 // nothing further should happen. |
| 128 TEST_F(SyncSharedChangeProcessorTest, Basic) { | 128 TEST_F(SyncSharedChangeProcessorTest, Basic) { |
| 129 Connect(); | 129 Connect(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace | 132 } // namespace |
| 133 | 133 |
| 134 } // namespace browser_sync | 134 } // namespace browser_sync |
| OLD | NEW |