| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync_backend_host_impl.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_impl.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 FILE_PATH_LITERAL("sync-test"); | 65 FILE_PATH_LITERAL("sync-test"); |
| 66 | 66 |
| 67 ACTION_P(Signal, event) { | 67 ACTION_P(Signal, event) { |
| 68 event->Signal(); | 68 event->Signal(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void QuitMessageLoop() { | 71 void QuitMessageLoop() { |
| 72 base::MessageLoop::current()->Quit(); | 72 base::MessageLoop::current()->Quit(); |
| 73 } | 73 } |
| 74 | 74 |
| 75 class MockSyncFrontend : public SyncFrontend { | 75 class MockSyncFrontend : public sync_driver::SyncFrontend { |
| 76 public: | 76 public: |
| 77 virtual ~MockSyncFrontend() {} | 77 virtual ~MockSyncFrontend() {} |
| 78 | 78 |
| 79 MOCK_METHOD3( | 79 MOCK_METHOD3( |
| 80 OnBackendInitialized, | 80 OnBackendInitialized, |
| 81 void(const syncer::WeakHandle<syncer::JsBackend>&, | 81 void(const syncer::WeakHandle<syncer::JsBackend>&, |
| 82 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, | 82 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&, |
| 83 bool)); | 83 bool)); |
| 84 MOCK_METHOD0(OnSyncCycleCompleted, void()); | 84 MOCK_METHOD0(OnSyncCycleCompleted, void()); |
| 85 MOCK_METHOD1(OnConnectionStatusChange, | 85 MOCK_METHOD1(OnConnectionStatusChange, |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // |fake_manager_factory_|'s fake_manager() is set on the sync | 229 // |fake_manager_factory_|'s fake_manager() is set on the sync |
| 230 // thread, but we can rely on the message loop barriers to | 230 // thread, but we can rely on the message loop barriers to |
| 231 // guarantee that we see the updated value. | 231 // guarantee that we see the updated value. |
| 232 DCHECK(fake_manager_); | 232 DCHECK(fake_manager_); |
| 233 } | 233 } |
| 234 | 234 |
| 235 // Synchronously configures the backend's datatypes. | 235 // Synchronously configures the backend's datatypes. |
| 236 void ConfigureDataTypes(syncer::ModelTypeSet types_to_add, | 236 void ConfigureDataTypes(syncer::ModelTypeSet types_to_add, |
| 237 syncer::ModelTypeSet types_to_remove, | 237 syncer::ModelTypeSet types_to_remove, |
| 238 syncer::ModelTypeSet types_to_unapply) { | 238 syncer::ModelTypeSet types_to_unapply) { |
| 239 BackendDataTypeConfigurer::DataTypeConfigStateMap config_state_map; | 239 sync_driver::BackendDataTypeConfigurer::DataTypeConfigStateMap |
| 240 BackendDataTypeConfigurer::SetDataTypesState( | 240 config_state_map; |
| 241 BackendDataTypeConfigurer::CONFIGURE_ACTIVE, | 241 sync_driver::BackendDataTypeConfigurer::SetDataTypesState( |
| 242 sync_driver::BackendDataTypeConfigurer::CONFIGURE_ACTIVE, |
| 242 types_to_add, | 243 types_to_add, |
| 243 &config_state_map); | 244 &config_state_map); |
| 244 BackendDataTypeConfigurer::SetDataTypesState( | 245 sync_driver::BackendDataTypeConfigurer::SetDataTypesState( |
| 245 BackendDataTypeConfigurer::DISABLED, | 246 sync_driver::BackendDataTypeConfigurer::DISABLED, |
| 246 types_to_remove, &config_state_map); | 247 types_to_remove, &config_state_map); |
| 247 BackendDataTypeConfigurer::SetDataTypesState( | 248 sync_driver::BackendDataTypeConfigurer::SetDataTypesState( |
| 248 BackendDataTypeConfigurer::UNREADY, | 249 sync_driver::BackendDataTypeConfigurer::UNREADY, |
| 249 types_to_unapply, &config_state_map); | 250 types_to_unapply, &config_state_map); |
| 250 | 251 |
| 251 types_to_add.PutAll(syncer::ControlTypes()); | 252 types_to_add.PutAll(syncer::ControlTypes()); |
| 252 backend_->ConfigureDataTypes( | 253 backend_->ConfigureDataTypes( |
| 253 syncer::CONFIGURE_REASON_RECONFIGURATION, | 254 syncer::CONFIGURE_REASON_RECONFIGURATION, |
| 254 config_state_map, | 255 config_state_map, |
| 255 base::Bind(&SyncBackendHostTest::DownloadReady, | 256 base::Bind(&SyncBackendHostTest::DownloadReady, |
| 256 base::Unretained(this)), | 257 base::Unretained(this)), |
| 257 base::Bind(&SyncBackendHostTest::OnDownloadRetry, | 258 base::Bind(&SyncBackendHostTest::OnDownloadRetry, |
| 258 base::Unretained(this))); | 259 base::Unretained(this))); |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 Difference(syncer::ModelTypeSet::All(), | 778 Difference(syncer::ModelTypeSet::All(), |
| 778 enabled_types_), | 779 enabled_types_), |
| 779 syncer::ModelTypeSet()); | 780 syncer::ModelTypeSet()); |
| 780 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( | 781 EXPECT_FALSE(fake_manager_->GetTypesWithEmptyProgressMarkerToken( |
| 781 error_types).Empty()); | 782 error_types).Empty()); |
| 782 } | 783 } |
| 783 | 784 |
| 784 } // namespace | 785 } // namespace |
| 785 | 786 |
| 786 } // namespace browser_sync | 787 } // namespace browser_sync |
| OLD | NEW |